Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(348)

Side by Side Diff: build/config/android/rules.gni

Issue 1418243003: Add GN template for android_assets(). Use it in content_shell_apk. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 (similar to copy()).
pkotwicz 2015/10/24 03:46:03 Can you remove the variable given that it is unuse
agrieve 2015/10/25 17:32:10 I'd like to keep it in to document how I'd like th
696 # enable_compression: Whether to enable compressed for files that are not
pkotwicz 2015/10/23 23:17:22 Nit: compressed -> compression
pkotwicz 2015/10/24 03:46:03 I think that disable_compression is a better name
agrieve 2015/10/25 17:32:10 Done.
agrieve 2015/10/25 17:32:10 Done.
697 # already known to be non-compressable (default: true).
698 #
699 # Example:
700 # android_assets("content_shell_assets") {
701 # deps = [
702 # ":generates_foo",
703 # ":other_assets",
704 # ]
705 # sources = [
706 # "$target_gen_dir/foo.dat",
707 # ]
708 # }
709 template("android_assets") {
710 set_sources_assignment_filter([])
711 forward_variables_from(invoker, [ "testonly" ])
712
713 assert(!defined(invoker.outputs), "TODO: Add support for output paths")
714
715 _build_config = "$target_gen_dir/$target_name.build_config"
716 _build_config_target_name = "${target_name}__build_config"
717
718 write_build_config(_build_config_target_name) {
719 forward_variables_from(invoker,
720 [
721 "deps",
722 "prefix_to_strip",
pkotwicz 2015/10/24 03:46:03 I can't find a place where "prefix_to_strip" is us
agrieve 2015/10/25 17:32:10 Whoops, zapped.
723 "enable_compression",
724 ])
725 type = "android_assets"
726 build_config = _build_config
727 assets = invoker.sources
728 }
729
730 group(target_name) {
731 forward_variables_from(invoker, [ "visibility" ])
732 if (invoker.sources != []) {
pkotwicz 2015/10/24 03:46:03 Should we assert that invoker.sources is non-empty
agrieve 2015/10/25 17:32:10 We'll have empty sources in the examples in the pa
733 public_deps = [
734 ":$_build_config_target_name",
735 ]
736 }
737 }
738 }
739
683 # Declare a target that generates localized strings.xml from a .grd file. 740 # Declare a target that generates localized strings.xml from a .grd file.
684 # 741 #
685 # If this target is included in the deps of an android resources/library/apk, 742 # If this target is included in the deps of an android resources/library/apk,
686 # the strings.xml will be included with that target. 743 # the strings.xml will be included with that target.
687 # 744 #
688 # Variables 745 # Variables
689 # deps: Specifies the dependencies of this target. 746 # deps: Specifies the dependencies of this target.
690 # grd_file: Path to the .grd file to generate strings.xml from. 747 # grd_file: Path to the .grd file to generate strings.xml from.
691 # outputs: Expected grit outputs (see grit rule). 748 # outputs: Expected grit outputs (see grit rule).
692 # 749 #
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
1513 deps = [] 1570 deps = []
1514 forward_variables_from(invoker, 1571 forward_variables_from(invoker,
1515 [ 1572 [
1516 "asset_location", 1573 "asset_location",
1517 "deps", 1574 "deps",
1518 "extensions_to_not_compress", 1575 "extensions_to_not_compress",
1519 "language_splits", 1576 "language_splits",
1520 ]) 1577 ])
1521 apk_path = _final_apk_path 1578 apk_path = _final_apk_path
1522 android_manifest = _android_manifest 1579 android_manifest = _android_manifest
1580 assets_build_config = _build_config
1523 resources_zip = _all_resources_zip_path 1581 resources_zip = _all_resources_zip_path
1524 dex_path = final_dex_path 1582 dex_path = final_dex_path
1525 load_library_from_apk = _load_library_from_apk 1583 load_library_from_apk = _load_library_from_apk
1526 create_density_splits = _create_density_splits 1584 create_density_splits = _create_density_splits
1527 1585
1528 if (!defined(extensions_to_not_compress)) { 1586 if (!defined(extensions_to_not_compress)) {
1529 # Allow icu data, v8 snapshots, and pak files to be loaded directly from 1587 # Allow icu data, v8 snapshots, and pak files to be loaded directly from
1530 # the .apk. 1588 # the .apk.
1531 # Note: These are actually suffix matches, not necessarily extensions. 1589 # Note: These are actually suffix matches, not necessarily extensions.
1532 extensions_to_not_compress = ".dat,.bin,.pak" 1590 extensions_to_not_compress = ".dat,.bin,.pak"
1533 } 1591 }
1534 1592
1535 version_code = _version_code 1593 version_code = _version_code
1536 version_name = _version_name 1594 version_name = _version_name
1537 1595
1538 keystore_name = _keystore_name 1596 keystore_name = _keystore_name
1539 keystore_path = _keystore_path 1597 keystore_path = _keystore_path
1540 keystore_password = _keystore_password 1598 keystore_password = _keystore_password
1541 1599
1542 # Incremental apk does not use native libs nor final dex. 1600 # Incremental apk does not use native libs nor final dex.
1543 incremental_deps = 1601 incremental_deps = deps + _android_manifest_deps + [
1544 deps + _android_manifest_deps + [ ":$process_resources_target" ] 1602 ":$build_config_target",
1603 ":$process_resources_target",
1604 ]
1545 1605
1546 # This target generates the input file _all_resources_zip_path. 1606 # This target generates the input file _all_resources_zip_path.
1547 deps += _android_manifest_deps + [ 1607 deps += _android_manifest_deps + [
1608 ":$build_config_target",
1548 ":$process_resources_target", 1609 ":$process_resources_target",
1549 ":$final_dex_target_name", 1610 ":$final_dex_target_name",
1550 ] 1611 ]
1551 1612
1552 if (_native_libs != [] && !_create_abi_split) { 1613 if (_native_libs != [] && !_create_abi_split) {
1553 native_libs_dir = _native_libs_dir 1614 native_libs_dir = _native_libs_dir
1554 deps += [ ":$_prepare_native_target_name" ] 1615 deps += [ ":$_prepare_native_target_name" ]
1555 } 1616 }
1556 } 1617 }
1557 1618
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
2035 } 2096 }
2036 2097
2037 android_library(target_name) { 2098 android_library(target_name) {
2038 java_files = [] 2099 java_files = []
2039 srcjar_deps = [ ":${_template_name}__protoc_java" ] 2100 srcjar_deps = [ ":${_template_name}__protoc_java" ]
2040 deps = [ 2101 deps = [
2041 "//third_party/android_protobuf:protobuf_nano_javalib", 2102 "//third_party/android_protobuf:protobuf_nano_javalib",
2042 ] 2103 ]
2043 } 2104 }
2044 } 2105 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698