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

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

Issue 2474053003: GN: Allow java_* to set their .jar name (Closed)
Patch Set: Implement output_name for java targets Created 4 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
« no previous file with comments | « build/config/android/internal_rules.gni ('k') | components/cronet/android/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 # Do not add any imports to non-//build directories here. 5 # Do not add any imports to non-//build directories here.
6 # Some projects (e.g. V8) do not have non-build directories DEPS'ed in. 6 # Some projects (e.g. V8) do not have non-build directories DEPS'ed in.
7 import("//build/config/android/config.gni") 7 import("//build/config/android/config.gni")
8 import("//build/config/android/internal_rules.gni") 8 import("//build/config/android/internal_rules.gni")
9 import("//build/config/compiler/compiler.gni") 9 import("//build/config/compiler/compiler.gni")
10 import("//build/config/dcheck_always_on.gni") 10 import("//build/config/dcheck_always_on.gni")
(...skipping 1042 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 _test_runner_target_name = "${target_name}__test_runner_script" 1053 _test_runner_target_name = "${target_name}__test_runner_script"
1054 1054
1055 test_runner_script(_test_runner_target_name) { 1055 test_runner_script(_test_runner_target_name) {
1056 test_name = invoker.target_name 1056 test_name = invoker.target_name
1057 test_suite = invoker.target_name 1057 test_suite = invoker.target_name
1058 test_type = "junit" 1058 test_type = "junit"
1059 } 1059 }
1060 1060
1061 java_binary(_java_binary_target_name) { 1061 java_binary(_java_binary_target_name) {
1062 deps = [] 1062 deps = []
1063 jar_name = invoker.target_name 1063 output_name = invoker.target_name
1064 forward_variables_from(invoker, "*") 1064 forward_variables_from(invoker, "*")
1065 testonly = true 1065 testonly = true
1066 bypass_platform_checks = true 1066 bypass_platform_checks = true
1067 main_class = "org.chromium.testing.local.JunitTestMain" 1067 main_class = "org.chromium.testing.local.JunitTestMain"
1068 wrapper_script_name = "helper/$target_name" 1068 wrapper_script_name = "helper/$target_name"
1069 deps += [ 1069 deps += [
1070 "//testing/android/junit:junit_test_support", 1070 "//testing/android/junit:junit_test_support",
1071 "//third_party/junit", 1071 "//third_party/junit",
1072 "//third_party/mockito:mockito_java", 1072 "//third_party/mockito:mockito_java",
1073 "//third_party/robolectric:robolectric_all_java", 1073 "//third_party/robolectric:robolectric_all_java",
(...skipping 24 matching lines...) Expand all
1098 # appear in deps. 1098 # appear in deps.
1099 # 1099 #
1100 # chromium_code: If true, extra analysis warning/errors will be enabled. 1100 # chromium_code: If true, extra analysis warning/errors will be enabled.
1101 # enable_errorprone: If true, enables the errorprone compiler. 1101 # enable_errorprone: If true, enables the errorprone compiler.
1102 # enable_incremental_javac_override: Overrides the global 1102 # enable_incremental_javac_override: Overrides the global
1103 # enable_incremental_javac. 1103 # enable_incremental_javac.
1104 # 1104 #
1105 # jar_excluded_patterns: List of patterns of .class files to exclude from th e 1105 # jar_excluded_patterns: List of patterns of .class files to exclude from th e
1106 # final jar. 1106 # final jar.
1107 # 1107 #
1108 # output_name: File name for the output .jar (not including extension).
1109 # Defaults to the input .jar file name.
1110 #
1108 # proguard_preprocess: If true, proguard preprocessing will be run. This can 1111 # proguard_preprocess: If true, proguard preprocessing will be run. This can
1109 # be used to remove unwanted parts of the library. 1112 # be used to remove unwanted parts of the library.
1110 # proguard_preprocess_config: Path to the proguard config for preprocessing. 1113 # proguard_preprocess_config: Path to the proguard config for preprocessing.
1111 # proguard_configs: List of proguard configs to use in final apk step for 1114 # proguard_configs: List of proguard configs to use in final apk step for
1112 # any apk that depends on this library. 1115 # any apk that depends on this library.
1113 # 1116 #
1114 # supports_android: If true, Android targets (android_library, android_apk) 1117 # supports_android: If true, Android targets (android_library, android_apk)
1115 # may depend on this target. Note: if true, this target must only use the 1118 # may depend on this target. Note: if true, this target must only use the
1116 # subset of Java available on Android. 1119 # subset of Java available on Android.
1117 # bypass_platform_checks: Disables checks about cross-platform (Java/Android ) 1120 # bypass_platform_checks: Disables checks about cross-platform (Java/Android )
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 } 1152 }
1150 } 1153 }
1151 1154
1152 # Declare a java library target for a prebuilt jar 1155 # Declare a java library target for a prebuilt jar
1153 # 1156 #
1154 # Variables 1157 # Variables
1155 # deps: Specifies the dependencies of this target. Java targets in this list 1158 # deps: Specifies the dependencies of this target. Java targets in this list
1156 # will be added to the javac classpath. 1159 # will be added to the javac classpath.
1157 # jar_path: Path to the prebuilt jar. 1160 # jar_path: Path to the prebuilt jar.
1158 # jar_dep: Target that builds jar_path (optional). 1161 # jar_dep: Target that builds jar_path (optional).
1162 # output_name: File name for the output .jar (not including extension).
1163 # Defaults to the input .jar file name.
1159 # proguard_preprocess: If true, proguard preprocessing will be run. This can 1164 # proguard_preprocess: If true, proguard preprocessing will be run. This can
1160 # be used to remove unwanted parts of the library. 1165 # be used to remove unwanted parts of the library.
1161 # proguard_preprocess_config: Path to the proguard config for preprocessing. 1166 # proguard_preprocess_config: Path to the proguard config for preprocessing.
1162 # proguard_configs: List of proguard configs to use in final apk step for 1167 # proguard_configs: List of proguard configs to use in final apk step for
1163 # any apk that depends on this library. 1168 # any apk that depends on this library.
1164 # supports_android: If true, Android targets (android_library, android_apk) 1169 # supports_android: If true, Android targets (android_library, android_apk)
1165 # may depend on this target. Note: if true, this target must only use the 1170 # may depend on this target. Note: if true, this target must only use the
1166 # subset of Java available on Android. 1171 # subset of Java available on Android.
1167 # 1172 #
1168 # Example 1173 # Example
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 # 1212 #
1208 # jar_excluded_patterns: List of patterns of .class files to exclude from th e 1213 # jar_excluded_patterns: List of patterns of .class files to exclude from th e
1209 # final jar. 1214 # final jar.
1210 # 1215 #
1211 # proguard_preprocess: If true, proguard preprocessing will be run. This can 1216 # proguard_preprocess: If true, proguard preprocessing will be run. This can
1212 # be used to remove unwanted parts of the library. 1217 # be used to remove unwanted parts of the library.
1213 # proguard_preprocess_config: Path to the proguard config for preprocessing. 1218 # proguard_preprocess_config: Path to the proguard config for preprocessing.
1214 # proguard_configs: List of proguard configs to use in final apk step for 1219 # proguard_configs: List of proguard configs to use in final apk step for
1215 # any apk that depends on this library. 1220 # any apk that depends on this library.
1216 # 1221 #
1222 # output_name: File name for the output .jar (not including extension).
1223 # Defaults to the input .jar file name.
1217 # dex_path: If set, the resulting .dex.jar file will be placed under this 1224 # dex_path: If set, the resulting .dex.jar file will be placed under this
1218 # path. 1225 # path.
1219 # 1226 #
1220 # alternative_android_sdk_ijar: if set, the given android_sdk_ijar file 1227 # alternative_android_sdk_ijar: if set, the given android_sdk_ijar file
1221 # replaces the default android_sdk_ijar. 1228 # replaces the default android_sdk_ijar.
1222 # 1229 #
1223 # alternative_android_sdk_ijar_dep: the target that generates 1230 # alternative_android_sdk_ijar_dep: the target that generates
1224 # alternative_android_sdk_ijar, must be set if alternative_android_sdk_ij ar 1231 # alternative_android_sdk_ijar, must be set if alternative_android_sdk_ij ar
1225 # is used. 1232 # is used.
1226 # 1233 #
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1292 # Declare an Android library target for a prebuilt jar 1299 # Declare an Android library target for a prebuilt jar
1293 # 1300 #
1294 # This target creates an Android library containing java code and Android 1301 # This target creates an Android library containing java code and Android
1295 # resources. 1302 # resources.
1296 # 1303 #
1297 # Variables 1304 # Variables
1298 # deps: Specifies the dependencies of this target. Java targets in this list 1305 # deps: Specifies the dependencies of this target. Java targets in this list
1299 # will be added to the javac classpath. Android resources in dependencies 1306 # will be added to the javac classpath. Android resources in dependencies
1300 # will be used when building this library. 1307 # will be used when building this library.
1301 # jar_path: Path to the prebuilt jar. 1308 # jar_path: Path to the prebuilt jar.
1309 # output_name: File name for the output .jar (not including extension).
1310 # Defaults to the input .jar file name.
1302 # proguard_preprocess: If true, proguard preprocessing will be run. This can 1311 # proguard_preprocess: If true, proguard preprocessing will be run. This can
1303 # be used to remove unwanted parts of the library. 1312 # be used to remove unwanted parts of the library.
1304 # proguard_preprocess_config: Path to the proguard config for preprocessing. 1313 # proguard_preprocess_config: Path to the proguard config for preprocessing.
1305 # proguard_configs: List of proguard configs to use in final apk step for 1314 # proguard_configs: List of proguard configs to use in final apk step for
1306 # any apk that depends on this library. 1315 # any apk that depends on this library.
1307 # 1316 #
1308 # Example 1317 # Example
1309 # android_java_prebuilt("foo_java") { 1318 # android_java_prebuilt("foo_java") {
1310 # jar_path = "foo.jar" 1319 # jar_path = "foo.jar"
1311 # deps = [ 1320 # deps = [
(...skipping 1394 matching lines...) Expand 10 before | Expand all | Expand 10 after
2706 "requires_android", 2715 "requires_android",
2707 ]) 2716 ])
2708 deps = [ 2717 deps = [
2709 ":$_unpack_target_name", 2718 ":$_unpack_target_name",
2710 ] 2719 ]
2711 if (!defined(requires_android)) { 2720 if (!defined(requires_android)) {
2712 requires_android = true 2721 requires_android = true
2713 } 2722 }
2714 supports_android = true 2723 supports_android = true
2715 jar_path = "$_output_path/${_tuple[1]}" 2724 jar_path = "$_output_path/${_tuple[1]}"
2725 _base_output_name = get_path_info(jar_path, "name")
2726 output_name = "${invoker.target_name}-$_base_output_name"
2716 } 2727 }
2717 } 2728 }
2718 2729
2719 # Create android_java_prebuilt target for classes.jar. 2730 # Create android_java_prebuilt target for classes.jar.
2720 if (_scanned_files.has_classes_jar) { 2731 if (_scanned_files.has_classes_jar) {
2721 _jar_target_name = "${target_name}__classes" 2732 _jar_target_name = "${target_name}__classes"
2722 java_prebuilt(_jar_target_name) { 2733 java_prebuilt(_jar_target_name) {
2723 forward_variables_from(invoker, 2734 forward_variables_from(invoker,
2724 [ 2735 [
2725 "deps", 2736 "deps",
2726 "input_jars_paths", 2737 "input_jars_paths",
2727 "jar_excluded_patterns", 2738 "jar_excluded_patterns",
2728 "proguard_configs", 2739 "proguard_configs",
2729 "requires_android", 2740 "requires_android",
2730 ]) 2741 ])
2731 if (!defined(deps)) { 2742 if (!defined(deps)) {
2732 deps = [] 2743 deps = []
2733 } 2744 }
2734 deps += _subjar_targets + [ ":$_unpack_target_name" ] 2745 deps += _subjar_targets + [ ":$_unpack_target_name" ]
2735 if (defined(_res_target_name)) { 2746 if (defined(_res_target_name)) {
2736 deps += [ ":$_res_target_name" ] 2747 deps += [ ":$_res_target_name" ]
2737 } 2748 }
2738 if (!defined(requires_android)) { 2749 if (!defined(requires_android)) {
2739 requires_android = true 2750 requires_android = true
2740 } 2751 }
2741 supports_android = true 2752 supports_android = true
2742 jar_path = "$_output_path/classes.jar" 2753 jar_path = "$_output_path/classes.jar"
2754 output_name = invoker.target_name
2743 2755
2744 if (_scanned_files.has_proguard_flags) { 2756 if (_scanned_files.has_proguard_flags) {
2745 if (!defined(proguard_configs)) { 2757 if (!defined(proguard_configs)) {
2746 proguard_configs = [] 2758 proguard_configs = []
2747 } 2759 }
2748 proguard_configs += [ "$_output_path/proguard.txt" ] 2760 proguard_configs += [ "$_output_path/proguard.txt" ]
2749 } 2761 }
2750 } 2762 }
2751 } 2763 }
2752 2764
2753 java_group(target_name) { 2765 java_group(target_name) {
2754 deps = [] 2766 deps = []
2755 if (defined(_jar_target_name)) { 2767 if (defined(_jar_target_name)) {
2756 deps += [ ":$_jar_target_name" ] 2768 deps += [ ":$_jar_target_name" ]
2757 2769
2758 # Although subjars are meant to be private, we add them as deps here 2770 # Although subjars are meant to be private, we add them as deps here
2759 # because in practice they seem to contain classes required to be in the 2771 # because in practice they seem to contain classes required to be in the
2760 # classpath. 2772 # classpath.
2761 deps += _subjar_targets 2773 deps += _subjar_targets
2762 } 2774 }
2763 if (defined(_res_target_name)) { 2775 if (defined(_res_target_name)) {
2764 deps += [ ":$_res_target_name" ] 2776 deps += [ ":$_res_target_name" ]
2765 } 2777 }
2766 } 2778 }
2767 } 2779 }
2768 } 2780 }
OLDNEW
« no previous file with comments | « build/config/android/internal_rules.gni ('k') | components/cronet/android/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698