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) |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 rebase_path(invoker.srcjar, root_build_dir), | 582 rebase_path(invoker.srcjar, root_build_dir), |
583 ] | 583 ] |
584 } | 584 } |
585 } | 585 } |
586 } | 586 } |
587 | 587 |
588 template("process_java_prebuilt") { | 588 template("process_java_prebuilt") { |
589 set_sources_assignment_filter([]) | 589 set_sources_assignment_filter([]) |
590 forward_variables_from(invoker, [ "testonly" ]) | 590 forward_variables_from(invoker, [ "testonly" ]) |
591 | 591 |
| 592 assert(invoker.build_config != "") |
| 593 _build_config = invoker.build_config |
| 594 _rebased_build_config = rebase_path(_build_config, root_build_dir) |
| 595 assert(_rebased_build_config != "" || true) # Mark used. |
| 596 |
| 597 _proguard_preprocess = |
| 598 defined(invoker.proguard_preprocess) && invoker.proguard_preprocess |
592 _input_jar_path = invoker.input_jar_path | 599 _input_jar_path = invoker.input_jar_path |
593 _output_jar_path = invoker.output_jar_path | 600 _output_jar_path = invoker.output_jar_path |
594 | 601 |
595 assert(invoker.build_config != "") | 602 _jar_excluded_patterns = [] |
| 603 if (defined(invoker.jar_excluded_patterns)) { |
| 604 _jar_excluded_patterns = invoker.jar_excluded_patterns |
| 605 } |
596 | 606 |
597 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) { | 607 _strip_resource_classes = |
598 _build_config = invoker.build_config | 608 defined(invoker.strip_resource_classes) && invoker.strip_resource_classes |
599 _rebased_build_config = rebase_path(_build_config, root_build_dir) | 609 |
| 610 if (_jar_excluded_patterns != [] || _strip_resource_classes) { |
| 611 _filter_class_files_input_file = _input_jar_path |
| 612 if (_proguard_preprocess) { |
| 613 _filter_class_files_input_file = |
| 614 "$target_out_dir/$target_name-proguarded.jar" |
| 615 } |
| 616 } |
| 617 |
| 618 if (_proguard_preprocess) { |
600 _proguard_config_path = invoker.proguard_config | 619 _proguard_config_path = invoker.proguard_config |
601 _output_jar_target = "${target_name}__proguard_process" | 620 _proguard_target = "${target_name}__proguard_process" |
602 proguard(_output_jar_target) { | 621 proguard(_proguard_target) { |
603 forward_variables_from(invoker, | 622 forward_variables_from(invoker, |
604 [ | 623 [ |
605 "data_deps", | |
606 "deps", | 624 "deps", |
607 "public_deps", | 625 "public_deps", |
608 ]) | 626 ]) |
609 inputs = [ | 627 inputs = [ |
610 _build_config, | 628 _build_config, |
611 _input_jar_path, | 629 _input_jar_path, |
612 _proguard_config_path, | 630 _proguard_config_path, |
613 ] | 631 ] |
614 output_jar_path = _output_jar_path | 632 output_jar_path = _output_jar_path |
| 633 if (defined(_filter_class_files_input_file)) { |
| 634 output_jar_path = _filter_class_files_input_file |
| 635 } |
| 636 |
615 _rebased_input_paths = [ rebase_path(_input_jar_path, root_build_dir) ] | 637 _rebased_input_paths = [ rebase_path(_input_jar_path, root_build_dir) ] |
616 _rebased_proguard_configs = | 638 _rebased_proguard_configs = |
617 [ rebase_path(_proguard_config_path, root_build_dir) ] | 639 [ rebase_path(_proguard_config_path, root_build_dir) ] |
618 args = [ | 640 args = [ |
619 "--input-paths=$_rebased_input_paths", | 641 "--input-paths=$_rebased_input_paths", |
620 "--proguard-configs=$_rebased_proguard_configs", | 642 "--proguard-configs=$_rebased_proguard_configs", |
621 "--classpath=@FileArg($_rebased_build_config:javac:classpath)", | 643 "--classpath=@FileArg($_rebased_build_config:javac:classpath)", |
622 ] | 644 ] |
623 } | 645 } |
624 } else { | 646 } else if (_jar_excluded_patterns == [] && !_strip_resource_classes) { |
625 _output_jar_target = "${target_name}__copy_jar" | 647 _output_jar_target = "${target_name}__copy_jar" |
626 copy(_output_jar_target) { | 648 copy(_output_jar_target) { |
627 forward_variables_from(invoker, | 649 forward_variables_from(invoker, |
628 [ | 650 [ |
629 "data_deps", | |
630 "deps", | 651 "deps", |
631 "public_deps", | 652 "public_deps", |
632 ]) | 653 ]) |
633 sources = [ | 654 sources = [ |
634 _input_jar_path, | 655 _input_jar_path, |
635 ] | 656 ] |
636 outputs = [ | 657 outputs = [ |
637 _output_jar_path, | 658 _output_jar_path, |
638 ] | 659 ] |
639 } | 660 } |
640 } | 661 } |
641 | 662 |
| 663 if (_jar_excluded_patterns != [] || _strip_resource_classes) { |
| 664 _output_jar_target = "${target_name}__filter" |
| 665 action(_output_jar_target) { |
| 666 script = "//build/android/gyp/jar.py" |
| 667 if (_proguard_preprocess) { |
| 668 deps = [ |
| 669 ":$_proguard_target", |
| 670 ] |
| 671 } else { |
| 672 forward_variables_from(invoker, |
| 673 [ |
| 674 "deps", |
| 675 "public_deps", |
| 676 ]) |
| 677 } |
| 678 inputs = [ |
| 679 _filter_class_files_input_file, |
| 680 ] |
| 681 outputs = [ |
| 682 _output_jar_path, |
| 683 ] |
| 684 args = [ |
| 685 "--input-jar", |
| 686 rebase_path(_filter_class_files_input_file, root_build_dir), |
| 687 "--jar-path", |
| 688 rebase_path(_output_jar_path, root_build_dir), |
| 689 "--excluded-classes=$_jar_excluded_patterns", |
| 690 ] |
| 691 if (_strip_resource_classes) { |
| 692 args += [ "--strip-resource-classes-for=@FileArg($_rebased_build_config:
javac:resource_packages)" ] |
| 693 } |
| 694 } |
| 695 } else if (_proguard_preprocess) { |
| 696 _output_jar_target = _proguard_target |
| 697 } |
| 698 |
642 group(target_name) { | 699 group(target_name) { |
643 forward_variables_from(invoker, [ "visibility" ]) | 700 forward_variables_from(invoker, |
| 701 [ |
| 702 "data_deps", |
| 703 "visibility", |
| 704 ]) |
644 public_deps = [ | 705 public_deps = [ |
645 ":$_output_jar_target", | 706 ":$_output_jar_target", |
646 ] | 707 ] |
647 } | 708 } |
648 } | 709 } |
649 | 710 |
650 template("emma_instr") { | 711 template("emma_instr") { |
651 set_sources_assignment_filter([]) | 712 set_sources_assignment_filter([]) |
652 forward_variables_from(invoker, [ "testonly" ]) | 713 forward_variables_from(invoker, [ "testonly" ]) |
653 | 714 |
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1301 | 1362 |
1302 deps = _deps | 1363 deps = _deps |
1303 build_config = _build_config | 1364 build_config = _build_config |
1304 jar_path = _jar_path | 1365 jar_path = _jar_path |
1305 if (_supports_android) { | 1366 if (_supports_android) { |
1306 dex_path = _dex_path | 1367 dex_path = _dex_path |
1307 } | 1368 } |
1308 } | 1369 } |
1309 | 1370 |
1310 process_java_prebuilt(_process_jar_target_name) { | 1371 process_java_prebuilt(_process_jar_target_name) { |
| 1372 forward_variables_from(invoker, |
| 1373 [ |
| 1374 "jar_excluded_patterns", |
| 1375 "strip_resource_classes", |
| 1376 ]) |
1311 visibility = [ | 1377 visibility = [ |
1312 ":$_ijar_target_name", | 1378 ":$_ijar_target_name", |
1313 ":$_template_name", | 1379 ":$_template_name", |
1314 ] | 1380 ] |
1315 if (_supports_android) { | 1381 if (_supports_android) { |
1316 visibility += [ ":$_dex_target_name" ] | 1382 visibility += [ ":$_dex_target_name" ] |
1317 } | 1383 } |
1318 | 1384 |
1319 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) { | 1385 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) { |
1320 proguard_preprocess = true | 1386 proguard_preprocess = true |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1412 _java_files = invoker.java_files | 1478 _java_files = invoker.java_files |
1413 _final_jar_path = invoker.jar_path | 1479 _final_jar_path = invoker.jar_path |
1414 _javac_jar_path = "$target_gen_dir/$target_name.javac.jar" | 1480 _javac_jar_path = "$target_gen_dir/$target_name.javac.jar" |
1415 _process_prebuilt_jar_path = | 1481 _process_prebuilt_jar_path = |
1416 "$target_gen_dir/$target_name.process_prebuilt.jar" | 1482 "$target_gen_dir/$target_name.process_prebuilt.jar" |
1417 _final_ijar_path = get_path_info(_final_jar_path, "dir") + "/" + | 1483 _final_ijar_path = get_path_info(_final_jar_path, "dir") + "/" + |
1418 get_path_info(_final_jar_path, "name") + ".interface.jar" | 1484 get_path_info(_final_jar_path, "name") + ".interface.jar" |
1419 | 1485 |
1420 _build_config = invoker.build_config | 1486 _build_config = invoker.build_config |
1421 | 1487 |
1422 _jar_excluded_patterns = [] | |
1423 if (defined(invoker.jar_excluded_patterns)) { | |
1424 _jar_excluded_patterns += invoker.jar_excluded_patterns | |
1425 } | |
1426 | |
1427 _chromium_code = false | 1488 _chromium_code = false |
1428 if (defined(invoker.chromium_code)) { | 1489 if (defined(invoker.chromium_code)) { |
1429 _chromium_code = invoker.chromium_code | 1490 _chromium_code = invoker.chromium_code |
1430 } | 1491 } |
1431 | 1492 |
1432 _supports_android = true | 1493 _supports_android = true |
1433 if (defined(invoker.supports_android)) { | 1494 if (defined(invoker.supports_android)) { |
1434 _supports_android = invoker.supports_android | 1495 _supports_android = invoker.supports_android |
1435 } | 1496 } |
1436 | 1497 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1500 ] | 1561 ] |
1501 | 1562 |
1502 _rebased_java_srcjars = rebase_path(_java_srcjars, root_build_dir) | 1563 _rebased_java_srcjars = rebase_path(_java_srcjars, root_build_dir) |
1503 _rebased_depfile = rebase_path(depfile, root_build_dir) | 1564 _rebased_depfile = rebase_path(depfile, root_build_dir) |
1504 args = [ | 1565 args = [ |
1505 "--depfile=$_rebased_depfile", | 1566 "--depfile=$_rebased_depfile", |
1506 "--classpath=@FileArg($_rebased_build_config:javac:interface_classpath)", | 1567 "--classpath=@FileArg($_rebased_build_config:javac:interface_classpath)", |
1507 "--jar-path=$_rebased_jar_path", | 1568 "--jar-path=$_rebased_jar_path", |
1508 "--java-srcjars=$_rebased_java_srcjars", | 1569 "--java-srcjars=$_rebased_java_srcjars", |
1509 "--java-srcjars=@FileArg($_rebased_build_config:javac:srcjars)", | 1570 "--java-srcjars=@FileArg($_rebased_build_config:javac:srcjars)", |
1510 "--jar-excluded-classes=$_jar_excluded_patterns", | |
1511 ] | 1571 ] |
1512 if (_enable_incremental_javac) { | 1572 if (_enable_incremental_javac) { |
1513 args += [ "--incremental" ] | 1573 args += [ "--incremental" ] |
1514 deps += [ "//third_party/jmake" ] | 1574 deps += [ "//third_party/jmake" ] |
1515 inputs += [ "$root_out_dir/bin/jmake" ] | 1575 inputs += [ "$root_out_dir/bin/jmake" ] |
1516 outputs += [ "${_javac_jar_path}.pdb" ] | 1576 outputs += [ "${_javac_jar_path}.pdb" ] |
1517 } | 1577 } |
1518 if (_supports_android) { | 1578 if (_supports_android) { |
1519 if (defined(invoker.alternative_android_sdk_ijar)) { | 1579 if (defined(invoker.alternative_android_sdk_ijar)) { |
1520 deps += [ invoker.alternative_android_sdk_ijar_dep ] | 1580 deps += [ invoker.alternative_android_sdk_ijar_dep ] |
(...skipping 16 matching lines...) Expand all Loading... |
1537 deps += [ "//third_party/errorprone:chromium_errorprone" ] | 1597 deps += [ "//third_party/errorprone:chromium_errorprone" ] |
1538 args += [ | 1598 args += [ |
1539 "--use-errorprone-path", | 1599 "--use-errorprone-path", |
1540 "bin/chromium_errorprone", | 1600 "bin/chromium_errorprone", |
1541 ] | 1601 ] |
1542 } | 1602 } |
1543 args += rebase_path(_java_files, root_build_dir) | 1603 args += rebase_path(_java_files, root_build_dir) |
1544 } | 1604 } |
1545 | 1605 |
1546 process_java_prebuilt(_process_prebuilt_target_name) { | 1606 process_java_prebuilt(_process_prebuilt_target_name) { |
| 1607 forward_variables_from(invoker, [ "jar_excluded_patterns" ]) |
1547 build_config = _build_config | 1608 build_config = _build_config |
1548 input_jar_path = _javac_jar_path | 1609 input_jar_path = _javac_jar_path |
1549 output_jar_path = _process_prebuilt_jar_path | 1610 output_jar_path = _process_prebuilt_jar_path |
1550 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) { | 1611 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) { |
1551 proguard_preprocess = invoker.proguard_preprocess | 1612 proguard_preprocess = invoker.proguard_preprocess |
1552 proguard_config = invoker.proguard_config | 1613 proguard_config = invoker.proguard_config |
1553 } | 1614 } |
1554 deps = [ | 1615 deps = [ |
1555 ":$_javac_target_name", | 1616 ":$_javac_target_name", |
1556 ] | 1617 ] |
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2251 | 2312 |
2252 args = [ | 2313 args = [ |
2253 "--depfile", | 2314 "--depfile", |
2254 rebase_path(depfile, root_build_dir), | 2315 rebase_path(depfile, root_build_dir), |
2255 "--script-output-path", | 2316 "--script-output-path", |
2256 rebase_path(generated_script, root_build_dir), | 2317 rebase_path(generated_script, root_build_dir), |
2257 ] | 2318 ] |
2258 args += test_runner_args | 2319 args += test_runner_args |
2259 } | 2320 } |
2260 } | 2321 } |
OLD | NEW |