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

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

Issue 2623243002: android: Create a GN template for create_dist_jar.py (Closed)
Patch Set: interface jars condition was inverted Created 3 years, 11 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
« no previous file with comments | « build/config/android/internal_rules.gni ('k') | no next file » | 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 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 # ":bar_java" 1188 # ":bar_java"
1189 # ] 1189 # ]
1190 # } 1190 # }
1191 template("java_prebuilt") { 1191 template("java_prebuilt") {
1192 set_sources_assignment_filter([]) 1192 set_sources_assignment_filter([])
1193 java_prebuilt_impl(target_name) { 1193 java_prebuilt_impl(target_name) {
1194 forward_variables_from(invoker, "*") 1194 forward_variables_from(invoker, "*")
1195 } 1195 }
1196 } 1196 }
1197 1197
1198 # Combines all dependent .jar files into a single .jar file.
1199 #
1200 # Variables:
1201 # output: Path to the output jar.
1202 # override_build_config: Use a pre-existing .build_config. Must be of type
1203 # "apk".
1204 # use_interface_jars: Use all dependent interface .jars rather than
1205 # implementation .jars.
1206 # direct_deps_only: Do not recurse on deps.
1207 # data, deps, testonly, visibility: Usual meaning.
1208 #
1209 # Example
1210 # dist_jar("lib_fatjar") {
1211 # deps = [ ":my_java_lib" ]
1212 # }
1213 template("dist_jar") {
1214 if (defined(invoker.override_build_config)) {
1215 _build_config = invoker.override_build_config
1216 } else {
1217 _build_config = "$target_gen_dir/$target_name.build_config"
1218 _build_config_target_name = "${target_name}__build_config"
1219
1220 write_build_config(_build_config_target_name) {
1221 forward_variables_from(invoker, [ "testonly" ])
1222 type = "dist_jar"
1223 if (defined(invoker.deps)) {
1224 possible_config_deps = invoker.deps
1225 }
1226 build_config = _build_config
1227 }
1228 }
1229
1230 action(target_name) {
1231 forward_variables_from(invoker,
1232 [
1233 "data",
1234 "deps",
1235 "testonly",
1236 "visibility",
1237 ])
1238 script = "//build/android/gyp/create_dist_jar.py"
1239 depfile = "$target_gen_dir/$target_name.d"
1240
1241 inputs = [
1242 _build_config,
1243 ]
1244
1245 outputs = [
1246 invoker.output,
1247 ]
1248
1249 if (defined(_build_config_target_name)) {
1250 deps += [ ":$_build_config_target_name" ]
1251 }
1252
1253 args = [
1254 "--depfile",
1255 rebase_path(depfile, root_build_dir),
1256 "--output",
1257 rebase_path(invoker.output, root_build_dir),
1258 ]
1259
1260 _rebased_build_config = rebase_path(_build_config, root_build_dir)
1261 if (defined(invoker.direct_deps_only) && invoker.direct_deps_only) {
1262 if (defined(invoker.use_interface_jars) && invoker.use_interface_jars) {
1263 args += [ "--inputs=@FileArg($_rebased_build_config:javac:interface_cl asspath)" ]
1264 } else {
1265 args +=
1266 [ "--inputs=@FileArg($_rebased_build_config:javac:classpath)" ]
1267 }
1268 } else {
1269 if (defined(invoker.use_interface_jars) && invoker.use_interface_jars) {
1270 args += [ "--inputs=@FileArg($_rebased_build_config:dist_jar:all_inter face_jars)" ]
1271 } else {
1272 args += [ "--inputs=@FileArg($_rebased_build_config:dist_jar:dependenc y_jars)" ]
1273 }
1274 }
1275 }
1276 }
1277
1198 # Declare an Android library target 1278 # Declare an Android library target
1199 # 1279 #
1200 # This target creates an Android library containing java code and Android 1280 # This target creates an Android library containing java code and Android
1201 # resources. 1281 # resources.
1202 # 1282 #
1203 # Variables 1283 # Variables
1204 # deps: Specifies the dependencies of this target. Java targets in this list 1284 # deps: Specifies the dependencies of this target. Java targets in this list
1205 # will be added to the javac classpath. Android resources in dependencies 1285 # will be added to the javac classpath. Android resources in dependencies
1206 # will be used when building this library. 1286 # will be used when building this library.
1207 # 1287 #
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after
1825 if (emma_coverage && !_emma_never_instrument) { 1905 if (emma_coverage && !_emma_never_instrument) {
1826 deps += [ "//third_party/android_tools:emma_device_java" ] 1906 deps += [ "//third_party/android_tools:emma_device_java" ]
1827 } 1907 }
1828 } 1908 }
1829 1909
1830 # TODO(cjhopman): This is only ever needed to calculate the list of tests to 1910 # TODO(cjhopman): This is only ever needed to calculate the list of tests to
1831 # run. See build/android/pylib/instrumentation/test_jar.py. We should be 1911 # run. See build/android/pylib/instrumentation/test_jar.py. We should be
1832 # able to just do that calculation at build time instead. 1912 # able to just do that calculation at build time instead.
1833 if (defined(invoker.dist_ijar_path)) { 1913 if (defined(invoker.dist_ijar_path)) {
1834 _dist_ijar_path = invoker.dist_ijar_path 1914 _dist_ijar_path = invoker.dist_ijar_path
1835 action("${_template_name}_dist_ijar") { 1915 dist_jar("${_template_name}_dist_ijar") {
1836 script = "//build/android/gyp/create_dist_jar.py" 1916 override_build_config = _build_config
1837 depfile = "$target_gen_dir/$target_name.d" 1917 output = _dist_ijar_path
1838 inputs = [
1839 _build_config,
1840 ]
1841 outputs = [
1842 "${_dist_ijar_path}",
1843 ]
1844 data = [ 1918 data = [
1845 _dist_ijar_path, 1919 _dist_ijar_path,
1846 ] 1920 ]
1847 args = [ 1921 use_interface_jars = true
1848 "--depfile",
1849 rebase_path(depfile, root_build_dir),
1850 "--output",
1851 rebase_path("${_dist_ijar_path}", root_build_dir),
1852 "--inputs=@FileArg($_rebased_build_config:dist_jar:all_interface_jars) ",
1853 ]
1854 deps = [ 1922 deps = [
1855 ":$build_config_target", # Generates the build config file. 1923 ":$build_config_target",
1856 ":$java_target", # Generates the jar file. 1924 ":$java_target",
1857 ] 1925 ]
1858 } 1926 }
1859 } 1927 }
1860 1928
1861 if (_proguard_enabled) { 1929 if (_proguard_enabled) {
1862 _proguard_configs = [ _generated_proguard_config ] 1930 _proguard_configs = [ _generated_proguard_config ]
1863 if (defined(invoker.proguard_configs)) { 1931 if (defined(invoker.proguard_configs)) {
1864 _proguard_configs += invoker.proguard_configs 1932 _proguard_configs += invoker.proguard_configs
1865 } 1933 }
1866 assert(_proguard_configs != []) # Mark as used. 1934 assert(_proguard_configs != []) # Mark as used.
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after
2841 # because in practice they seem to contain classes required to be in the 2909 # because in practice they seem to contain classes required to be in the
2842 # classpath. 2910 # classpath.
2843 deps += _subjar_targets 2911 deps += _subjar_targets
2844 } 2912 }
2845 if (defined(_res_target_name)) { 2913 if (defined(_res_target_name)) {
2846 deps += [ ":$_res_target_name" ] 2914 deps += [ ":$_res_target_name" ]
2847 } 2915 }
2848 } 2916 }
2849 } 2917 }
2850 } 2918 }
OLDNEW
« no previous file with comments | « build/config/android/internal_rules.gni ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698