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

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

Issue 2295363002: 🔔 Allow android_* targets to specify proguard flags for apks (Closed)
Patch Set: Created 4 years, 3 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("//build/config/android/config.gni") 5 import("//build/config/android/config.gni")
6 import("//build/config/android/internal_rules.gni") 6 import("//build/config/android/internal_rules.gni")
7 import("//build/config/dcheck_always_on.gni") 7 import("//build/config/dcheck_always_on.gni")
8 import("//build/toolchain/toolchain.gni") 8 import("//build/toolchain/toolchain.gni")
9 9
10 assert(is_android) 10 assert(is_android)
(...skipping 1153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 # enable_errorprone: If true, enables the errorprone compiler. 1164 # enable_errorprone: If true, enables the errorprone compiler.
1165 # enable_incremental_javac_override: Overrides the global 1165 # enable_incremental_javac_override: Overrides the global
1166 # enable_incremental_javac. 1166 # enable_incremental_javac.
1167 # 1167 #
1168 # jar_excluded_patterns: List of patterns of .class files to exclude from th e 1168 # jar_excluded_patterns: List of patterns of .class files to exclude from th e
1169 # final jar. 1169 # final jar.
1170 # 1170 #
1171 # proguard_preprocess: If true, proguard preprocessing will be run. This can 1171 # proguard_preprocess: If true, proguard preprocessing will be run. This can
1172 # be used to remove unwanted parts of the library. 1172 # be used to remove unwanted parts of the library.
1173 # proguard_preprocess_config: Path to the proguard config for preprocessing. 1173 # proguard_preprocess_config: Path to the proguard config for preprocessing.
1174 # proguard_configs: List of proguard configs to use in final apk step for
1175 # any apk that depends on this library.
1174 # 1176 #
1175 # supports_android: If true, Android targets (android_library, android_apk) 1177 # supports_android: If true, Android targets (android_library, android_apk)
1176 # may depend on this target. Note: if true, this target must only use the 1178 # may depend on this target. Note: if true, this target must only use the
1177 # subset of Java available on Android. 1179 # subset of Java available on Android.
1178 # bypass_platform_checks: Disables checks about cross-platform (Java/Android ) 1180 # bypass_platform_checks: Disables checks about cross-platform (Java/Android )
1179 # dependencies for this target. This will allow depending on an 1181 # dependencies for this target. This will allow depending on an
1180 # android_library target, for example. 1182 # android_library target, for example.
1181 # 1183 #
1182 # additional_jar_files: Use to package additional files into the output jar. 1184 # additional_jar_files: Use to package additional files into the output jar.
1183 # Pass a list of length-2 lists with format 1185 # Pass a list of length-2 lists with format
(...skipping 29 matching lines...) Expand all
1213 # Declare a java library target for a prebuilt jar 1215 # Declare a java library target for a prebuilt jar
1214 # 1216 #
1215 # Variables 1217 # Variables
1216 # deps: Specifies the dependencies of this target. Java targets in this list 1218 # deps: Specifies the dependencies of this target. Java targets in this list
1217 # will be added to the javac classpath. 1219 # will be added to the javac classpath.
1218 # jar_path: Path to the prebuilt jar. 1220 # jar_path: Path to the prebuilt jar.
1219 # jar_dep: Target that builds jar_path (optional). 1221 # jar_dep: Target that builds jar_path (optional).
1220 # proguard_preprocess: If true, proguard preprocessing will be run. This can 1222 # proguard_preprocess: If true, proguard preprocessing will be run. This can
1221 # be used to remove unwanted parts of the library. 1223 # be used to remove unwanted parts of the library.
1222 # proguard_preprocess_config: Path to the proguard config for preprocessing. 1224 # proguard_preprocess_config: Path to the proguard config for preprocessing.
1225 # proguard_configs: List of proguard configs to use in final apk step for
1226 # any apk that depends on this library.
1223 # supports_android: If true, Android targets (android_library, android_apk) 1227 # supports_android: If true, Android targets (android_library, android_apk)
1224 # may depend on this target. Note: if true, this target must only use the 1228 # may depend on this target. Note: if true, this target must only use the
1225 # subset of Java available on Android. 1229 # subset of Java available on Android.
1226 # 1230 #
1227 # Example 1231 # Example
1228 # java_prebuilt("foo_java") { 1232 # java_prebuilt("foo_java") {
1229 # jar_path = "foo.jar" 1233 # jar_path = "foo.jar"
1230 # deps = [ 1234 # deps = [
1231 # ":foo_resources", 1235 # ":foo_resources",
1232 # ":bar_java" 1236 # ":bar_java"
(...skipping 30 matching lines...) Expand all
1263 # enable_errorprone: If true, enables the errorprone compiler. 1267 # enable_errorprone: If true, enables the errorprone compiler.
1264 # enable_incremental_javac_override: Overrides the global 1268 # enable_incremental_javac_override: Overrides the global
1265 # enable_incremental_javac. 1269 # enable_incremental_javac.
1266 # 1270 #
1267 # jar_excluded_patterns: List of patterns of .class files to exclude from th e 1271 # jar_excluded_patterns: List of patterns of .class files to exclude from th e
1268 # final jar. 1272 # final jar.
1269 # 1273 #
1270 # proguard_preprocess: If true, proguard preprocessing will be run. This can 1274 # proguard_preprocess: If true, proguard preprocessing will be run. This can
1271 # be used to remove unwanted parts of the library. 1275 # be used to remove unwanted parts of the library.
1272 # proguard_preprocess_config: Path to the proguard config for preprocessing. 1276 # proguard_preprocess_config: Path to the proguard config for preprocessing.
1277 # proguard_configs: List of proguard configs to use in final apk step for
1278 # any apk that depends on this library.
1273 # 1279 #
1274 # dex_path: If set, the resulting .dex.jar file will be placed under this 1280 # dex_path: If set, the resulting .dex.jar file will be placed under this
1275 # path. 1281 # path.
1276 # 1282 #
1277 # alternative_android_sdk_ijar: if set, the given android_sdk_ijar file 1283 # alternative_android_sdk_ijar: if set, the given android_sdk_ijar file
1278 # replaces the default android_sdk_ijar. 1284 # replaces the default android_sdk_ijar.
1279 # 1285 #
1280 # alternative_android_sdk_ijar_dep: the target that generates 1286 # alternative_android_sdk_ijar_dep: the target that generates
1281 # alternative_android_sdk_ijar, must be set if alternative_android_sdk_ij ar 1287 # alternative_android_sdk_ijar, must be set if alternative_android_sdk_ij ar
1282 # is used. 1288 # is used.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 # resources. 1358 # resources.
1353 # 1359 #
1354 # Variables 1360 # Variables
1355 # deps: Specifies the dependencies of this target. Java targets in this list 1361 # deps: Specifies the dependencies of this target. Java targets in this list
1356 # will be added to the javac classpath. Android resources in dependencies 1362 # will be added to the javac classpath. Android resources in dependencies
1357 # will be used when building this library. 1363 # will be used when building this library.
1358 # jar_path: Path to the prebuilt jar. 1364 # jar_path: Path to the prebuilt jar.
1359 # proguard_preprocess: If true, proguard preprocessing will be run. This can 1365 # proguard_preprocess: If true, proguard preprocessing will be run. This can
1360 # be used to remove unwanted parts of the library. 1366 # be used to remove unwanted parts of the library.
1361 # proguard_preprocess_config: Path to the proguard config for preprocessing. 1367 # proguard_preprocess_config: Path to the proguard config for preprocessing.
1368 # proguard_configs: List of proguard configs to use in final apk step for
1369 # any apk that depends on this library.
1362 # 1370 #
1363 # Example 1371 # Example
1364 # android_java_prebuilt("foo_java") { 1372 # android_java_prebuilt("foo_java") {
1365 # jar_path = "foo.jar" 1373 # jar_path = "foo.jar"
1366 # deps = [ 1374 # deps = [
1367 # ":foo_resources", 1375 # ":foo_resources",
1368 # ":bar_java" 1376 # ":bar_java"
1369 # ] 1377 # ]
1370 # } 1378 # }
1371 template("android_java_prebuilt") { 1379 template("android_java_prebuilt") {
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
1855 inputs = [ 1863 inputs = [
1856 _build_config, 1864 _build_config,
1857 _jar_path, 1865 _jar_path,
1858 ] + _proguard_configs 1866 ] + _proguard_configs
1859 1867
1860 output_jar_path = _proguard_output_jar_path 1868 output_jar_path = _proguard_output_jar_path
1861 _rebased_proguard_configs = 1869 _rebased_proguard_configs =
1862 rebase_path(_proguard_configs, root_build_dir) 1870 rebase_path(_proguard_configs, root_build_dir)
1863 args = [ 1871 args = [
1864 "--proguard-configs=$_rebased_proguard_configs", 1872 "--proguard-configs=$_rebased_proguard_configs",
1873 "--proguard-configs=@FileArg($_rebased_build_config:proguard:lib_confi gs)",
1865 "--input-paths=@FileArg($_rebased_build_config:proguard:input_paths)", 1874 "--input-paths=@FileArg($_rebased_build_config:proguard:input_paths)",
1866 "--classpath=@FileArg($_rebased_build_config:proguard:lib_paths)", 1875 "--classpath=@FileArg($_rebased_build_config:proguard:lib_paths)",
1867 ] 1876 ]
1868 if (defined(invoker.apk_under_test)) { 1877 if (defined(invoker.apk_under_test)) {
1869 deps += [ 1878 deps += [
1870 "${invoker.apk_under_test}__build_config", 1879 "${invoker.apk_under_test}__build_config",
1871 "${invoker.apk_under_test}__proguard", 1880 "${invoker.apk_under_test}__proguard",
1872 ] 1881 ]
1873 _apk_under_test_build_config = 1882 _apk_under_test_build_config =
1874 get_label_info(invoker.apk_under_test, "target_gen_dir") + "/" + 1883 get_label_info(invoker.apk_under_test, "target_gen_dir") + "/" +
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
2588 } 2597 }
2589 2598
2590 # Declare an Android library target for a prebuilt AAR. 2599 # Declare an Android library target for a prebuilt AAR.
2591 # 2600 #
2592 # This target creates an Android library containing java code and Android 2601 # This target creates an Android library containing java code and Android
2593 # resources. For libraries without resources, it will not generate 2602 # resources. For libraries without resources, it will not generate
2594 # corresponding android_resources targets. 2603 # corresponding android_resources targets.
2595 # 2604 #
2596 # Variables 2605 # Variables
2597 # aar_path: Path to the AAR. 2606 # aar_path: Path to the AAR.
2607 # proguard_configs: List of proguard configs to use in final apk step for
2608 # any apk that depends on this library.
2598 # TODO(jbudorick@): remove this arguments after crbug.com/522043 is fixed. 2609 # TODO(jbudorick@): remove this arguments after crbug.com/522043 is fixed.
2599 # requires_android: Whether this target can only be used for compiling Andro id related targets. 2610 # requires_android: Whether this target can only be used for compiling Andro id related targets.
2600 # 2611 #
2601 # Example 2612 # Example
2602 # android_aar_prebuilt("foo_java") { 2613 # android_aar_prebuilt("foo_java") {
2603 # aar_path = "foo.aar" 2614 # aar_path = "foo.aar"
2604 # } 2615 # }
2605 template("android_aar_prebuilt") { 2616 template("android_aar_prebuilt") {
2606 assert(defined(invoker.aar_path)) 2617 assert(defined(invoker.aar_path))
2607 _output_path = "${target_gen_dir}/${target_name}" 2618 _output_path = "${target_gen_dir}/${target_name}"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
2674 _counter = 0 2685 _counter = 0
2675 foreach(jar, _scanned_files.jars) { 2686 foreach(jar, _scanned_files.jars) {
2676 _counter += 1 2687 _counter += 1
2677 _current_target = "${target_name}__jar_$_counter" 2688 _current_target = "${target_name}__jar_$_counter"
2678 _jar_targets += [ ":$_current_target" ] 2689 _jar_targets += [ ":$_current_target" ]
2679 java_prebuilt(_current_target) { 2690 java_prebuilt(_current_target) {
2680 forward_variables_from(invoker, 2691 forward_variables_from(invoker,
2681 [ 2692 [
2682 "deps", 2693 "deps",
2683 "input_jars_paths", 2694 "input_jars_paths",
2695 "jar_excluded_patterns",
2696 "proguard_configs",
2684 "requires_android", 2697 "requires_android",
2685 "jar_excluded_patterns",
2686 ]) 2698 ])
2687 if (!defined(deps)) { 2699 if (!defined(deps)) {
2688 deps = [] 2700 deps = []
2689 } 2701 }
2690 deps += _resource_targets + [ ":$_unpack_target_name" ] 2702 deps += _resource_targets + [ ":$_unpack_target_name" ]
2691 if (!defined(requires_android)) { 2703 if (!defined(requires_android)) {
2692 requires_android = true 2704 requires_android = true
2693 } 2705 }
2694 supports_android = true 2706 supports_android = true
2695 jar_path = "${_output_path}/$jar" 2707 jar_path = "${_output_path}/$jar"
2696 } 2708 }
2697 } 2709 }
2698 2710
2699 java_group(target_name) { 2711 java_group(target_name) {
2700 deps = _resource_targets + _jar_targets 2712 deps = _resource_targets + _jar_targets
2701 } 2713 }
2702 } 2714 }
2703 } 2715 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698