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 |
43 script = "//build/android/gyp/lint.py" | 42 script = "//build/android/gyp/lint.py" |
44 result_path = base_path + "/result.xml" | 43 depfile = "$target_gen_dir/$target_name.d" |
45 config_path = base_path + "/config.xml" | |
46 suppressions_file = "//build/android/lint/suppressions.xml" | |
47 inputs = [ | 44 inputs = [ |
48 suppressions_file, | 45 "${android_sdk_root}/platform-tools/api/api-versions.xml", |
49 android_manifest, | 46 _suppressions_file, |
50 jar_path, | 47 invoker.android_manifest, |
51 ] + java_files | 48 ] |
52 | 49 |
53 outputs = [ | 50 outputs = [ |
54 config_path, | 51 depfile, |
55 result_path, | 52 _config_path, |
| 53 _result_path, |
56 ] | 54 ] |
57 | 55 |
58 deps += [ "//build/android:prepare_android_lint_cache" ] | |
59 | |
60 rebased_java_files = rebase_path(java_files, root_build_dir) | |
61 | |
62 args = [ | 56 args = [ |
63 "--lint-path=$rebased_android_sdk_root/tools/lint", | 57 "--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(android_manifest, root_build_dir), | 67 rebase_path(invoker.android_manifest, root_build_dir), |
68 "--product-dir=.", | 68 "--product-dir=.", |
69 "--jar-path", | |
70 rebase_path(jar_path, root_build_dir), | |
71 "--processed-config-path", | 69 "--processed-config-path", |
72 rebase_path(config_path, root_build_dir), | 70 rebase_path(_config_path, root_build_dir), |
73 "--result-path", | 71 "--result-path", |
74 rebase_path(result_path, root_build_dir), | 72 rebase_path(_result_path, root_build_dir), |
75 "--java-files=$rebased_java_files", | |
76 "--enable", | 73 "--enable", |
77 ] | 74 ] |
| 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 } |
78 } | 95 } |
79 } | 96 } |
80 | 97 |
81 template("proguard") { | 98 template("proguard") { |
82 action(target_name) { | 99 action(target_name) { |
83 set_sources_assignment_filter([]) | 100 set_sources_assignment_filter([]) |
84 forward_variables_from(invoker, | 101 forward_variables_from(invoker, |
85 [ | 102 [ |
86 "deps", | 103 "deps", |
87 "data_deps", | 104 "data_deps", |
(...skipping 2082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2170 ] | 2187 ] |
2171 args = [ | 2188 args = [ |
2172 "--depfile", | 2189 "--depfile", |
2173 rebase_path(depfile, root_build_dir), | 2190 rebase_path(depfile, root_build_dir), |
2174 "--script-output-path", | 2191 "--script-output-path", |
2175 rebase_path(generated_script, root_build_dir), | 2192 rebase_path(generated_script, root_build_dir), |
2176 ] | 2193 ] |
2177 args += test_runner_args | 2194 args += test_runner_args |
2178 } | 2195 } |
2179 } | 2196 } |
OLD | NEW |