summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authoraberent <aberent@chromium.org>2016-03-23 05:55:56 -0700
committerCommit bot <commit-bot@chromium.org>2016-03-23 12:57:36 +0000
commit62cc80409b326670a7faafb3db806451fa6cc812 (patch)
tree4a9d889aaadcd7e21eb0c9d2c4b6e19664a6f688 /build
parenteb0a13af4f2b81c62b92a31f7124b12a65d4559a (diff)
downloadchromium_src-62cc80409b326670a7faafb3db806451fa6cc812.zip
chromium_src-62cc80409b326670a7faafb3db806451fa6cc812.tar.gz
chromium_src-62cc80409b326670a7faafb3db806451fa6cc812.tar.bz2
Revert of 🌈 Android: Run lint using a cache in the output directory (fix-up) (patchset #2 id:20001 of https://codereview.chromium.org/1824093002/ )
Reason for revert: Breaks on Android 64bit unpublished builders BUG=597251 Original issue's description: > Android: Run lint using a cache in the output directory (fix-up) > > Previous commit forgot to set --cache-dir for GN. > > BUG=583661 > > Committed: https://crrev.com/99748af41ad073389f3f38274a024a830585609c > Cr-Commit-Position: refs/heads/master@{#382699} TBR=jbudorick@chromium.org,agrieve@chromium.org # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=583661 Review URL: https://codereview.chromium.org/1829683002 Cr-Commit-Position: refs/heads/master@{#382838}
Diffstat (limited to 'build')
-rw-r--r--build/android/BUILD.gn34
-rw-r--r--build/android/android_lint_cache.gyp1
-rwxr-xr-xbuild/android/gyp/lint.py20
-rw-r--r--build/config/android/internal_rules.gni71
4 files changed, 62 insertions, 64 deletions
diff --git a/build/android/BUILD.gn b/build/android/BUILD.gn
index 73b25cd..01deb14 100644
--- a/build/android/BUILD.gn
+++ b/build/android/BUILD.gn
@@ -10,9 +10,37 @@ sun_tools_jar_path = "$root_gen_dir/sun_tools_jar/tools.jar"
# Create or update the API versions cache if necessary by running a
# functionally empty lint task. This prevents racy creation of the
# cache while linting java targets in android_lint.
-android_lint("prepare_android_lint_cache") {
- android_manifest = "//build/android/AndroidManifest.xml"
- create_cache = true
+action("prepare_android_lint_cache") {
+ _cache_dir = "${root_out_dir}/android_lint_cache"
+ depfile = "${_cache_dir}/prepare_android_lint_cache.d"
+ _manifest_file = "//build/android/AndroidManifest.xml"
+ _result_file = "${_cache_dir}/result.xml"
+ script = "//build/android/gyp/lint.py"
+
+ inputs = [
+ "${android_sdk_root}/platform-tools/api/api-versions.xml",
+ ]
+ outputs = [
+ depfile,
+ ]
+ args = [
+ "--build-tools-version",
+ android_sdk_build_tools_version,
+ "--cache-dir",
+ rebase_path(_cache_dir, root_build_dir),
+ "--depfile",
+ rebase_path(depfile, root_build_dir),
+ "--lint-path",
+ "$rebased_android_sdk_root/tools/lint",
+ "--manifest-path",
+ rebase_path(_manifest_file, root_build_dir),
+ "--product-dir",
+ ".",
+ "--result-path",
+ rebase_path(_result_file, root_build_dir),
+ "--silent",
+ "--enable",
+ ]
}
action("find_sun_tools_jar") {
diff --git a/build/android/android_lint_cache.gyp b/build/android/android_lint_cache.gyp
index 20b5f77..a8b514e 100644
--- a/build/android/android_lint_cache.gyp
+++ b/build/android/android_lint_cache.gyp
@@ -37,7 +37,6 @@
'--product-dir', '<(PRODUCT_DIR)',
'--result-path', '<(result_path)',
'--stamp', '<(android_lint_cache_stamp)',
- '--create-cache',
'--silent',
'--enable'
],
diff --git a/build/android/gyp/lint.py b/build/android/gyp/lint.py
index 0aad9c5..9814bf0 100755
--- a/build/android/gyp/lint.py
+++ b/build/android/gyp/lint.py
@@ -130,16 +130,11 @@ 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,
- stderr_filter=stderr_filter)
+ build_utils.CheckOutput(cmd, cwd=_SRC_ROOT, env=env or None)
except build_utils.CalledProcessError:
if can_fail_build:
traceback.print_exc()
@@ -197,9 +192,6 @@ 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')
@@ -265,13 +257,9 @@ def main():
if args.cache_dir:
if not args.build_tools_version:
parser.error('--cache-dir specified without --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)
+ output_paths.append(os.path.join(
+ args.cache_dir, '.android', 'cache',
+ 'api-versions-6-%s.bin' % args.build_tools_version))
build_utils.CallAndWriteDepfileIfStale(
lambda changes: _OnStaleMd5(changes, args.lint_path,
diff --git a/build/config/android/internal_rules.gni b/build/config/android/internal_rules.gni
index 72cf046..79805d1 100644
--- a/build/config/android/internal_rules.gni
+++ b/build/config/android/internal_rules.gni
@@ -24,6 +24,13 @@ if (is_debug) {
}
template("android_lint") {
+ set_sources_assignment_filter([])
+
+ jar_path = invoker.jar_path
+ android_manifest = invoker.android_manifest
+ java_files = invoker.java_files
+ base_path = "$target_gen_dir/$target_name"
+
action(target_name) {
deps = []
forward_variables_from(invoker,
@@ -33,65 +40,41 @@ template("android_lint") {
"public_deps",
"testonly",
])
- _cache_dir = "$root_build_dir/android_lint_cache"
- _result_path = "$target_gen_dir/$target_name/result.xml"
- _config_path = "$target_gen_dir/$target_name/config.xml"
- _suppressions_file = "//build/android/lint/suppressions.xml"
- _cache_file = "$_cache_dir/.android/cache/api-versions-6-${android_sdk_build_tools_version}.bin"
-
script = "//build/android/gyp/lint.py"
- depfile = "$target_gen_dir/$target_name.d"
+ result_path = base_path + "/result.xml"
+ config_path = base_path + "/config.xml"
+ suppressions_file = "//build/android/lint/suppressions.xml"
inputs = [
- "${android_sdk_root}/platform-tools/api/api-versions.xml",
- _suppressions_file,
- invoker.android_manifest,
- ]
+ suppressions_file,
+ android_manifest,
+ jar_path,
+ ] + java_files
outputs = [
- depfile,
- _config_path,
- _result_path,
+ config_path,
+ result_path,
]
+ deps += [ "//build/android:prepare_android_lint_cache" ]
+
+ rebased_java_files = rebase_path(java_files, root_build_dir)
+
args = [
"--lint-path=$rebased_android_sdk_root/tools/lint",
- "--cache-dir",
- rebase_path(_cache_dir, root_build_dir),
- "--build-tools-version",
- android_sdk_build_tools_version,
- "--depfile",
- rebase_path(depfile, root_build_dir),
"--config-path",
- rebase_path(_suppressions_file, root_build_dir),
+ rebase_path(suppressions_file, root_build_dir),
"--manifest-path",
- rebase_path(invoker.android_manifest, root_build_dir),
+ rebase_path(android_manifest, root_build_dir),
"--product-dir=.",
+ "--jar-path",
+ rebase_path(jar_path, root_build_dir),
"--processed-config-path",
- rebase_path(_config_path, root_build_dir),
+ rebase_path(config_path, root_build_dir),
"--result-path",
- rebase_path(_result_path, root_build_dir),
+ rebase_path(result_path, root_build_dir),
+ "--java-files=$rebased_java_files",
"--enable",
]
-
- if (defined(invoker.create_cache) && invoker.create_cache) {
- outputs += [ _cache_file ]
- args += [
- "--create-cache",
- "--silent",
- ]
- } else {
- inputs += [
- _cache_file,
- invoker.jar_path,
- ] + invoker.java_files
- deps += [ "//build/android:prepare_android_lint_cache" ]
- _rebased_java_files = rebase_path(invoker.java_files, root_build_dir)
- args += [
- "--jar-path",
- rebase_path(invoker.jar_path, root_build_dir),
- "--java-files=$_rebased_java_files",
- ]
- }
}
}