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 # outputs: List of asset paths to use for the assets. If there are fewer | |
696 # values than exist in sources, remaining sources will use the default path. | |
pkotwicz
2015/10/29 22:57:47
In which cases would this parameter be useful?
If
pkotwicz
2015/10/29 23:23:33
I think that the purpose of outputs parameter is t
agrieve
2015/10/30 00:04:45
I've modelled this after the copy() rule, which al
| |
697 # disable_compression: Whether to diesable 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 # outputs = [ | |
712 # "subdir/asset1.png", | |
713 # "subdir/asset2.png", | |
714 # ] | |
715 # } | |
716 # | |
717 # android_assets("overriding_content_shell_assets") { | |
718 # deps = [ | |
719 # ":content_shell_assets", | |
720 # ] | |
721 # sources = [ | |
722 # "//custom/foo.dat" # Override foo.dat from content_shell_assets. | |
723 # ] | |
724 # } | |
725 template("android_assets") { | |
726 set_sources_assignment_filter([]) | |
727 forward_variables_from(invoker, [ "testonly" ]) | |
728 | |
729 _build_config = "$target_gen_dir/$target_name.build_config" | |
730 _build_config_target_name = "${target_name}__build_config" | |
731 | |
732 write_build_config(_build_config_target_name) { | |
733 forward_variables_from(invoker, | |
734 [ | |
735 "deps", | |
736 "disable_compression", | |
737 ]) | |
738 type = "android_assets" | |
739 build_config = _build_config | |
740 assets = invoker.sources | |
741 if (defined(invoker.outputs)) { | |
742 asset_outputs = invoker.outputs | |
743 } | |
744 } | |
745 | |
746 group(target_name) { | |
747 forward_variables_from(invoker, [ "visibility" ]) | |
748 if (invoker.sources != []) { | |
749 public_deps = [ | |
750 ":$_build_config_target_name", | |
751 ] | |
752 } | |
753 } | |
754 } | |
755 | |
683 # Declare a target that generates localized strings.xml from a .grd file. | 756 # Declare a target that generates localized strings.xml from a .grd file. |
684 # | 757 # |
685 # If this target is included in the deps of an android resources/library/apk, | 758 # If this target is included in the deps of an android resources/library/apk, |
686 # the strings.xml will be included with that target. | 759 # the strings.xml will be included with that target. |
687 # | 760 # |
688 # Variables | 761 # Variables |
689 # deps: Specifies the dependencies of this target. | 762 # deps: Specifies the dependencies of this target. |
690 # grd_file: Path to the .grd file to generate strings.xml from. | 763 # grd_file: Path to the .grd file to generate strings.xml from. |
691 # outputs: Expected grit outputs (see grit rule). | 764 # outputs: Expected grit outputs (see grit rule). |
692 # | 765 # |
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1513 deps = [] | 1586 deps = [] |
1514 forward_variables_from(invoker, | 1587 forward_variables_from(invoker, |
1515 [ | 1588 [ |
1516 "asset_location", | 1589 "asset_location", |
1517 "deps", | 1590 "deps", |
1518 "extensions_to_not_compress", | 1591 "extensions_to_not_compress", |
1519 "language_splits", | 1592 "language_splits", |
1520 ]) | 1593 ]) |
1521 apk_path = _final_apk_path | 1594 apk_path = _final_apk_path |
1522 android_manifest = _android_manifest | 1595 android_manifest = _android_manifest |
1596 assets_build_config = _build_config | |
1523 resources_zip = _all_resources_zip_path | 1597 resources_zip = _all_resources_zip_path |
1524 dex_path = final_dex_path | 1598 dex_path = final_dex_path |
1525 load_library_from_apk = _load_library_from_apk | 1599 load_library_from_apk = _load_library_from_apk |
1526 create_density_splits = _create_density_splits | 1600 create_density_splits = _create_density_splits |
1527 | 1601 |
1528 if (!defined(extensions_to_not_compress)) { | 1602 if (!defined(extensions_to_not_compress)) { |
1529 # Allow icu data, v8 snapshots, and pak files to be loaded directly from | 1603 # Allow icu data, v8 snapshots, and pak files to be loaded directly from |
1530 # the .apk. | 1604 # the .apk. |
1531 # Note: These are actually suffix matches, not necessarily extensions. | 1605 # Note: These are actually suffix matches, not necessarily extensions. |
1532 extensions_to_not_compress = ".dat,.bin,.pak" | 1606 extensions_to_not_compress = ".dat,.bin,.pak" |
1533 } | 1607 } |
1534 | 1608 |
1535 version_code = _version_code | 1609 version_code = _version_code |
1536 version_name = _version_name | 1610 version_name = _version_name |
1537 | 1611 |
1538 keystore_name = _keystore_name | 1612 keystore_name = _keystore_name |
1539 keystore_path = _keystore_path | 1613 keystore_path = _keystore_path |
1540 keystore_password = _keystore_password | 1614 keystore_password = _keystore_password |
1541 | 1615 |
1542 # Incremental apk does not use native libs nor final dex. | 1616 # Incremental apk does not use native libs nor final dex. |
1543 incremental_deps = | 1617 incremental_deps = deps + _android_manifest_deps + [ |
1544 deps + _android_manifest_deps + [ ":$process_resources_target" ] | 1618 ":$build_config_target", |
1619 ":$process_resources_target", | |
1620 ] | |
1545 | 1621 |
1546 # This target generates the input file _all_resources_zip_path. | 1622 # This target generates the input file _all_resources_zip_path. |
1547 deps += _android_manifest_deps + [ | 1623 deps += _android_manifest_deps + [ |
1624 ":$build_config_target", | |
1548 ":$process_resources_target", | 1625 ":$process_resources_target", |
1549 ":$final_dex_target_name", | 1626 ":$final_dex_target_name", |
1550 ] | 1627 ] |
1551 | 1628 |
1552 if (_native_libs != [] && !_create_abi_split) { | 1629 if (_native_libs != [] && !_create_abi_split) { |
1553 native_libs_dir = _native_libs_dir | 1630 native_libs_dir = _native_libs_dir |
1554 deps += [ ":$_prepare_native_target_name" ] | 1631 deps += [ ":$_prepare_native_target_name" ] |
1555 } | 1632 } |
1556 } | 1633 } |
1557 | 1634 |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2035 } | 2112 } |
2036 | 2113 |
2037 android_library(target_name) { | 2114 android_library(target_name) { |
2038 java_files = [] | 2115 java_files = [] |
2039 srcjar_deps = [ ":${_template_name}__protoc_java" ] | 2116 srcjar_deps = [ ":${_template_name}__protoc_java" ] |
2040 deps = [ | 2117 deps = [ |
2041 "//third_party/android_protobuf:protobuf_nano_javalib", | 2118 "//third_party/android_protobuf:protobuf_nano_javalib", |
2042 ] | 2119 ] |
2043 } | 2120 } |
2044 } | 2121 } |
OLD | NEW |