Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(441)

Unified Diff: build/android/gyp/lint.py

Issue 1824093002: 🌈 Android: Run lint using a cache in the output directory (fix-up) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/android/android_lint_cache.gyp ('k') | build/config/android/internal_rules.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/gyp/lint.py
diff --git a/build/android/gyp/lint.py b/build/android/gyp/lint.py
index 2d3c79bfcb0c3c1aeeb1cb2b8ce697290228d6ee..782f5deecdd3553530b6c1ca5d3e8dfeadcc989b 100755
--- a/build/android/gyp/lint.py
+++ b/build/android/gyp/lint.py
@@ -130,11 +130,16 @@ def _OnStaleMd5(changes, lint_path, config_path, processed_config_path,
os.remove(result_path)
env = {}
+ stderr_filter = None
if cache_dir:
+ # When _JAVA_OPTIONS is set, java prints to stderr:
+ # Picked up _JAVA_OPTIONS: ...
env['_JAVA_OPTIONS'] = '-Duser.home=%s' % _RelativizePath(cache_dir)
+ stderr_filter = lambda l: '' if '_JAVA_OPTIONS' in l else l
try:
- build_utils.CheckOutput(cmd, cwd=_SRC_ROOT, env=env or None)
+ build_utils.CheckOutput(cmd, cwd=_SRC_ROOT, env=env or None,
+ stderr_filter=stderr_filter)
except build_utils.CalledProcessError:
if can_fail_build:
traceback.print_exc()
@@ -190,6 +195,9 @@ def main():
parser.add_argument('--cache-dir',
help='Path to the directory in which the android cache '
'directory tree should be stored.')
+ parser.add_argument('--create-cache', action='store_true',
+ help='Mark the lint cache file as an output rather than '
+ 'an input.')
parser.add_argument('--can-fail-build', action='store_true',
help='If set, script will exit with nonzero exit status'
' if lint errors are present')
@@ -255,9 +263,13 @@ def main():
if args.cache_dir:
if not args.build_tools_version:
parser.error('--cache-dir specified without --build-tools-version')
- output_paths.append(os.path.join(
- args.cache_dir, '.android', 'cache',
- 'api-versions-6-%s.bin' % args.build_tools_version))
+ _cache_file = os.path.join(
+ args.cache_dir, '.android', 'cache',
+ 'api-versions-6-%s.bin' % args.build_tools_version)
+ if args.create_cache:
+ output_paths.append(_cache_file)
+ else:
+ input_paths.append(_cache_file)
build_utils.CallAndWriteDepfileIfStale(
lambda changes: _OnStaleMd5(changes, args.lint_path,
« no previous file with comments | « build/android/android_lint_cache.gyp ('k') | build/config/android/internal_rules.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698