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 |
27 action(target_name) { | 34 action(target_name) { |
28 deps = [] | 35 deps = [] |
29 forward_variables_from(invoker, | 36 forward_variables_from(invoker, |
30 [ | 37 [ |
31 "deps", | 38 "deps", |
32 "data_deps", | 39 "data_deps", |
33 "public_deps", | 40 "public_deps", |
34 "testonly", | 41 "testonly", |
35 ]) | 42 ]) |
36 _cache_dir = "$root_build_dir/android_lint_cache" | 43 script = "//build/android/gyp/lint.py" |
37 _result_path = "$target_gen_dir/$target_name/result.xml" | 44 result_path = base_path + "/result.xml" |
38 _config_path = "$target_gen_dir/$target_name/config.xml" | 45 config_path = base_path + "/config.xml" |
39 _suppressions_file = "//build/android/lint/suppressions.xml" | 46 suppressions_file = "//build/android/lint/suppressions.xml" |
40 _cache_file = "$_cache_dir/.android/cache/api-versions-6-${android_sdk_build
_tools_version}.bin" | 47 inputs = [ |
| 48 suppressions_file, |
| 49 android_manifest, |
| 50 jar_path, |
| 51 ] + java_files |
41 | 52 |
42 script = "//build/android/gyp/lint.py" | 53 outputs = [ |
43 depfile = "$target_gen_dir/$target_name.d" | 54 config_path, |
44 inputs = [ | 55 result_path, |
45 "${android_sdk_root}/platform-tools/api/api-versions.xml", | |
46 _suppressions_file, | |
47 invoker.android_manifest, | |
48 ] | 56 ] |
49 | 57 |
50 outputs = [ | 58 deps += [ "//build/android:prepare_android_lint_cache" ] |
51 depfile, | 59 |
52 _config_path, | 60 rebased_java_files = rebase_path(java_files, root_build_dir) |
53 _result_path, | |
54 ] | |
55 | 61 |
56 args = [ | 62 args = [ |
57 "--lint-path=$rebased_android_sdk_root/tools/lint", | 63 "--lint-path=$rebased_android_sdk_root/tools/lint", |
58 "--cache-dir", | |
59 rebase_path(_cache_dir, root_build_dir), | |
60 "--build-tools-version", | |
61 android_sdk_build_tools_version, | |
62 "--depfile", | |
63 rebase_path(depfile, root_build_dir), | |
64 "--config-path", | 64 "--config-path", |
65 rebase_path(_suppressions_file, root_build_dir), | 65 rebase_path(suppressions_file, root_build_dir), |
66 "--manifest-path", | 66 "--manifest-path", |
67 rebase_path(invoker.android_manifest, root_build_dir), | 67 rebase_path(android_manifest, root_build_dir), |
68 "--product-dir=.", | 68 "--product-dir=.", |
| 69 "--jar-path", |
| 70 rebase_path(jar_path, root_build_dir), |
69 "--processed-config-path", | 71 "--processed-config-path", |
70 rebase_path(_config_path, root_build_dir), | 72 rebase_path(config_path, root_build_dir), |
71 "--result-path", | 73 "--result-path", |
72 rebase_path(_result_path, root_build_dir), | 74 rebase_path(result_path, root_build_dir), |
| 75 "--java-files=$rebased_java_files", |
73 "--enable", | 76 "--enable", |
74 ] | 77 ] |
75 | |
76 if (defined(invoker.create_cache) && invoker.create_cache) { | |
77 outputs += [ _cache_file ] | |
78 args += [ | |
79 "--create-cache", | |
80 "--silent", | |
81 ] | |
82 } else { | |
83 inputs += [ | |
84 _cache_file, | |
85 invoker.jar_path, | |
86 ] + invoker.java_files | |
87 deps += [ "//build/android:prepare_android_lint_cache" ] | |
88 _rebased_java_files = rebase_path(invoker.java_files, root_build_dir) | |
89 args += [ | |
90 "--jar-path", | |
91 rebase_path(invoker.jar_path, root_build_dir), | |
92 "--java-files=$_rebased_java_files", | |
93 ] | |
94 } | |
95 } | 78 } |
96 } | 79 } |
97 | 80 |
98 template("proguard") { | 81 template("proguard") { |
99 action(target_name) { | 82 action(target_name) { |
100 set_sources_assignment_filter([]) | 83 set_sources_assignment_filter([]) |
101 forward_variables_from(invoker, | 84 forward_variables_from(invoker, |
102 [ | 85 [ |
103 "deps", | 86 "deps", |
104 "data_deps", | 87 "data_deps", |
(...skipping 2082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2187 ] | 2170 ] |
2188 args = [ | 2171 args = [ |
2189 "--depfile", | 2172 "--depfile", |
2190 rebase_path(depfile, root_build_dir), | 2173 rebase_path(depfile, root_build_dir), |
2191 "--script-output-path", | 2174 "--script-output-path", |
2192 rebase_path(generated_script, root_build_dir), | 2175 rebase_path(generated_script, root_build_dir), |
2193 ] | 2176 ] |
2194 args += test_runner_args | 2177 args += test_runner_args |
2195 } | 2178 } |
2196 } | 2179 } |
OLD | NEW |