Chromium Code Reviews| 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 | 6 |
| 7 assert(is_android) | 7 assert(is_android) |
| 8 | 8 |
| 9 rebased_android_sdk = rebase_path(android_sdk, root_build_dir) | 9 rebased_android_sdk = rebase_path(android_sdk, root_build_dir) |
| 10 rebased_android_sdk_root = rebase_path(android_sdk_root, root_build_dir) | 10 rebased_android_sdk_root = rebase_path(android_sdk_root, root_build_dir) |
| 11 rebased_android_sdk_build_tools = | 11 rebased_android_sdk_build_tools = |
| 12 rebase_path(android_sdk_build_tools, root_build_dir) | 12 rebase_path(android_sdk_build_tools, root_build_dir) |
| 13 | 13 |
| 14 android_sdk_jar = "$android_sdk/android.jar" | 14 android_sdk_jar = "$android_sdk/android.jar" |
| 15 rebased_android_sdk_jar = rebase_path(android_sdk_jar, root_build_dir) | 15 rebased_android_sdk_jar = rebase_path(android_sdk_jar, root_build_dir) |
| 16 | 16 |
| 17 template("android_lint") { | 17 template("android_lint") { |
| 18 set_sources_assignment_filter([]) | 18 action(target_name) { |
| 19 if (defined(invoker.testonly)) { | 19 set_sources_assignment_filter([]) |
| 20 testonly = invoker.testonly | 20 if (defined(invoker.testonly)) { |
| 21 } | 21 testonly = invoker.testonly |
| 22 } | |
| 23 jar_path = invoker.jar_path | |
| 24 android_manifest = invoker.android_manifest | |
| 25 java_files = invoker.java_files | |
| 26 base_path = "$target_gen_dir/$target_name" | |
| 22 | 27 |
| 23 jar_path = invoker.jar_path | |
| 24 android_manifest = invoker.android_manifest | |
| 25 java_files = invoker.java_files | |
| 26 base_path = "$target_gen_dir/$target_name" | |
| 27 | |
| 28 action(target_name) { | |
| 29 script = "//build/android/gyp/lint.py" | 28 script = "//build/android/gyp/lint.py" |
| 30 result_path = base_path + "/result.xml" | 29 result_path = base_path + "/result.xml" |
| 31 config_path = base_path + "/config.xml" | 30 config_path = base_path + "/config.xml" |
| 32 suppressions_file = "//build/android/lint/suppressions.xml" | 31 suppressions_file = "//build/android/lint/suppressions.xml" |
| 33 inputs = [ | 32 inputs = [ |
| 34 suppressions_file, | 33 suppressions_file, |
| 35 android_manifest, | 34 android_manifest, |
| 36 jar_path, | 35 jar_path, |
| 37 ] + java_files | 36 ] + java_files |
| 38 | 37 |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 55 "--processed-config-path", | 54 "--processed-config-path", |
| 56 rebase_path(config_path, root_build_dir), | 55 rebase_path(config_path, root_build_dir), |
| 57 "--result-path", | 56 "--result-path", |
| 58 rebase_path(result_path, root_build_dir), | 57 rebase_path(result_path, root_build_dir), |
| 59 "--java-files=$rebased_java_files", | 58 "--java-files=$rebased_java_files", |
| 60 "--enable", | 59 "--enable", |
| 61 ] | 60 ] |
| 62 } | 61 } |
| 63 } | 62 } |
| 64 | 63 |
| 64 template("proguard") { | |
| 65 action(target_name) { | |
| 66 set_sources_assignment_filter([]) | |
| 67 if (defined(invoker.testonly)) { | |
| 68 testonly = invoker.testonly | |
| 69 } | |
| 70 script = "//build/android/gyp/proguard.py" | |
| 71 _proguard_jar_path = "$android_sdk_root/tools/proguard/lib/proguard.jar" | |
| 72 _output_jar_path = invoker.output_jar_path | |
| 73 | |
| 74 _output_jar_path = invoker.output_jar_path | |
|
newt (away)
2015/05/29 01:43:04
duplicate line
| |
| 75 inputs = [ | |
| 76 android_sdk_jar, | |
| 77 _proguard_jar_path, | |
| 78 ] | |
| 79 if (defined(invoker.inputs)) { | |
| 80 inputs += invoker.inputs | |
| 81 } | |
| 82 depfile = "${target_gen_dir}/${target_name}.d" | |
| 83 outputs = [ | |
| 84 depfile, | |
| 85 _output_jar_path, | |
| 86 "$_output_jar_path.dump", | |
| 87 "$_output_jar_path.seeds", | |
| 88 "$_output_jar_path.mapping", | |
| 89 "$_output_jar_path.usage", | |
| 90 ] | |
| 91 args = [ | |
| 92 "--depfile", | |
| 93 rebase_path(depfile, root_build_dir), | |
| 94 "--proguard-path", | |
| 95 rebase_path(_proguard_jar_path, root_build_dir), | |
| 96 "--output-path", | |
| 97 rebase_path(_output_jar_path, root_build_dir), | |
| 98 "--classpath", | |
| 99 rebased_android_sdk_jar, | |
| 100 ] | |
| 101 if (defined(invoker.args)) { | |
| 102 args += invoker.args | |
| 103 } | |
| 104 } | |
| 105 } | |
| 106 | |
| 65 template("findbugs") { | 107 template("findbugs") { |
| 66 jar_path = invoker.jar_path | 108 jar_path = invoker.jar_path |
| 67 | 109 |
| 68 build_config = invoker.build_config | 110 build_config = invoker.build_config |
| 69 | 111 |
| 70 action(target_name) { | 112 action(target_name) { |
| 71 script = "//build/android/findbugs_diff.py" | 113 script = "//build/android/findbugs_diff.py" |
| 72 depfile = "$target_gen_dir/$target_name.d" | 114 depfile = "$target_gen_dir/$target_name.d" |
| 73 result_path = "$target_gen_dir/$target_name/result.xml" | 115 result_path = "$target_gen_dir/$target_name/result.xml" |
| 74 exclusions_file = "//build/android/findbugs_filter/findbugs_exclude.xml" | 116 exclusions_file = "//build/android/findbugs_filter/findbugs_exclude.xml" |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 98 rebase_path(jar_path, root_build_dir), | 140 rebase_path(jar_path, root_build_dir), |
| 99 ] | 141 ] |
| 100 } | 142 } |
| 101 } | 143 } |
| 102 | 144 |
| 103 template("dex") { | 145 template("dex") { |
| 104 set_sources_assignment_filter([]) | 146 set_sources_assignment_filter([]) |
| 105 if (defined(invoker.testonly)) { | 147 if (defined(invoker.testonly)) { |
| 106 testonly = invoker.testonly | 148 testonly = invoker.testonly |
| 107 } | 149 } |
| 108 | |
| 109 assert(defined(invoker.output)) | |
| 110 action(target_name) { | 150 action(target_name) { |
| 151 assert(defined(invoker.output)) | |
| 111 script = "//build/android/gyp/dex.py" | 152 script = "//build/android/gyp/dex.py" |
| 112 depfile = "$target_gen_dir/$target_name.d" | 153 depfile = "$target_gen_dir/$target_name.d" |
| 113 if (defined(invoker.sources)) { | 154 if (defined(invoker.sources)) { |
| 114 sources = invoker.sources | 155 sources = invoker.sources |
| 115 } | 156 } |
| 116 outputs = [ | 157 outputs = [ |
| 117 depfile, | 158 depfile, |
| 118 invoker.output, | 159 invoker.output, |
| 119 ] | 160 ] |
| 120 if (defined(invoker.inputs)) { | 161 if (defined(invoker.inputs)) { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 189 # Write the target's .build_config file. This is a json file that contains a | 230 # Write the target's .build_config file. This is a json file that contains a |
| 190 # dictionary of information about how to build this target (things that | 231 # dictionary of information about how to build this target (things that |
| 191 # require knowledge about this target's dependencies and cannot be calculated | 232 # require knowledge about this target's dependencies and cannot be calculated |
| 192 # at gn-time). There is a special syntax to add a value in that dictionary to | 233 # at gn-time). There is a special syntax to add a value in that dictionary to |
| 193 # an action/action_foreachs args: | 234 # an action/action_foreachs args: |
| 194 # --python-arg=@FileArg($rebased_build_config_path:key0:key1) | 235 # --python-arg=@FileArg($rebased_build_config_path:key0:key1) |
| 195 # At runtime, such an arg will be replaced by the value in the build_config. | 236 # At runtime, such an arg will be replaced by the value in the build_config. |
| 196 # See build/android/gyp/write_build_config.py and | 237 # See build/android/gyp/write_build_config.py and |
| 197 # build/android/gyp/util/build_utils.py:ExpandFileArgs | 238 # build/android/gyp/util/build_utils.py:ExpandFileArgs |
| 198 template("write_build_config") { | 239 template("write_build_config") { |
| 199 set_sources_assignment_filter([]) | 240 action(target_name) { |
| 200 if (defined(invoker.testonly)) { | 241 set_sources_assignment_filter([]) |
| 201 testonly = invoker.testonly | 242 if (defined(invoker.testonly)) { |
| 202 } | 243 testonly = invoker.testonly |
| 244 } | |
| 203 | 245 |
| 204 assert(defined(invoker.type)) | 246 assert(defined(invoker.type)) |
| 205 assert(defined(invoker.build_config)) | 247 assert(defined(invoker.build_config)) |
| 206 | 248 |
| 207 type = invoker.type | 249 type = invoker.type |
| 208 build_config = invoker.build_config | 250 build_config = invoker.build_config |
| 209 | 251 |
| 210 assert(type == "android_apk" || type == "java_library" || | 252 assert(type == "android_apk" || type == "java_library" || |
| 211 type == "android_resources" || type == "deps_dex") | 253 type == "android_resources" || type == "deps_dex") |
| 212 | 254 |
| 213 action(target_name) { | |
| 214 script = "//build/android/gyp/write_build_config.py" | 255 script = "//build/android/gyp/write_build_config.py" |
| 215 depfile = "$target_gen_dir/$target_name.d" | 256 depfile = "$target_gen_dir/$target_name.d" |
| 216 inputs = [] | 257 inputs = [] |
| 217 | 258 |
| 218 deps = [] | 259 deps = [] |
| 219 if (defined(invoker.deps)) { | 260 if (defined(invoker.deps)) { |
| 220 deps += invoker.deps | 261 deps += invoker.deps |
| 221 } | 262 } |
| 222 | 263 |
| 223 possible_deps_configs = [] | 264 possible_deps_configs = [] |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 334 if (is_apk) { | 375 if (is_apk) { |
| 335 if (defined(invoker.native_libs)) { | 376 if (defined(invoker.native_libs)) { |
| 336 inputs += invoker.native_libs | 377 inputs += invoker.native_libs |
| 337 rebased_native_libs = rebase_path(invoker.native_libs, root_build_dir) | 378 rebased_native_libs = rebase_path(invoker.native_libs, root_build_dir) |
| 338 rebased_android_readelf = rebase_path(android_readelf, root_build_dir) | 379 rebased_android_readelf = rebase_path(android_readelf, root_build_dir) |
| 339 args += [ | 380 args += [ |
| 340 "--native-libs=$rebased_native_libs", | 381 "--native-libs=$rebased_native_libs", |
| 341 "--readelf-path=$rebased_android_readelf", | 382 "--readelf-path=$rebased_android_readelf", |
| 342 ] | 383 ] |
| 343 } | 384 } |
| 385 | |
| 386 if (defined(invoker.proguard_enabled) && invoker.proguard_enabled) { | |
| 387 args += [ | |
| 388 "--proguard-enabled", | |
| 389 "--proguard-info", | |
| 390 rebase_path(invoker.proguard_info, root_build_dir), | |
| 391 ] | |
| 392 } | |
| 344 } | 393 } |
| 345 | 394 |
| 346 if (defined(invoker.srcjar)) { | 395 if (defined(invoker.srcjar)) { |
| 347 args += [ | 396 args += [ |
| 348 "--srcjar", | 397 "--srcjar", |
| 349 rebase_path(invoker.srcjar, root_build_dir), | 398 rebase_path(invoker.srcjar, root_build_dir), |
| 350 ] | 399 ] |
| 351 } | 400 } |
| 352 } | 401 } |
| 353 } | 402 } |
| 354 | 403 |
| 355 template("process_java_prebuilt") { | 404 template("process_java_prebuilt") { |
| 356 set_sources_assignment_filter([]) | 405 set_sources_assignment_filter([]) |
| 357 if (defined(invoker.testonly)) { | 406 if (defined(invoker.testonly)) { |
| 358 testonly = invoker.testonly | 407 testonly = invoker.testonly |
| 359 } | 408 } |
| 360 | 409 |
| 361 _input_jar_path = invoker.input_jar_path | 410 _input_jar_path = invoker.input_jar_path |
| 362 _output_jar_path = invoker.output_jar_path | 411 _output_jar_path = invoker.output_jar_path |
| 363 _jar_toc_path = _output_jar_path + ".TOC" | 412 _jar_toc_path = _output_jar_path + ".TOC" |
| 364 | 413 |
| 365 assert(invoker.build_config != "") | 414 assert(invoker.build_config != "") |
| 366 | 415 |
| 367 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) { | 416 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) { |
| 368 _proguard_jar_path = "$android_sdk_root/tools/proguard/lib/proguard.jar" | |
| 369 _proguard_config_path = invoker.proguard_config | |
| 370 _build_config = invoker.build_config | 417 _build_config = invoker.build_config |
| 371 _rebased_build_config = rebase_path(_build_config, root_build_dir) | 418 _rebased_build_config = rebase_path(_build_config, root_build_dir) |
| 372 action("${target_name}__proguard_process") { | 419 _proguard_config_path = invoker.proguard_config |
| 373 script = "//build/android/gyp/proguard.py" | 420 proguard("${target_name}__proguard_process") { |
| 374 inputs = [ | 421 inputs = [ |
| 375 android_sdk_jar, | |
| 376 _proguard_jar_path, | |
| 377 _build_config, | 422 _build_config, |
| 378 _input_jar_path, | 423 _input_jar_path, |
| 379 _proguard_config_path, | 424 _proguard_config_path, |
| 380 ] | 425 ] |
| 381 depfile = "${target_gen_dir}/${target_name}.d" | 426 output_jar_path = _output_jar_path |
| 382 outputs = [ | 427 _rebased_input_paths = [ rebase_path(_input_jar_path, root_build_dir) ] |
| 383 depfile, | 428 _rebased_proguard_configs = |
| 384 _output_jar_path, | 429 [ rebase_path(_proguard_config_path, root_build_dir) ] |
| 385 ] | |
| 386 args = [ | 430 args = [ |
| 387 "--depfile", | 431 "--input-paths=$_rebased_input_paths", |
| 388 rebase_path(depfile, root_build_dir), | 432 "--proguard-configs=$_rebased_proguard_configs", |
| 389 "--proguard-path", | |
| 390 rebase_path(_proguard_jar_path, root_build_dir), | |
| 391 "--input-path", | |
| 392 rebase_path(_input_jar_path, root_build_dir), | |
| 393 "--output-path", | |
| 394 rebase_path(_output_jar_path, root_build_dir), | |
| 395 "--proguard-config", | |
| 396 rebase_path(_proguard_config_path, root_build_dir), | |
| 397 "--classpath", | |
| 398 rebased_android_sdk_jar, | |
| 399 "--classpath=@FileArg($_rebased_build_config:javac:classpath)", | 433 "--classpath=@FileArg($_rebased_build_config:javac:classpath)", |
| 400 ] | 434 ] |
| 401 } | 435 } |
| 402 } else { | 436 } else { |
| 403 copy("${target_name}__copy_jar") { | 437 copy("${target_name}__copy_jar") { |
| 404 sources = [ | 438 sources = [ |
| 405 _input_jar_path, | 439 _input_jar_path, |
| 406 ] | 440 ] |
| 407 outputs = [ | 441 outputs = [ |
| 408 _output_jar_path, | 442 _output_jar_path, |
| (...skipping 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1161 | 1195 |
| 1162 if (defined(invoker.all_resources_zip_path)) { | 1196 if (defined(invoker.all_resources_zip_path)) { |
| 1163 all_resources_zip = invoker.all_resources_zip_path | 1197 all_resources_zip = invoker.all_resources_zip_path |
| 1164 outputs += [ all_resources_zip ] | 1198 outputs += [ all_resources_zip ] |
| 1165 args += [ | 1199 args += [ |
| 1166 "--all-resources-zip-out", | 1200 "--all-resources-zip-out", |
| 1167 rebase_path(all_resources_zip, root_build_dir), | 1201 rebase_path(all_resources_zip, root_build_dir), |
| 1168 ] | 1202 ] |
| 1169 } | 1203 } |
| 1170 | 1204 |
| 1205 if (defined(invoker.proguard_file)) { | |
| 1206 outputs += [ invoker.proguard_file ] | |
| 1207 args += [ | |
| 1208 "--proguard-file", | |
| 1209 rebase_path(invoker.proguard_file, root_build_dir), | |
| 1210 ] | |
| 1211 } | |
| 1212 | |
| 1171 if (defined(invoker.args)) { | 1213 if (defined(invoker.args)) { |
| 1172 args += invoker.args | 1214 args += invoker.args |
| 1173 } | 1215 } |
| 1174 } | 1216 } |
| 1175 } | 1217 } |
| 1176 | 1218 |
| 1177 template("copy_ex") { | 1219 template("copy_ex") { |
| 1178 set_sources_assignment_filter([]) | 1220 set_sources_assignment_filter([]) |
| 1179 if (defined(invoker.testonly)) { | 1221 if (defined(invoker.testonly)) { |
| 1180 testonly = invoker.testonly | 1222 testonly = invoker.testonly |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1290 script = "//build/android/gyp/generate_split_manifest.py" | 1332 script = "//build/android/gyp/generate_split_manifest.py" |
| 1291 outputs = [ | 1333 outputs = [ |
| 1292 depfile, | 1334 depfile, |
| 1293 invoker.out_manifest, | 1335 invoker.out_manifest, |
| 1294 ] | 1336 ] |
| 1295 inputs = [ | 1337 inputs = [ |
| 1296 invoker.main_manifest, | 1338 invoker.main_manifest, |
| 1297 ] | 1339 ] |
| 1298 } | 1340 } |
| 1299 } | 1341 } |
| OLD | NEW |