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

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

Issue 1943583002: GN: forward_variables_from shouldn't clobber vars. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months 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/config/sanitizers/sanitizers.gni") 8 import("//build/config/sanitizers/sanitizers.gni")
9 import("//build/toolchain/toolchain.gni") 9 import("//build/toolchain/toolchain.gni")
10 import("//third_party/android_platform/config.gni") 10 import("//third_party/android_platform/config.gni")
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 # TODO(cjhopman): #includes should probably all be relative to 78 # TODO(cjhopman): #includes should probably all be relative to
79 # base_output_dir. Remove that from this config once the includes are 79 # base_output_dir. Remove that from this config once the includes are
80 # updated. 80 # updated.
81 include_dirs = [ 81 include_dirs = [
82 base_output_dir, 82 base_output_dir,
83 package_output_dir, 83 package_output_dir,
84 ] 84 ]
85 } 85 }
86 86
87 group(target_name) { 87 group(target_name) {
88 public_deps = []
89 forward_variables_from(invoker, 88 forward_variables_from(invoker,
90 [ 89 [
91 "deps", 90 "deps",
92 "public_deps", 91 "public_deps",
93 "visibility", 92 "visibility",
94 ]) 93 ])
94 if (!defined(public_deps)) {
95 public_deps = []
96 }
95 public_deps += [ ":$foreach_target_name" ] 97 public_deps += [ ":$foreach_target_name" ]
96 public_configs = [ ":jni_includes_${target_name}" ] 98 public_configs = [ ":jni_includes_${target_name}" ]
97 } 99 }
98 } 100 }
99 101
100 # Declare a jni target for a prebuilt jar 102 # Declare a jni target for a prebuilt jar
101 # 103 #
102 # This target generates the native jni bindings for a set of classes in a .jar. 104 # This target generates the native jni bindings for a set of classes in a .jar.
103 # 105 #
104 # See base/android/jni_generator/jni_generator.py for more info about the 106 # See base/android/jni_generator/jni_generator.py for more info about the
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 } 632 }
631 visibility = [ ":$process_resources_target_name" ] 633 visibility = [ ":$process_resources_target_name" ]
632 634
633 type = "android_resources" 635 type = "android_resources"
634 resources_zip = zip_path 636 resources_zip = zip_path
635 srcjar = srcjar_path 637 srcjar = srcjar_path
636 } 638 }
637 639
638 process_resources(process_resources_target_name) { 640 process_resources(process_resources_target_name) {
639 visibility = [ ":$final_target_name" ] 641 visibility = [ ":$final_target_name" ]
640 deps = []
641 forward_variables_from(invoker, 642 forward_variables_from(invoker,
642 [ 643 [
643 "app_as_shared_lib", 644 "app_as_shared_lib",
644 "android_manifest", 645 "android_manifest",
645 "custom_package", 646 "custom_package",
646 "deps", 647 "deps",
647 "generated_resource_dirs", 648 "generated_resource_dirs",
648 "generated_resource_files", 649 "generated_resource_files",
649 "resource_dirs", 650 "resource_dirs",
650 "shared_resources", 651 "shared_resources",
651 "v14_skip", 652 "v14_skip",
652 ]) 653 ])
654 if (!defined(deps)) {
655 deps = []
656 }
653 deps += [ ":$build_config_target_name" ] 657 deps += [ ":$build_config_target_name" ]
654 658
655 # Always generate R.onResourcesLoaded() method, it is required for 659 # Always generate R.onResourcesLoaded() method, it is required for
656 # compiling ResourceRewriter, there is no side effect because the 660 # compiling ResourceRewriter, there is no side effect because the
657 # generated R.class isn't used in final apk. 661 # generated R.class isn't used in final apk.
658 shared_resources = true 662 shared_resources = true
659 if (!defined(android_manifest)) { 663 if (!defined(android_manifest)) {
660 android_manifest = "//build/android/AndroidManifest.xml" 664 android_manifest = "//build/android/AndroidManifest.xml"
661 } 665 }
662 } 666 }
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 # java_files: List of .java files included in this library. 905 # java_files: List of .java files included in this library.
902 # srcjar_deps: List of srcjar dependencies. The .java files in the srcjars 906 # srcjar_deps: List of srcjar dependencies. The .java files in the srcjars
903 # will be added to java_files and be included in this library. 907 # will be added to java_files and be included in this library.
904 # srcjars: List of srcjars to be included in this library, together with the 908 # srcjars: List of srcjars to be included in this library, together with the
905 # ones obtained from srcjar_deps. 909 # ones obtained from srcjar_deps.
906 # bypass_platform_checks: Disables checks about cross-platform (Java/Android) 910 # bypass_platform_checks: Disables checks about cross-platform (Java/Android)
907 # dependencies for this target. This will allow depending on an 911 # dependencies for this target. This will allow depending on an
908 # android_library target, for example. 912 # android_library target, for example.
909 # chromium_code: If true, extra analysis warning/errors will be enabled. 913 # chromium_code: If true, extra analysis warning/errors will be enabled.
910 # enable_errorprone: If true, enables the errorprone compiler. 914 # enable_errorprone: If true, enables the errorprone compiler.
911 # enable_incremental_javac: Overrides the global enable_incremental_javac. 915 # enable_incremental_javac_override: Overrides the
916 # global enable_incremental_javac.
912 # main_class: When specified, a wrapper script is created within 917 # main_class: When specified, a wrapper script is created within
913 # $root_build_dir/bin to launch the binary with the given class as the 918 # $root_build_dir/bin to launch the binary with the given class as the
914 # entrypoint. 919 # entrypoint.
915 # wrapper_script_args: List of additional arguments for the wrapper script. 920 # wrapper_script_args: List of additional arguments for the wrapper script.
916 # 921 #
917 # data_deps, testonly 922 # data_deps, testonly
918 # 923 #
919 # Example 924 # Example
920 # java_binary("foo") { 925 # java_binary("foo") {
921 # java_files = [ "org/chromium/foo/FooMain.java" ] 926 # java_files = [ "org/chromium/foo/FooMain.java" ]
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 # will be added to the javac classpath. 1005 # will be added to the javac classpath.
1001 # 1006 #
1002 # java_files: List of .java files included in this library. 1007 # java_files: List of .java files included in this library.
1003 # srcjar_deps: List of srcjar dependencies. The .java files in the srcjars 1008 # srcjar_deps: List of srcjar dependencies. The .java files in the srcjars
1004 # will be added to java_files and be included in this library. 1009 # will be added to java_files and be included in this library.
1005 # srcjars: List of srcjars to be included in this library, together with the 1010 # srcjars: List of srcjars to be included in this library, together with the
1006 # ones obtained from srcjar_deps. 1011 # ones obtained from srcjar_deps.
1007 # 1012 #
1008 # chromium_code: If true, extra analysis warning/errors will be enabled. 1013 # chromium_code: If true, extra analysis warning/errors will be enabled.
1009 # enable_errorprone: If true, enables the errorprone compiler. 1014 # enable_errorprone: If true, enables the errorprone compiler.
1010 # enable_incremental_javac: Overrides the global enable_incremental_javac. 1015 # enable_incremental_javac_override: Overrides the global
1016 # enable_incremental_javac.
1011 # 1017 #
1012 # jar_excluded_patterns: List of patterns of .class files to exclude from the 1018 # jar_excluded_patterns: List of patterns of .class files to exclude from the
1013 # final jar. 1019 # final jar.
1014 # 1020 #
1015 # proguard_preprocess: If true, proguard preprocessing will be run. This can 1021 # proguard_preprocess: If true, proguard preprocessing will be run. This can
1016 # be used to remove unwanted parts of the library. 1022 # be used to remove unwanted parts of the library.
1017 # proguard_config: Path to the proguard config for preprocessing. 1023 # proguard_config: Path to the proguard config for preprocessing.
1018 # 1024 #
1019 # supports_android: If true, Android targets (android_library, android_apk) 1025 # supports_android: If true, Android targets (android_library, android_apk)
1020 # may depend on this target. Note: if true, this target must only use the 1026 # may depend on this target. Note: if true, this target must only use the
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 # will be used when building this library. 1095 # will be used when building this library.
1090 # 1096 #
1091 # java_files: List of .java files included in this library. 1097 # java_files: List of .java files included in this library.
1092 # srcjar_deps: List of srcjar dependencies. The .java files in the srcjars 1098 # srcjar_deps: List of srcjar dependencies. The .java files in the srcjars
1093 # will be added to java_files and be included in this library. 1099 # will be added to java_files and be included in this library.
1094 # srcjars: List of srcjars to be included in this library, together with the 1100 # srcjars: List of srcjars to be included in this library, together with the
1095 # ones obtained from srcjar_deps. 1101 # ones obtained from srcjar_deps.
1096 # 1102 #
1097 # chromium_code: If true, extra analysis warning/errors will be enabled. 1103 # chromium_code: If true, extra analysis warning/errors will be enabled.
1098 # enable_errorprone: If true, enables the errorprone compiler. 1104 # enable_errorprone: If true, enables the errorprone compiler.
1099 # enable_incremental_javac: Overrides the global enable_incremental_javac. 1105 # enable_incremental_javac_override: Overrides the global
1106 # enable_incremental_javac.
1100 # 1107 #
1101 # jar_excluded_patterns: List of patterns of .class files to exclude from the 1108 # jar_excluded_patterns: List of patterns of .class files to exclude from the
1102 # final jar. 1109 # final jar.
1103 # 1110 #
1104 # proguard_preprocess: If true, proguard preprocessing will be run. This can 1111 # proguard_preprocess: If true, proguard preprocessing will be run. This can
1105 # be used to remove unwanted parts of the library. 1112 # be used to remove unwanted parts of the library.
1106 # proguard_config: Path to the proguard config for preprocessing. 1113 # proguard_config: Path to the proguard config for preprocessing.
1107 # 1114 #
1108 # dex_path: If set, the resulting .dex.jar file will be placed under this 1115 # dex_path: If set, the resulting .dex.jar file will be placed under this
1109 # path. 1116 # path.
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 # R.java files. 1269 # R.java files.
1263 # testonly: Marks this target as "test-only". 1270 # testonly: Marks this target as "test-only".
1264 # write_asset_list: Adds an extra file to the assets, which contains a list of 1271 # write_asset_list: Adds an extra file to the assets, which contains a list of
1265 # all other asset files. 1272 # all other asset files.
1266 # alternative_locale_resource_dep: The locale resource target which overrides 1273 # alternative_locale_resource_dep: The locale resource target which overrides
1267 # any exsting locale resources in dep graph. 1274 # any exsting locale resources in dep graph.
1268 # requires_sdk_api_level_23: If defined and true, the apk is intended for 1275 # requires_sdk_api_level_23: If defined and true, the apk is intended for
1269 # installation only on Android M or later. In these releases the system 1276 # installation only on Android M or later. In these releases the system
1270 # linker does relocation unpacking, so we can enable it unconditionally. 1277 # linker does relocation unpacking, so we can enable it unconditionally.
1271 # secondary_native_libs: the path of native libraries for secondary app abi. 1278 # secondary_native_libs: the path of native libraries for secondary app abi.
1279 # run_findbugs_override: Forces run_findbugs on or off. If undefined, the
1280 # default will use the build arg run_findbugs.
1272 # 1281 #
1273 # Example 1282 # Example
1274 # android_apk("foo_apk") { 1283 # android_apk("foo_apk") {
1275 # android_manifest = "AndroidManifest.xml" 1284 # android_manifest = "AndroidManifest.xml"
1276 # java_files = [ 1285 # java_files = [
1277 # "android/org/chromium/foo/FooApplication.java", 1286 # "android/org/chromium/foo/FooApplication.java",
1278 # "android/org/chromium/foo/FooActivity.java", 1287 # "android/org/chromium/foo/FooActivity.java",
1279 # ] 1288 # ]
1280 # deps = [ 1289 # deps = [
1281 # ":foo_support_java" 1290 # ":foo_support_java"
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
1549 } 1558 }
1550 _srcjar_deps += [ ":${_template_name}__build_config_java" ] 1559 _srcjar_deps += [ ":${_template_name}__build_config_java" ]
1551 } 1560 }
1552 1561
1553 java_target = "${_template_name}__java" 1562 java_target = "${_template_name}__java"
1554 java_library_impl(java_target) { 1563 java_library_impl(java_target) {
1555 forward_variables_from(invoker, 1564 forward_variables_from(invoker,
1556 [ 1565 [
1557 "chromium_code", 1566 "chromium_code",
1558 "java_files", 1567 "java_files",
1559 "run_findbugs", 1568 "run_findbugs_override",
1560 ]) 1569 ])
1561 supports_android = true 1570 supports_android = true
1562 requires_android = true 1571 requires_android = true
1563 override_build_config = _build_config 1572 override_build_config = _build_config
1564 deps = _android_manifest_deps + [ ":$build_config_target" ] 1573 deps = _android_manifest_deps + [ ":$build_config_target" ]
1565 1574
1566 android_manifest = _android_manifest 1575 android_manifest = _android_manifest
1567 srcjar_deps = _srcjar_deps 1576 srcjar_deps = _srcjar_deps
1568 jar_path = _jar_path 1577 jar_path = _jar_path
1569 dex_path = _lib_dex_path 1578 dex_path = _lib_dex_path
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1652 } else { 1661 } else {
1653 if (enable_multidex) { 1662 if (enable_multidex) {
1654 _dex_sources = [ _jar_path ] 1663 _dex_sources = [ _jar_path ]
1655 } else { 1664 } else {
1656 _dex_sources = [ _lib_dex_path ] 1665 _dex_sources = [ _lib_dex_path ]
1657 } 1666 }
1658 _dex_deps = [ ":$java_target" ] 1667 _dex_deps = [ ":$java_target" ]
1659 } 1668 }
1660 1669
1661 dex("$final_dex_target_name") { 1670 dex("$final_dex_target_name") {
1662 forward_variables_from(invoker, [ "enable_multidex" ])
1663 deps = _dex_deps + [ ":$build_config_target" ] 1671 deps = _dex_deps + [ ":$build_config_target" ]
1664 inputs = [ 1672 inputs = [
1665 _build_config, 1673 _build_config,
1666 ] 1674 ]
1667 sources = _dex_sources 1675 sources = _dex_sources
1668 output = final_dex_path 1676 output = final_dex_path
1669 1677
1670 # All deps are already included in _dex_sources when proguard is used. 1678 # All deps are already included in _dex_sources when proguard is used.
1671 if (!_proguard_enabled) { 1679 if (!_proguard_enabled) {
1672 if (enable_multidex) { 1680 if (enable_multidex) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1743 _extra_native_libs_deps += 1751 _extra_native_libs_deps +=
1744 [ "//base/android/linker:chromium_android_linker" ] 1752 [ "//base/android/linker:chromium_android_linker" ]
1745 } 1753 }
1746 } 1754 }
1747 if (defined(invoker.loadable_modules) && invoker.loadable_modules != []) { 1755 if (defined(invoker.loadable_modules) && invoker.loadable_modules != []) {
1748 _extra_native_libs_even_when_incremental += invoker.loadable_modules 1756 _extra_native_libs_even_when_incremental += invoker.loadable_modules
1749 } 1757 }
1750 1758
1751 _final_deps += [ ":${_template_name}__create" ] 1759 _final_deps += [ ":${_template_name}__create" ]
1752 create_apk("${_template_name}__create") { 1760 create_apk("${_template_name}__create") {
1753 deps = []
1754 forward_variables_from(invoker, 1761 forward_variables_from(invoker,
1755 [ 1762 [
1756 "alternative_android_sdk_jar", 1763 "alternative_android_sdk_jar",
1757 "android_aapt_path", 1764 "android_aapt_path",
1758 "app_as_shared_lib", 1765 "app_as_shared_lib",
1759 "deps", 1766 "deps",
1760 "extensions_to_not_compress", 1767 "extensions_to_not_compress",
1761 "language_splits", 1768 "language_splits",
1762 "page_align_shared_libraries", 1769 "page_align_shared_libraries",
1763 "public_deps", 1770 "public_deps",
1764 "secondary_native_libs", 1771 "secondary_native_libs",
1765 "shared_resources", 1772 "shared_resources",
1766 "uncompress_shared_libraries", 1773 "uncompress_shared_libraries",
1767 "write_asset_list", 1774 "write_asset_list",
1768 ]) 1775 ])
1776 if (!defined(deps)) {
1777 deps = []
1778 }
1769 apk_path = _final_apk_path 1779 apk_path = _final_apk_path
1770 android_manifest = _android_manifest 1780 android_manifest = _android_manifest
1771 assets_build_config = _build_config 1781 assets_build_config = _build_config
1772 resources_zip = _all_resources_zip_path 1782 resources_zip = _all_resources_zip_path
1773 dex_path = final_dex_path 1783 dex_path = final_dex_path
1774 load_library_from_apk = _load_library_from_apk 1784 load_library_from_apk = _load_library_from_apk
1775 create_density_splits = _create_density_splits 1785 create_density_splits = _create_density_splits
1776 emma_instrument = emma_coverage && !_emma_never_instrument 1786 emma_instrument = emma_coverage && !_emma_never_instrument
1777 1787
1778 if (!defined(extensions_to_not_compress)) { 1788 if (!defined(extensions_to_not_compress)) {
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1922 1932
1923 group(target_name) { 1933 group(target_name) {
1924 forward_variables_from(invoker, 1934 forward_variables_from(invoker,
1925 [ 1935 [
1926 "data", 1936 "data",
1927 "data_deps", 1937 "data_deps",
1928 ]) 1938 ])
1929 public_deps = _final_deps 1939 public_deps = _final_deps
1930 } 1940 }
1931 group("${target_name}_incremental") { 1941 group("${target_name}_incremental") {
1932 data_deps = []
1933 forward_variables_from(invoker, 1942 forward_variables_from(invoker,
1934 [ 1943 [
1935 "data", 1944 "data",
1936 "data_deps", 1945 "data_deps",
1937 ]) 1946 ])
1947 if (!defined(data_deps)) {
1948 data_deps = []
1949 }
1938 1950
1939 # device/commands is used by the installer script to push files via .zip. 1951 # device/commands is used by the installer script to push files via .zip.
1940 data_deps += [ "//build/android/pylib/device/commands" ] + 1952 data_deps += [ "//build/android/pylib/device/commands" ] +
1941 _native_libs_deps + _extra_native_libs_deps 1953 _native_libs_deps + _extra_native_libs_deps
1942 1954
1943 # Since the _incremental.apk does not include use .so nor .dex from the 1955 # Since the _incremental.apk does not include use .so nor .dex from the
1944 # actual target, but instead loads them at runtime, we need to explicitly 1956 # actual target, but instead loads them at runtime, we need to explicitly
1945 # depend on them here. 1957 # depend on them here.
1946 public_deps = [ 1958 public_deps = [
1947 ":${_create_incremental_script_rule_name}", 1959 ":${_create_incremental_script_rule_name}",
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
2030 data_deps += [ 2042 data_deps += [
2031 "//testing/android/driver:driver_apk", 2043 "//testing/android/driver:driver_apk",
2032 "//tools/android/forwarder2", 2044 "//tools/android/forwarder2",
2033 "//tools/android/md5sum", 2045 "//tools/android/md5sum",
2034 ] 2046 ]
2035 if (defined(invoker.additional_apks)) { 2047 if (defined(invoker.additional_apks)) {
2036 data_deps += invoker.additional_apks 2048 data_deps += invoker.additional_apks
2037 } 2049 }
2038 2050
2039 create_dist_ijar = true 2051 create_dist_ijar = true
2040 run_findbugs = defined(invoker.run_findbugs) && invoker.run_findbugs && 2052 if (defined(invoker.run_findbugs_override)) {
2041 defined(invoker.java_files) 2053 # Only allow findbugs when there are java files.
2054 run_findbugs_override =
2055 invoker.run_findbugs_override && defined(invoker.java_files)
2056 }
2042 } 2057 }
2043 2058
2044 group(target_name) { 2059 group(target_name) {
2045 public_deps = [ 2060 public_deps = [
2046 ":$_apk_target_name", 2061 ":$_apk_target_name",
2047 ":$_test_runner_target_name", 2062 ":$_test_runner_target_name",
2048 2063
2049 # Required by test runner to enumerate test list. 2064 # Required by test runner to enumerate test list.
2050 ":${_apk_target_name}_dist_ijar", 2065 ":${_apk_target_name}_dist_ijar",
2051 ] 2066 ]
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
2417 "--target", 2432 "--target",
2418 rebase_path(invoker.target, root_build_dir), 2433 rebase_path(invoker.target, root_build_dir),
2419 "--output-directory", 2434 "--output-directory",
2420 rebase_path(root_out_dir, root_build_dir), 2435 rebase_path(root_out_dir, root_build_dir),
2421 ] 2436 ]
2422 if (defined(invoker.flag_name)) { 2437 if (defined(invoker.flag_name)) {
2423 args += [ "--flag-name=${invoker.flag_name}" ] 2438 args += [ "--flag-name=${invoker.flag_name}" ]
2424 } 2439 }
2425 } 2440 }
2426 } 2441 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698