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

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

Issue 2562063003: Add incremental_apk_by_default GN arg. (Closed)
Patch Set: Remove error formatting Created 4 years 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') | chrome/android/chrome_public_apk_tmpl.gni » ('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 1381 matching lines...) Expand 10 before | Expand all | Expand 10 after
1392 # all other asset files. 1392 # all other asset files.
1393 # requires_sdk_api_level_23: If defined and true, the apk is intended for 1393 # requires_sdk_api_level_23: If defined and true, the apk is intended for
1394 # installation only on Android M or later. In these releases the system 1394 # installation only on Android M or later. In these releases the system
1395 # linker does relocation unpacking, so we can enable it unconditionally. 1395 # linker does relocation unpacking, so we can enable it unconditionally.
1396 # secondary_native_libs (deprecated): The path of native libraries for secon dary 1396 # secondary_native_libs (deprecated): The path of native libraries for secon dary
1397 # app abi. 1397 # app abi.
1398 # run_findbugs_override: Forces run_findbugs on or off. If undefined, the 1398 # run_findbugs_override: Forces run_findbugs on or off. If undefined, the
1399 # default will use the build arg run_findbugs. 1399 # default will use the build arg run_findbugs.
1400 # proguard_jar_path: The path to proguard.jar you wish to use. If undefined, 1400 # proguard_jar_path: The path to proguard.jar you wish to use. If undefined,
1401 # the proguard used will be the checked in one in //third_party/proguard. 1401 # the proguard used will be the checked in one in //third_party/proguard.
1402 # never_incremental: If true, |incremental_apk_by_default| will be ignored.
1402 # 1403 #
1403 # Example 1404 # Example
1404 # android_apk("foo_apk") { 1405 # android_apk("foo_apk") {
1405 # android_manifest = "AndroidManifest.xml" 1406 # android_manifest = "AndroidManifest.xml"
1406 # java_files = [ 1407 # java_files = [
1407 # "android/org/chromium/foo/FooApplication.java", 1408 # "android/org/chromium/foo/FooApplication.java",
1408 # "android/org/chromium/foo/FooActivity.java", 1409 # "android/org/chromium/foo/FooActivity.java",
1409 # ] 1410 # ]
1410 # deps = [ 1411 # deps = [
1411 # ":foo_support_java" 1412 # ":foo_support_java"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1456 process_file_template([ _final_apk_path ], 1457 process_file_template([ _final_apk_path ],
1457 "{{source_dir}}/{{source_name_part}}") 1458 "{{source_dir}}/{{source_name_part}}")
1458 _final_apk_path_no_ext = _final_apk_path_no_ext_list[0] 1459 _final_apk_path_no_ext = _final_apk_path_no_ext_list[0]
1459 assert(_final_apk_path_no_ext != "") # Mark as used. 1460 assert(_final_apk_path_no_ext != "") # Mark as used.
1460 1461
1461 _install_script_name = "install_$_template_name" 1462 _install_script_name = "install_$_template_name"
1462 if (defined(invoker.install_script_name)) { 1463 if (defined(invoker.install_script_name)) {
1463 _install_script_name = invoker.install_script_name 1464 _install_script_name = invoker.install_script_name
1464 } 1465 }
1465 _incremental_install_script_path = 1466 _incremental_install_script_path =
1466 "${root_out_dir}/bin/${_install_script_name}_incremental" 1467 "${root_out_dir}/bin/${_install_script_name}"
1468 if (!incremental_apk_by_default) {
1469 _incremental_install_script_path =
1470 "${_incremental_install_script_path}_incremental"
1471 }
1467 1472
1468 _version_code = android_default_version_code 1473 _version_code = android_default_version_code
1469 if (defined(invoker.version_code)) { 1474 if (defined(invoker.version_code)) {
1470 _version_code = invoker.version_code 1475 _version_code = invoker.version_code
1471 } 1476 }
1472 1477
1473 _version_name = android_default_version_name 1478 _version_name = android_default_version_name
1474 if (defined(invoker.version_name)) { 1479 if (defined(invoker.version_name)) {
1475 _version_name = invoker.version_name 1480 _version_name = invoker.version_name
1476 } 1481 }
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1598 # Help GN understand that _create_abi_split is not unused (bug in GN). 1603 # Help GN understand that _create_abi_split is not unused (bug in GN).
1599 assert(_create_abi_split || true) 1604 assert(_create_abi_split || true)
1600 1605
1601 _proguard_enabled = 1606 _proguard_enabled =
1602 defined(invoker.proguard_enabled) && invoker.proguard_enabled 1607 defined(invoker.proguard_enabled) && invoker.proguard_enabled
1603 if (_proguard_enabled) { 1608 if (_proguard_enabled) {
1604 _proguard_output_jar_path = "$base_path.proguard.jar" 1609 _proguard_output_jar_path = "$base_path.proguard.jar"
1605 } 1610 }
1606 1611
1607 _emma_never_instrument = defined(invoker.testonly) && invoker.testonly 1612 _emma_never_instrument = defined(invoker.testonly) && invoker.testonly
1613 _incremental_allowed =
1614 !(defined(invoker.never_incremental) && invoker.never_incremental)
1608 1615
1609 build_config_target = "${_template_name}__build_config" 1616 build_config_target = "${_template_name}__build_config"
1610 write_build_config(build_config_target) { 1617 write_build_config(build_config_target) {
1611 forward_variables_from(invoker, [ "apk_under_test" ]) 1618 forward_variables_from(invoker, [ "apk_under_test" ])
1612 type = "android_apk" 1619 type = "android_apk"
1613 jar_path = _jar_path 1620 jar_path = _jar_path
1614 dex_path = final_dex_path 1621 dex_path = final_dex_path
1615 apk_path = _final_apk_path 1622 apk_path = _final_apk_path
1623 incremental_allowed = _incremental_allowed
1616 incremental_apk_path = "${_final_apk_path_no_ext}_incremental.apk" 1624 incremental_apk_path = "${_final_apk_path_no_ext}_incremental.apk"
1617 incremental_install_script_path = _incremental_install_script_path 1625 incremental_install_script_path = _incremental_install_script_path
1618 resources_zip = resources_zip_path 1626 resources_zip = resources_zip_path
1619 build_config = _build_config 1627 build_config = _build_config
1620 android_manifest = _android_manifest 1628 android_manifest = _android_manifest
1621 1629
1622 if (defined(_java_sources_file)) { 1630 if (defined(_java_sources_file)) {
1623 java_sources_file = _java_sources_file 1631 java_sources_file = _java_sources_file
1624 } 1632 }
1625 1633
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
1984 ] 1992 ]
1985 1993
1986 deps += _secondary_abi_native_libs_deps 1994 deps += _secondary_abi_native_libs_deps
1987 deps += [ ":$build_config_target" ] 1995 deps += [ ":$build_config_target" ]
1988 } 1996 }
1989 } 1997 }
1990 } 1998 }
1991 1999
1992 _extra_native_libs = [] 2000 _extra_native_libs = []
1993 _extra_native_libs_deps = [] 2001 _extra_native_libs_deps = []
2002 assert(_extra_native_libs_deps == []) # Mark as used.
1994 _extra_native_libs_even_when_incremental = [] 2003 _extra_native_libs_even_when_incremental = []
1995 _extra_native_libs_even_when_incremental_deps = [] 2004 _extra_native_libs_even_when_incremental_deps = []
1996 assert(_extra_native_libs_even_when_incremental_deps == []) # Mark as used. 2005 assert(_extra_native_libs_even_when_incremental_deps == []) # Mark as used.
1997 if (_native_libs_deps != []) { 2006 if (_native_libs_deps != []) {
1998 # zipalign can't align gdb_server, don't pack gdbserver temporarily. 2007 # zipalign can't align gdb_server, don't pack gdbserver temporarily.
1999 if (is_debug && (!defined(invoker.page_align_shared_libraries) || 2008 if (is_debug && (!defined(invoker.page_align_shared_libraries) ||
2000 !invoker.page_align_shared_libraries)) { 2009 !invoker.page_align_shared_libraries)) {
2001 _extra_native_libs_even_when_incremental = [ android_gdbserver ] 2010 _extra_native_libs_even_when_incremental = [ android_gdbserver ]
2002 } 2011 }
2003 2012
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
2190 } 2199 }
2191 if (_create_language_splits) { 2200 if (_create_language_splits) {
2192 args += [ "--split=${_rebased_apk_path_no_ext}-language-*.apk" ] 2201 args += [ "--split=${_rebased_apk_path_no_ext}-language-*.apk" ]
2193 } 2202 }
2194 if (_load_library_from_apk) { 2203 if (_load_library_from_apk) {
2195 args += [ "--dont-even-try=Incremental builds do not work with load_libr ary_from_apk. Try setting is_component_build=true in your GN args." ] 2204 args += [ "--dont-even-try=Incremental builds do not work with load_libr ary_from_apk. Try setting is_component_build=true in your GN args." ]
2196 } 2205 }
2197 } 2206 }
2198 2207
2199 group(target_name) { 2208 group(target_name) {
2200 forward_variables_from(invoker, 2209 if (_incremental_allowed && incremental_apk_by_default) {
2201 [ 2210 deps = [
2202 "data", 2211 ":${target_name}_incremental",
2203 "data_deps", 2212 ]
2204 ]) 2213 } else {
2205 public_deps = _final_deps 2214 forward_variables_from(invoker,
2215 [
2216 "data",
2217 "data_deps",
2218 ])
2219 public_deps = _final_deps
2206 2220
2207 # Make the proguard .mapping file easy to find by putting it beside the .a pk. 2221 # Make the proguard .mapping file easy to find by putting it beside the .apk.
2208 if (_proguard_enabled) { 2222 if (_proguard_enabled) {
2209 deps = [ 2223 deps = [
2210 ":$_copy_proguard_mapping_target", 2224 ":$_copy_proguard_mapping_target",
2225 ]
2226 }
2227 }
2228 }
2229
2230 if (_incremental_allowed) {
2231 group("${target_name}_incremental") {
2232 forward_variables_from(invoker,
2233 [
2234 "data",
2235 "data_deps",
2236 ])
2237 if (!defined(data_deps)) {
2238 data_deps = []
2239 }
2240
2241 # device/commands is used by the installer script to push files via .zip .
2242 data_deps += [ "//build/android/pylib/device/commands" ] +
2243 _native_libs_deps + _extra_native_libs_deps
2244
2245 # Since the _incremental.apk does not include use .so nor .dex from the
2246 # actual target, but instead loads them at runtime, we need to explicitl y
2247 # depend on them here.
2248 public_deps = [
2249 ":${_create_incremental_script_rule_name}",
2250 ":${_template_name}__create_incremental",
2251 ":${java_target}",
2211 ] 2252 ]
2212 } 2253 }
2213 } 2254 }
2214 group("${target_name}_incremental") {
2215 forward_variables_from(invoker,
2216 [
2217 "data",
2218 "data_deps",
2219 ])
2220 if (!defined(data_deps)) {
2221 data_deps = []
2222 }
2223
2224 # device/commands is used by the installer script to push files via .zip.
2225 data_deps += [ "//build/android/pylib/device/commands" ] +
2226 _native_libs_deps + _extra_native_libs_deps
2227
2228 # Since the _incremental.apk does not include use .so nor .dex from the
2229 # actual target, but instead loads them at runtime, we need to explicitly
2230 # depend on them here.
2231 public_deps = [
2232 ":${_create_incremental_script_rule_name}",
2233 ":${_template_name}__create_incremental",
2234 ":${java_target}",
2235 ]
2236 }
2237 } 2255 }
2238 2256
2239 # Declare an Android instrumentation test apk 2257 # Declare an Android instrumentation test apk
2240 # 2258 #
2241 # This target creates an Android instrumentation test apk. 2259 # This target creates an Android instrumentation test apk.
2242 # 2260 #
2243 # Variables 2261 # Variables
2244 # android_manifest: Path to AndroidManifest.xml. 2262 # android_manifest: Path to AndroidManifest.xml.
2245 # data_deps: List of dependencies needed at runtime. These will be built but 2263 # data_deps: List of dependencies needed at runtime. These will be built but
2246 # won't change the generated .apk in any way (in fact they may be built 2264 # won't change the generated .apk in any way (in fact they may be built
(...skipping 28 matching lines...) Expand all
2275 # ] 2293 # ]
2276 # } 2294 # }
2277 template("instrumentation_test_apk") { 2295 template("instrumentation_test_apk") {
2278 assert(defined(invoker.apk_name)) 2296 assert(defined(invoker.apk_name))
2279 testonly = true 2297 testonly = true
2280 _apk_target_name = "${target_name}__apk" 2298 _apk_target_name = "${target_name}__apk"
2281 _test_runner_target_name = "${target_name}__test_runner_script" 2299 _test_runner_target_name = "${target_name}__test_runner_script"
2282 _install_script_name = "install_$target_name" 2300 _install_script_name = "install_$target_name"
2283 _dist_ijar_path = 2301 _dist_ijar_path =
2284 "$root_build_dir/test.lib.java/" + invoker.apk_name + ".jar" 2302 "$root_build_dir/test.lib.java/" + invoker.apk_name + ".jar"
2303 _incremental_test_runner_target_name =
2304 "${_test_runner_target_name}_incremental"
2305 _incremental_test_name = "${invoker.target_name}_incremental"
2306 if (incremental_apk_by_default) {
2307 _incremental_test_runner_target_name = _test_runner_target_name
2308 _incremental_test_name = invoker.target_name
2309 }
2285 2310
2286 test_runner_script(_test_runner_target_name) { 2311 if (!incremental_apk_by_default) {
2312 test_runner_script(_test_runner_target_name) {
2313 forward_variables_from(invoker,
2314 [
2315 "additional_apks",
2316 "apk_under_test",
2317 "data",
2318 "data_deps",
2319 "deps",
2320 "ignore_all_data_deps",
2321 "public_deps",
2322 ])
2323 test_name = invoker.target_name
2324 test_type = "instrumentation"
2325 apk_target = ":$_apk_target_name"
2326 test_jar = _dist_ijar_path
2327 }
2328 }
2329 test_runner_script(_incremental_test_runner_target_name) {
2287 forward_variables_from(invoker, 2330 forward_variables_from(invoker,
2288 [ 2331 [
2289 "additional_apks", 2332 "additional_apks",
2290 "apk_under_test",
2291 "data",
2292 "data_deps",
2293 "deps",
2294 "ignore_all_data_deps",
2295 "public_deps",
2296 ])
2297 test_name = invoker.target_name
2298 test_type = "instrumentation"
2299 apk_target = ":$_apk_target_name"
2300 test_jar = _dist_ijar_path
2301 }
2302
2303 test_runner_script("${_test_runner_target_name}_incremental") {
2304 forward_variables_from(invoker,
2305 [
2306 "additional_apks",
2307 "apk_under_test", 2333 "apk_under_test",
2308 "data", 2334 "data",
2309 "data_deps", 2335 "data_deps",
2310 "deps", 2336 "deps",
2311 "ignore_all_data_deps", 2337 "ignore_all_data_deps",
2312 "public_deps", 2338 "public_deps",
2313 ]) 2339 ])
2314 test_name = "${invoker.target_name}_incremental" 2340 test_name = _incremental_test_name
2315 test_type = "instrumentation" 2341 test_type = "instrumentation"
2316 apk_target = ":$_apk_target_name" 2342 apk_target = ":$_apk_target_name"
2317 test_jar = _dist_ijar_path 2343 test_jar = _dist_ijar_path
2318 incremental_install = true 2344 incremental_install = true
2319 } 2345 }
2320 2346
2321 android_apk(_apk_target_name) { 2347 android_apk(_apk_target_name) {
2322 deps = [] 2348 deps = []
2323 data_deps = [] 2349 data_deps = []
2324 forward_variables_from(invoker, "*") 2350 forward_variables_from(invoker, "*")
(...skipping 22 matching lines...) Expand all
2347 2373
2348 dist_ijar_path = _dist_ijar_path 2374 dist_ijar_path = _dist_ijar_path
2349 if (defined(invoker.run_findbugs_override)) { 2375 if (defined(invoker.run_findbugs_override)) {
2350 # Only allow findbugs when there are java files. 2376 # Only allow findbugs when there are java files.
2351 run_findbugs_override = 2377 run_findbugs_override =
2352 invoker.run_findbugs_override && defined(invoker.java_files) 2378 invoker.run_findbugs_override && defined(invoker.java_files)
2353 } 2379 }
2354 } 2380 }
2355 2381
2356 group(target_name) { 2382 group(target_name) {
2357 public_deps = [ 2383 if (incremental_apk_by_default) {
2358 ":$_apk_target_name", 2384 deps = [
2359 ":$_test_runner_target_name", 2385 ":${target_name}_incremental",
2386 ]
2387 } else {
2388 public_deps = [
2389 ":$_apk_target_name",
2390 ":$_test_runner_target_name",
2360 2391
2361 # Required by test runner to enumerate test list. 2392 # Required by test runner to enumerate test list.
2362 ":${_apk_target_name}_dist_ijar", 2393 ":${_apk_target_name}_dist_ijar",
2363 ] 2394 ]
2364 if (defined(invoker.apk_under_test)) { 2395 if (defined(invoker.apk_under_test)) {
2365 public_deps += [ invoker.apk_under_test ] 2396 public_deps += [ invoker.apk_under_test ]
2397 }
2366 } 2398 }
2367 } 2399 }
2368 2400
2369 # TODO: Delete once recipes no longer use this target. 2401 # TODO: Delete once recipes no longer use this target.
2370 group("${target_name}_run") { 2402 group("${target_name}_run") {
2371 public_deps = [ 2403 public_deps = [
2372 ":${invoker.target_name}", 2404 ":${invoker.target_name}",
2373 ] 2405 ]
2374 } 2406 }
2375 group("${target_name}_incremental") { 2407 group("${target_name}_incremental") {
2376 public_deps = [ 2408 public_deps = [
2409 ":$_incremental_test_runner_target_name",
2377 ":${_apk_target_name}_dist_ijar", 2410 ":${_apk_target_name}_dist_ijar",
2378 ":${_apk_target_name}_incremental", 2411 ":${_apk_target_name}_incremental",
2379 ":${_test_runner_target_name}_incremental",
2380 ] 2412 ]
2381 if (defined(invoker.apk_under_test)) { 2413 if (defined(invoker.apk_under_test)) {
2382 public_deps += [ "${invoker.apk_under_test}_incremental" ] 2414 public_deps += [ "${invoker.apk_under_test}_incremental" ]
2383 } 2415 }
2384 } 2416 }
2385 } 2417 }
2386 2418
2387 # Declare an Android gtest apk 2419 # Declare an Android gtest apk
2388 # 2420 #
2389 # This target creates an Android apk for running gtest-based unittests. 2421 # This target creates an Android apk for running gtest-based unittests.
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
2782 # because in practice they seem to contain classes required to be in the 2814 # because in practice they seem to contain classes required to be in the
2783 # classpath. 2815 # classpath.
2784 deps += _subjar_targets 2816 deps += _subjar_targets
2785 } 2817 }
2786 if (defined(_res_target_name)) { 2818 if (defined(_res_target_name)) {
2787 deps += [ ":$_res_target_name" ] 2819 deps += [ ":$_res_target_name" ]
2788 } 2820 }
2789 } 2821 }
2790 } 2822 }
2791 } 2823 }
OLDNEW
« no previous file with comments | « build/config/android/internal_rules.gni ('k') | chrome/android/chrome_public_apk_tmpl.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698