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/zip.gni") | 6 import("//build/config/zip.gni") |
7 import("//third_party/ijar/ijar.gni") | 7 import("//third_party/ijar/ijar.gni") |
8 | 8 |
9 assert(is_android) | 9 assert(is_android) |
10 | 10 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 "--processed-config-path", | 67 "--processed-config-path", |
68 rebase_path(config_path, root_build_dir), | 68 rebase_path(config_path, root_build_dir), |
69 "--result-path", | 69 "--result-path", |
70 rebase_path(result_path, root_build_dir), | 70 rebase_path(result_path, root_build_dir), |
71 "--java-files=$rebased_java_files", | 71 "--java-files=$rebased_java_files", |
72 "--enable", | 72 "--enable", |
73 ] | 73 ] |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
| 77 template("proguard") { |
| 78 action(target_name) { |
| 79 set_sources_assignment_filter([]) |
| 80 forward_variables_from(invoker, |
| 81 [ |
| 82 "deps", |
| 83 "data_deps", |
| 84 "public_deps", |
| 85 "testonly", |
| 86 ]) |
| 87 script = "//build/android/gyp/proguard.py" |
| 88 _proguard_jar_path = "//third_party/proguard/lib/proguard.jar" |
| 89 _output_jar_path = invoker.output_jar_path |
| 90 inputs = [ |
| 91 android_sdk_jar, |
| 92 _proguard_jar_path, |
| 93 ] |
| 94 if (defined(invoker.inputs)) { |
| 95 inputs += invoker.inputs |
| 96 } |
| 97 depfile = "${target_gen_dir}/${target_name}.d" |
| 98 outputs = [ |
| 99 depfile, |
| 100 _output_jar_path, |
| 101 "$_output_jar_path.dump", |
| 102 "$_output_jar_path.seeds", |
| 103 "$_output_jar_path.mapping", |
| 104 "$_output_jar_path.usage", |
| 105 ] |
| 106 args = [ |
| 107 "--depfile", |
| 108 rebase_path(depfile, root_build_dir), |
| 109 "--proguard-path", |
| 110 rebase_path(_proguard_jar_path, root_build_dir), |
| 111 "--output-path", |
| 112 rebase_path(_output_jar_path, root_build_dir), |
| 113 "--classpath", |
| 114 rebased_android_sdk_jar, |
| 115 ] |
| 116 if (defined(invoker.args)) { |
| 117 args += invoker.args |
| 118 } |
| 119 } |
| 120 } |
| 121 |
77 template("findbugs") { | 122 template("findbugs") { |
78 jar_path = invoker.jar_path | 123 jar_path = invoker.jar_path |
79 | 124 |
80 build_config = invoker.build_config | 125 build_config = invoker.build_config |
81 | 126 |
82 action(target_name) { | 127 action(target_name) { |
83 forward_variables_from(invoker, | 128 forward_variables_from(invoker, |
84 [ | 129 [ |
85 "deps", | 130 "deps", |
86 "testonly", | 131 "testonly", |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 # Write the target's .build_config file. This is a json file that contains a | 271 # Write the target's .build_config file. This is a json file that contains a |
227 # dictionary of information about how to build this target (things that | 272 # dictionary of information about how to build this target (things that |
228 # require knowledge about this target's dependencies and cannot be calculated | 273 # require knowledge about this target's dependencies and cannot be calculated |
229 # at gn-time). There is a special syntax to add a value in that dictionary to | 274 # at gn-time). There is a special syntax to add a value in that dictionary to |
230 # an action/action_foreachs args: | 275 # an action/action_foreachs args: |
231 # --python-arg=@FileArg($rebased_build_config_path:key0:key1) | 276 # --python-arg=@FileArg($rebased_build_config_path:key0:key1) |
232 # At runtime, such an arg will be replaced by the value in the build_config. | 277 # At runtime, such an arg will be replaced by the value in the build_config. |
233 # See build/android/gyp/write_build_config.py and | 278 # See build/android/gyp/write_build_config.py and |
234 # build/android/gyp/util/build_utils.py:ExpandFileArgs | 279 # build/android/gyp/util/build_utils.py:ExpandFileArgs |
235 template("write_build_config") { | 280 template("write_build_config") { |
236 set_sources_assignment_filter([]) | 281 action(target_name) { |
| 282 set_sources_assignment_filter([]) |
| 283 type = invoker.type |
| 284 build_config = invoker.build_config |
237 | 285 |
238 assert(defined(invoker.type)) | 286 assert(type == "android_apk" || type == "java_library" || |
239 assert(defined(invoker.build_config)) | 287 type == "android_resources" || type == "deps_dex" || |
| 288 type == "android_assets" || type == "resource_rewriter") |
240 | 289 |
241 type = invoker.type | |
242 build_config = invoker.build_config | |
243 | |
244 assert(type == "android_apk" || type == "java_library" || | |
245 type == "android_resources" || type == "deps_dex" || | |
246 type == "android_assets" || type == "resource_rewriter") | |
247 | |
248 action(target_name) { | |
249 deps = [] | 290 deps = [] |
250 forward_variables_from(invoker, | 291 forward_variables_from(invoker, |
251 [ | 292 [ |
252 "deps", | 293 "deps", |
253 "testonly", | 294 "testonly", |
254 "visibility", | 295 "visibility", |
255 ]) | 296 ]) |
256 | 297 |
257 script = "//build/android/gyp/write_build_config.py" | 298 script = "//build/android/gyp/write_build_config.py" |
258 depfile = "$target_gen_dir/$target_name.d" | 299 depfile = "$target_gen_dir/$target_name.d" |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 if (is_apk) { | 437 if (is_apk) { |
397 if (defined(invoker.native_libs)) { | 438 if (defined(invoker.native_libs)) { |
398 inputs += invoker.native_libs | 439 inputs += invoker.native_libs |
399 rebased_native_libs = rebase_path(invoker.native_libs, root_build_dir) | 440 rebased_native_libs = rebase_path(invoker.native_libs, root_build_dir) |
400 rebased_android_readelf = rebase_path(android_readelf, root_build_dir) | 441 rebased_android_readelf = rebase_path(android_readelf, root_build_dir) |
401 args += [ | 442 args += [ |
402 "--native-libs=$rebased_native_libs", | 443 "--native-libs=$rebased_native_libs", |
403 "--readelf-path=$rebased_android_readelf", | 444 "--readelf-path=$rebased_android_readelf", |
404 ] | 445 ] |
405 } | 446 } |
| 447 |
| 448 if (defined(invoker.proguard_enabled) && invoker.proguard_enabled) { |
| 449 args += [ |
| 450 "--proguard-enabled", |
| 451 "--proguard-info", |
| 452 rebase_path(invoker.proguard_info, root_build_dir), |
| 453 ] |
| 454 } |
406 } | 455 } |
407 | 456 |
408 if (defined(invoker.srcjar)) { | 457 if (defined(invoker.srcjar)) { |
409 args += [ | 458 args += [ |
410 "--srcjar", | 459 "--srcjar", |
411 rebase_path(invoker.srcjar, root_build_dir), | 460 rebase_path(invoker.srcjar, root_build_dir), |
412 ] | 461 ] |
413 } | 462 } |
414 } | 463 } |
415 } | 464 } |
416 | 465 |
417 template("process_java_prebuilt") { | 466 template("process_java_prebuilt") { |
418 set_sources_assignment_filter([]) | 467 set_sources_assignment_filter([]) |
419 forward_variables_from(invoker, [ "testonly" ]) | 468 forward_variables_from(invoker, [ "testonly" ]) |
420 | 469 |
421 _input_jar_path = invoker.input_jar_path | 470 _input_jar_path = invoker.input_jar_path |
422 _output_jar_path = invoker.output_jar_path | 471 _output_jar_path = invoker.output_jar_path |
423 _output_ijar_path = get_path_info(_output_jar_path, "dir") + "/" + | 472 _output_ijar_path = get_path_info(_output_jar_path, "dir") + "/" + |
424 get_path_info(_output_jar_path, "name") + ".interface.jar" | 473 get_path_info(_output_jar_path, "name") + ".interface.jar" |
425 | 474 |
426 assert(invoker.build_config != "") | 475 assert(invoker.build_config != "") |
427 | 476 |
428 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) { | 477 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) { |
429 _proguard_jar_path = "//third_party/proguard/lib/proguard.jar" | |
430 _proguard_config_path = invoker.proguard_config | |
431 _build_config = invoker.build_config | 478 _build_config = invoker.build_config |
432 _rebased_build_config = rebase_path(_build_config, root_build_dir) | 479 _rebased_build_config = rebase_path(_build_config, root_build_dir) |
| 480 _proguard_config_path = invoker.proguard_config |
433 _output_jar_target = "${target_name}__proguard_process" | 481 _output_jar_target = "${target_name}__proguard_process" |
434 action(_output_jar_target) { | 482 proguard(_output_jar_target) { |
435 forward_variables_from(invoker, | 483 forward_variables_from(invoker, |
436 [ | 484 [ |
437 "data_deps", | 485 "data_deps", |
438 "deps", | 486 "deps", |
439 "public_deps", | 487 "public_deps", |
440 ]) | 488 ]) |
441 script = "//build/android/gyp/proguard.py" | |
442 inputs = [ | 489 inputs = [ |
443 android_sdk_jar, | |
444 _proguard_jar_path, | |
445 _build_config, | 490 _build_config, |
446 _input_jar_path, | 491 _input_jar_path, |
447 _proguard_config_path, | 492 _proguard_config_path, |
448 ] | 493 ] |
449 depfile = "${target_gen_dir}/${target_name}.d" | 494 output_jar_path = _output_jar_path |
450 outputs = [ | 495 _rebased_input_paths = [ rebase_path(_input_jar_path, root_build_dir) ] |
451 depfile, | 496 _rebased_proguard_configs = |
452 _output_jar_path, | 497 [ rebase_path(_proguard_config_path, root_build_dir) ] |
453 ] | |
454 args = [ | 498 args = [ |
455 "--depfile", | 499 "--input-paths=$_rebased_input_paths", |
456 rebase_path(depfile, root_build_dir), | 500 "--proguard-configs=$_rebased_proguard_configs", |
457 "--proguard-path", | |
458 rebase_path(_proguard_jar_path, root_build_dir), | |
459 "--input-path", | |
460 rebase_path(_input_jar_path, root_build_dir), | |
461 "--output-path", | |
462 rebase_path(_output_jar_path, root_build_dir), | |
463 "--proguard-config", | |
464 rebase_path(_proguard_config_path, root_build_dir), | |
465 "--classpath", | |
466 rebased_android_sdk_jar, | |
467 "--classpath=@FileArg($_rebased_build_config:javac:classpath)", | 501 "--classpath=@FileArg($_rebased_build_config:javac:classpath)", |
468 ] | 502 ] |
469 } | 503 } |
470 } else { | 504 } else { |
471 _output_jar_target = "${target_name}__copy_jar" | 505 _output_jar_target = "${target_name}__copy_jar" |
472 copy(_output_jar_target) { | 506 copy(_output_jar_target) { |
473 forward_variables_from(invoker, | 507 forward_variables_from(invoker, |
474 [ | 508 [ |
475 "data_deps", | 509 "data_deps", |
476 "deps", | 510 "deps", |
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1533 | 1567 |
1534 if (defined(invoker.all_resources_zip_path)) { | 1568 if (defined(invoker.all_resources_zip_path)) { |
1535 all_resources_zip = invoker.all_resources_zip_path | 1569 all_resources_zip = invoker.all_resources_zip_path |
1536 outputs += [ all_resources_zip ] | 1570 outputs += [ all_resources_zip ] |
1537 args += [ | 1571 args += [ |
1538 "--all-resources-zip-out", | 1572 "--all-resources-zip-out", |
1539 rebase_path(all_resources_zip, root_build_dir), | 1573 rebase_path(all_resources_zip, root_build_dir), |
1540 ] | 1574 ] |
1541 } | 1575 } |
1542 | 1576 |
| 1577 if (defined(invoker.proguard_file)) { |
| 1578 outputs += [ invoker.proguard_file ] |
| 1579 args += [ |
| 1580 "--proguard-file", |
| 1581 rebase_path(invoker.proguard_file, root_build_dir), |
| 1582 ] |
| 1583 } |
| 1584 |
1543 if (defined(invoker.args)) { | 1585 if (defined(invoker.args)) { |
1544 args += invoker.args | 1586 args += invoker.args |
1545 } | 1587 } |
1546 } | 1588 } |
1547 } | 1589 } |
1548 | 1590 |
1549 template("copy_ex") { | 1591 template("copy_ex") { |
1550 set_sources_assignment_filter([]) | 1592 set_sources_assignment_filter([]) |
1551 action(target_name) { | 1593 action(target_name) { |
1552 inputs = [] | 1594 inputs = [] |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1741 ] | 1783 ] |
1742 args = [ | 1784 args = [ |
1743 "--depfile", | 1785 "--depfile", |
1744 rebase_path(depfile, root_build_dir), | 1786 rebase_path(depfile, root_build_dir), |
1745 "--script-output-path", | 1787 "--script-output-path", |
1746 rebase_path(generated_script, root_build_dir), | 1788 rebase_path(generated_script, root_build_dir), |
1747 ] | 1789 ] |
1748 args += test_runner_args | 1790 args += test_runner_args |
1749 } | 1791 } |
1750 } | 1792 } |
OLD | NEW |