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("//base/android/linker/config.gni") | 5 import("//base/android/linker/config.gni") |
6 import("//build/config/android/config.gni") | 6 import("//build/config/android/config.gni") |
7 import("//build/config/android/internal_rules.gni") | 7 import("//build/config/android/internal_rules.gni") |
8 import("//build/toolchain/toolchain.gni") | 8 import("//build/toolchain/toolchain.gni") |
9 import("//third_party/android_platform/config.gni") | 9 import("//third_party/android_platform/config.gni") |
10 import("//tools/grit/grit_rule.gni") | 10 import("//tools/grit/grit_rule.gni") |
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 } | 673 } |
674 | 674 |
675 group(final_target_name) { | 675 group(final_target_name) { |
676 forward_variables_from(invoker, [ "visibility" ]) | 676 forward_variables_from(invoker, [ "visibility" ]) |
677 public_deps = [ | 677 public_deps = [ |
678 ":${target_name}__process_resources", | 678 ":${target_name}__process_resources", |
679 ] | 679 ] |
680 } | 680 } |
681 } | 681 } |
682 | 682 |
| 683 # Declare an Android assets target. |
| 684 # |
| 685 # Defines a set of files to include as assets in a dependent apk. |
| 686 # |
| 687 # To include these assets in an apk, this target should be listed in |
| 688 # the apk's deps, or in the deps of a library target used by an apk. |
| 689 # |
| 690 # Variables |
| 691 # deps: Specifies the dependencies of this target. Any Android assets |
| 692 # listed in deps will be included by libraries/apks that depend on this |
| 693 # target. |
| 694 # sources: List of files to include as assets. |
| 695 # renaming_sources: List of files to include as assets and be renamed. |
| 696 # renaming_destinations: List of asset paths for files in renaming_sources. |
| 697 # disable_compression: Whether to disable compression for files that are |
| 698 # known to be compressable (default: false). |
| 699 # |
| 700 # Example: |
| 701 # android_assets("content_shell_assets") { |
| 702 # deps = [ |
| 703 # ":generates_foo", |
| 704 # ":other_assets", |
| 705 # ] |
| 706 # sources = [ |
| 707 # "//path/asset1.png", |
| 708 # "//path/asset2.png", |
| 709 # "$target_gen_dir/foo.dat", |
| 710 # ] |
| 711 # } |
| 712 # |
| 713 # android_assets("overriding_content_shell_assets") { |
| 714 # deps = [ ":content_shell_assets" ] |
| 715 # # Override foo.dat from content_shell_assets. |
| 716 # sources = [ "//custom/foo.dat" ] |
| 717 # renaming_sources = [ "//path/asset2.png" ] |
| 718 # renaming_destinations = [ "renamed/asset2.png" ] |
| 719 # } |
| 720 template("android_assets") { |
| 721 set_sources_assignment_filter([]) |
| 722 forward_variables_from(invoker, [ "testonly" ]) |
| 723 |
| 724 _build_config = "$target_gen_dir/$target_name.build_config" |
| 725 _build_config_target_name = "${target_name}__build_config" |
| 726 |
| 727 write_build_config(_build_config_target_name) { |
| 728 forward_variables_from(invoker, |
| 729 [ |
| 730 "deps", |
| 731 "disable_compression", |
| 732 ]) |
| 733 type = "android_assets" |
| 734 build_config = _build_config |
| 735 if (defined(invoker.sources)) { |
| 736 asset_sources = invoker.sources |
| 737 } |
| 738 if (defined(invoker.renaming_sources)) { |
| 739 assert(defined(invoker.renaming_destinations)) |
| 740 _source_count = 0 |
| 741 foreach(_, invoker.renaming_sources) { |
| 742 _source_count += 1 |
| 743 } |
| 744 _dest_count = 0 |
| 745 foreach(_, invoker.renaming_destinations) { |
| 746 _dest_count += 1 |
| 747 } |
| 748 assert( |
| 749 _source_count == _dest_count, |
| 750 "android_assets() renaming_sources.length != renaming_destinations.len
gth") |
| 751 asset_renaming_sources = invoker.renaming_sources |
| 752 asset_renaming_destinations = invoker.renaming_destinations |
| 753 } |
| 754 } |
| 755 |
| 756 group(target_name) { |
| 757 forward_variables_from(invoker, [ "visibility" ]) |
| 758 public_deps = [ |
| 759 ":$_build_config_target_name", |
| 760 ] |
| 761 } |
| 762 } |
| 763 |
683 # Declare a target that generates localized strings.xml from a .grd file. | 764 # Declare a target that generates localized strings.xml from a .grd file. |
684 # | 765 # |
685 # If this target is included in the deps of an android resources/library/apk, | 766 # If this target is included in the deps of an android resources/library/apk, |
686 # the strings.xml will be included with that target. | 767 # the strings.xml will be included with that target. |
687 # | 768 # |
688 # Variables | 769 # Variables |
689 # deps: Specifies the dependencies of this target. | 770 # deps: Specifies the dependencies of this target. |
690 # grd_file: Path to the .grd file to generate strings.xml from. | 771 # grd_file: Path to the .grd file to generate strings.xml from. |
691 # outputs: Expected grit outputs (see grit rule). | 772 # outputs: Expected grit outputs (see grit rule). |
692 # | 773 # |
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1513 deps = [] | 1594 deps = [] |
1514 forward_variables_from(invoker, | 1595 forward_variables_from(invoker, |
1515 [ | 1596 [ |
1516 "asset_location", | 1597 "asset_location", |
1517 "deps", | 1598 "deps", |
1518 "extensions_to_not_compress", | 1599 "extensions_to_not_compress", |
1519 "language_splits", | 1600 "language_splits", |
1520 ]) | 1601 ]) |
1521 apk_path = _final_apk_path | 1602 apk_path = _final_apk_path |
1522 android_manifest = _android_manifest | 1603 android_manifest = _android_manifest |
| 1604 assets_build_config = _build_config |
1523 resources_zip = _all_resources_zip_path | 1605 resources_zip = _all_resources_zip_path |
1524 dex_path = final_dex_path | 1606 dex_path = final_dex_path |
1525 load_library_from_apk = _load_library_from_apk | 1607 load_library_from_apk = _load_library_from_apk |
1526 create_density_splits = _create_density_splits | 1608 create_density_splits = _create_density_splits |
1527 | 1609 |
1528 if (!defined(extensions_to_not_compress)) { | 1610 if (!defined(extensions_to_not_compress)) { |
1529 # Allow icu data, v8 snapshots, and pak files to be loaded directly from | 1611 # Allow icu data, v8 snapshots, and pak files to be loaded directly from |
1530 # the .apk. | 1612 # the .apk. |
1531 # Note: These are actually suffix matches, not necessarily extensions. | 1613 # Note: These are actually suffix matches, not necessarily extensions. |
1532 extensions_to_not_compress = ".dat,.bin,.pak" | 1614 extensions_to_not_compress = ".dat,.bin,.pak" |
1533 } | 1615 } |
1534 | 1616 |
1535 version_code = _version_code | 1617 version_code = _version_code |
1536 version_name = _version_name | 1618 version_name = _version_name |
1537 | 1619 |
1538 keystore_name = _keystore_name | 1620 keystore_name = _keystore_name |
1539 keystore_path = _keystore_path | 1621 keystore_path = _keystore_path |
1540 keystore_password = _keystore_password | 1622 keystore_password = _keystore_password |
1541 | 1623 |
1542 # Incremental apk does not use native libs nor final dex. | 1624 # Incremental apk does not use native libs nor final dex. |
1543 incremental_deps = | 1625 incremental_deps = deps + _android_manifest_deps + [ |
1544 deps + _android_manifest_deps + [ ":$process_resources_target" ] | 1626 ":$build_config_target", |
| 1627 ":$process_resources_target", |
| 1628 ] |
1545 | 1629 |
1546 # This target generates the input file _all_resources_zip_path. | 1630 # This target generates the input file _all_resources_zip_path. |
1547 deps += _android_manifest_deps + [ | 1631 deps += _android_manifest_deps + [ |
| 1632 ":$build_config_target", |
1548 ":$process_resources_target", | 1633 ":$process_resources_target", |
1549 ":$final_dex_target_name", | 1634 ":$final_dex_target_name", |
1550 ] | 1635 ] |
1551 | 1636 |
1552 if (_native_libs != [] && !_create_abi_split) { | 1637 if (_native_libs != [] && !_create_abi_split) { |
1553 native_libs_dir = _native_libs_dir | 1638 native_libs_dir = _native_libs_dir |
1554 deps += [ ":$_prepare_native_target_name" ] | 1639 deps += [ ":$_prepare_native_target_name" ] |
1555 } | 1640 } |
1556 } | 1641 } |
1557 | 1642 |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2041 } | 2126 } |
2042 | 2127 |
2043 android_library(target_name) { | 2128 android_library(target_name) { |
2044 java_files = [] | 2129 java_files = [] |
2045 srcjar_deps = [ ":${_template_name}__protoc_java" ] | 2130 srcjar_deps = [ ":${_template_name}__protoc_java" ] |
2046 deps = [ | 2131 deps = [ |
2047 "//third_party/android_protobuf:protobuf_nano_javalib", | 2132 "//third_party/android_protobuf:protobuf_nano_javalib", |
2048 ] | 2133 ] |
2049 } | 2134 } |
2050 } | 2135 } |
OLD | NEW |