OLD | NEW |
---|---|
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import("//build/config/android/config.gni") | 5 import("//build/config/android/config.gni") |
6 import("//build/config/sanitizers/sanitizers.gni") | 6 import("//build/config/sanitizers/sanitizers.gni") |
7 import("//build/config/zip.gni") | 7 import("//build/config/zip.gni") |
8 import("//third_party/ijar/ijar.gni") | 8 import("//third_party/ijar/ijar.gni") |
9 | 9 |
10 assert(is_android) | 10 assert(is_android) |
11 | 11 |
12 rebased_android_sdk = rebase_path(android_sdk, root_build_dir) | 12 rebased_android_sdk = rebase_path(android_sdk, root_build_dir) |
13 rebased_android_sdk_root = rebase_path(android_sdk_root, root_build_dir) | 13 rebased_android_sdk_root = rebase_path(android_sdk_root, root_build_dir) |
14 rebased_android_sdk_build_tools = | 14 rebased_android_sdk_build_tools = |
15 rebase_path(android_sdk_build_tools, root_build_dir) | 15 rebase_path(android_sdk_build_tools, root_build_dir) |
16 | 16 |
17 android_sdk_jar = "$android_sdk/android.jar" | 17 android_sdk_jar = "$android_sdk/android.jar" |
18 rebased_android_sdk_jar = rebase_path(android_sdk_jar, root_build_dir) | 18 rebased_android_sdk_jar = rebase_path(android_sdk_jar, root_build_dir) |
19 android_default_aapt_path = "$rebased_android_sdk_build_tools/aapt" | 19 android_default_aapt_path = "$rebased_android_sdk_build_tools/aapt" |
20 | 20 |
21 android_configuration_name = "Release" | 21 android_configuration_name = "Release" |
22 if (is_debug) { | 22 if (is_debug) { |
23 android_configuration_name = "Debug" | 23 android_configuration_name = "Debug" |
24 } | 24 } |
25 | 25 |
26 template("android_lint") { | 26 template("android_lint") { |
27 set_sources_assignment_filter([]) | |
28 | |
29 jar_path = invoker.jar_path | |
30 android_manifest = invoker.android_manifest | |
31 java_files = invoker.java_files | |
32 base_path = "$target_gen_dir/$target_name" | |
33 | |
34 action(target_name) { | 27 action(target_name) { |
35 deps = [] | 28 deps = [] |
36 forward_variables_from(invoker, | 29 forward_variables_from(invoker, |
37 [ | 30 [ |
38 "deps", | 31 "deps", |
39 "data_deps", | 32 "data_deps", |
40 "public_deps", | 33 "public_deps", |
41 "testonly", | 34 "testonly", |
42 ]) | 35 ]) |
36 _cache_dir = "$root_build_dir/android_lint_cache" | |
37 _result_path = "$target_gen_dir/$target_name/result.xml" | |
38 _config_path = "$target_gen_dir/$target_name/config.xml" | |
39 _suppressions_file = "//build/android/lint/suppressions.xml" | |
40 _cache_file = "$_cache_dir/.android/cache/api-versions-6-${android_sdk_build _tools_version}.bin" | |
41 _create_cache = defined(invoker.create_cache) && invoker.create_cache | |
42 | |
43 script = "//build/android/gyp/lint.py" | 43 script = "//build/android/gyp/lint.py" |
44 result_path = base_path + "/result.xml" | 44 depfile = "$target_gen_dir/$target_name.d" |
45 config_path = base_path + "/config.xml" | |
46 suppressions_file = "//build/android/lint/suppressions.xml" | |
47 inputs = [ | 45 inputs = [ |
48 suppressions_file, | 46 "${android_sdk_root}/platform-tools/api/api-versions.xml", |
49 android_manifest, | 47 _suppressions_file, |
50 jar_path, | 48 invoker.android_manifest, |
51 ] + java_files | 49 ] |
52 | 50 |
53 outputs = [ | 51 outputs = [ |
54 config_path, | 52 depfile, |
55 result_path, | 53 _config_path, |
54 _result_path, | |
56 ] | 55 ] |
57 | 56 |
58 deps += [ "//build/android:prepare_android_lint_cache" ] | 57 if (_create_cache) { |
59 | 58 outputs += [ _cache_file ] |
60 rebased_java_files = rebase_path(java_files, root_build_dir) | 59 } else { |
60 inputs += [ | |
61 _cache_file, | |
62 invoker.jar_path, | |
63 ] + invoker.java_files | |
64 deps += [ "//build/android:prepare_android_lint_cache" ] | |
65 } | |
61 | 66 |
62 args = [ | 67 args = [ |
63 "--lint-path=$rebased_android_sdk_root/tools/lint", | 68 "--lint-path=$rebased_android_sdk_root/tools/lint", |
69 "--cache-dir", | |
70 rebase_path(_cache_dir, root_build_dir), | |
71 "--build-tools-version", | |
72 android_sdk_build_tools_version, | |
73 "--depfile", | |
jbudorick
2016/03/22 19:27:22
I had issues with the depfile here previously caus
agrieve
2016/03/22 19:57:18
I haven't noticed that it does. I verified the dep
jbudorick
2016/03/22 20:36:25
Hm, maybe I had it misconfigured, then.
| |
74 rebase_path(depfile, root_build_dir), | |
64 "--config-path", | 75 "--config-path", |
65 rebase_path(suppressions_file, root_build_dir), | 76 rebase_path(_suppressions_file, root_build_dir), |
66 "--manifest-path", | 77 "--manifest-path", |
67 rebase_path(android_manifest, root_build_dir), | 78 rebase_path(invoker.android_manifest, root_build_dir), |
68 "--product-dir=.", | 79 "--product-dir=.", |
69 "--jar-path", | |
70 rebase_path(jar_path, root_build_dir), | |
71 "--processed-config-path", | 80 "--processed-config-path", |
72 rebase_path(config_path, root_build_dir), | 81 rebase_path(_config_path, root_build_dir), |
73 "--result-path", | 82 "--result-path", |
74 rebase_path(result_path, root_build_dir), | 83 rebase_path(_result_path, root_build_dir), |
75 "--java-files=$rebased_java_files", | |
76 "--enable", | 84 "--enable", |
77 ] | 85 ] |
86 if (_create_cache) { | |
jbudorick
2016/03/22 19:27:22
nit: What about merging the two if (_create_cache)
agrieve
2016/03/22 19:57:18
Done.
| |
87 args += [ | |
88 "--create-cache", | |
89 "--silent", | |
90 ] | |
91 } else { | |
92 _rebased_java_files = rebase_path(invoker.java_files, root_build_dir) | |
93 args += [ | |
94 "--jar-path", | |
95 rebase_path(invoker.jar_path, root_build_dir), | |
96 "--java-files=$_rebased_java_files", | |
97 ] | |
98 } | |
78 } | 99 } |
79 } | 100 } |
80 | 101 |
81 template("proguard") { | 102 template("proguard") { |
82 action(target_name) { | 103 action(target_name) { |
83 set_sources_assignment_filter([]) | 104 set_sources_assignment_filter([]) |
84 forward_variables_from(invoker, | 105 forward_variables_from(invoker, |
85 [ | 106 [ |
86 "deps", | 107 "deps", |
87 "data_deps", | 108 "data_deps", |
(...skipping 2082 matching lines...) Loading... | |
2170 ] | 2191 ] |
2171 args = [ | 2192 args = [ |
2172 "--depfile", | 2193 "--depfile", |
2173 rebase_path(depfile, root_build_dir), | 2194 rebase_path(depfile, root_build_dir), |
2174 "--script-output-path", | 2195 "--script-output-path", |
2175 rebase_path(generated_script, root_build_dir), | 2196 rebase_path(generated_script, root_build_dir), |
2176 ] | 2197 ] |
2177 args += test_runner_args | 2198 args += test_runner_args |
2178 } | 2199 } |
2179 } | 2200 } |
OLD | NEW |