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

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

Issue 1288023003: Create *_managed targets for android_apk()s (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix gn gen Created 5 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
« 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 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/toolchain/toolchain.gni") 8 import("//build/toolchain/toolchain.gni")
9 import("//third_party/android_platform/config.gni") 9 import("//third_party/android_platform/config.gni")
10 import("//tools/grit/grit_rule.gni") 10 import("//tools/grit/grit_rule.gni")
(...skipping 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1155 if (defined(invoker.final_apk_path)) { 1155 if (defined(invoker.final_apk_path)) {
1156 _final_apk_path = invoker.final_apk_path 1156 _final_apk_path = invoker.final_apk_path
1157 } else if (defined(invoker.apk_name)) { 1157 } else if (defined(invoker.apk_name)) {
1158 _final_apk_path = "$root_build_dir/apks/" + invoker.apk_name + ".apk" 1158 _final_apk_path = "$root_build_dir/apks/" + invoker.apk_name + ".apk"
1159 } 1159 }
1160 _dist_jar_path_list = 1160 _dist_jar_path_list =
1161 process_file_template( 1161 process_file_template(
1162 [ _final_apk_path ], 1162 [ _final_apk_path ],
1163 "$root_build_dir/test.lib.java/{{source_name_part}}.jar") 1163 "$root_build_dir/test.lib.java/{{source_name_part}}.jar")
1164 _dist_jar_path = _dist_jar_path_list[0] 1164 _dist_jar_path = _dist_jar_path_list[0]
1165 _final_apk_path_no_ext_list =
1166 process_file_template([ _final_apk_path ],
1167 "{{source_dir}}/{{source_name_part}}")
1168 _final_apk_path_no_ext = _final_apk_path_no_ext_list[0]
1169 assert(_final_apk_path_no_ext != "") # Mark as used.
1165 1170
1166 _native_libs = [] 1171 _native_libs = []
1167 1172
1168 _version_code = "1" 1173 _version_code = "1"
1169 if (defined(invoker.version_code)) { 1174 if (defined(invoker.version_code)) {
1170 _version_code = invoker.version_code 1175 _version_code = invoker.version_code
1171 } 1176 }
1172 1177
1173 _version_name = "Developer Build" 1178 _version_name = "Developer Build"
1174 if (defined(invoker.version_name)) { 1179 if (defined(invoker.version_name)) {
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 android_manifest = _android_manifest 1285 android_manifest = _android_manifest
1281 1286
1282 deps = _chromium_linker_dep + _android_manifest_deps 1287 deps = _chromium_linker_dep + _android_manifest_deps
1283 if (defined(invoker.deps)) { 1288 if (defined(invoker.deps)) {
1284 deps += invoker.deps 1289 deps += invoker.deps
1285 } 1290 }
1286 1291
1287 native_libs = _native_libs 1292 native_libs = _native_libs
1288 } 1293 }
1289 1294
1290 final_deps = [] 1295 _final_deps = []
1296 _incremental_final_deps = []
1291 1297
1292 process_resources_target = "${_template_name}__process_resources" 1298 process_resources_target = "${_template_name}__process_resources"
1293 final_deps += [ ":$process_resources_target" ]
1294 process_resources(process_resources_target) { 1299 process_resources(process_resources_target) {
1295 forward_variables_from(invoker, [ "include_all_resources" ]) 1300 forward_variables_from(invoker, [ "include_all_resources" ])
1296 srcjar_path = "${target_gen_dir}/${target_name}.srcjar" 1301 srcjar_path = "${target_gen_dir}/${target_name}.srcjar"
1297 r_text_path = "${target_gen_dir}/${target_name}_R.txt" 1302 r_text_path = "${target_gen_dir}/${target_name}_R.txt"
1298 android_manifest = _android_manifest 1303 android_manifest = _android_manifest
1299 resource_dirs = [ "//build/android/ant/empty/res" ] 1304 resource_dirs = [ "//build/android/ant/empty/res" ]
1300 zip_path = resources_zip_path 1305 zip_path = resources_zip_path
1301 all_resources_zip_path = _all_resources_zip_path 1306 all_resources_zip_path = _all_resources_zip_path
1302 generate_constant_ids = true 1307 generate_constant_ids = true
1303 1308
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1342 defines += [ "ENABLE_CHROMIUM_LINKER_LIBRARY_IN_ZIP_FILE" ] 1347 defines += [ "ENABLE_CHROMIUM_LINKER_LIBRARY_IN_ZIP_FILE" ]
1343 } 1348 }
1344 if (_enable_chromium_linker_tests) { 1349 if (_enable_chromium_linker_tests) {
1345 defines += [ "ENABLE_CHROMIUM_LINKER_TESTS" ] 1350 defines += [ "ENABLE_CHROMIUM_LINKER_TESTS" ]
1346 } 1351 }
1347 } 1352 }
1348 _srcjar_deps += [ ":${_template_name}__native_libraries_java" ] 1353 _srcjar_deps += [ ":${_template_name}__native_libraries_java" ]
1349 } 1354 }
1350 1355
1351 java_target = "${_template_name}__java" 1356 java_target = "${_template_name}__java"
1352 final_deps += [ ":$java_target" ]
1353 java_library_impl(java_target) { 1357 java_library_impl(java_target) {
1354 forward_variables_from(invoker, [ "run_findbugs" ]) 1358 forward_variables_from(invoker, [ "run_findbugs" ])
1355 supports_android = true 1359 supports_android = true
1356 requires_android = true 1360 requires_android = true
1357 override_build_config = _build_config 1361 override_build_config = _build_config
1358 deps = _android_manifest_deps + [ ":$build_config_target" ] 1362 deps = _android_manifest_deps + [ ":$build_config_target" ]
1359 1363
1360 android_manifest = _android_manifest 1364 android_manifest = _android_manifest
1361 chromium_code = true 1365 chromium_code = true
1362 if (defined(invoker.java_files)) { 1366 if (defined(invoker.java_files)) {
1363 java_files = invoker.java_files 1367 java_files = invoker.java_files
1364 } else if (defined(invoker.DEPRECATED_java_in_dir)) { 1368 } else if (defined(invoker.DEPRECATED_java_in_dir)) {
1365 DEPRECATED_java_in_dir = invoker.DEPRECATED_java_in_dir 1369 DEPRECATED_java_in_dir = invoker.DEPRECATED_java_in_dir
1366 } else { 1370 } else {
1367 java_files = [] 1371 java_files = []
1368 } 1372 }
1369 srcjar_deps = _srcjar_deps 1373 srcjar_deps = _srcjar_deps
1370 dex_path = base_path + ".dex.jar" 1374 dex_path = base_path + ".dex.jar"
1371 1375
1372 if (defined(invoker.deps)) { 1376 if (defined(invoker.deps)) {
1373 deps += invoker.deps 1377 deps += invoker.deps
1374 } 1378 }
1375 } 1379 }
1376 1380
1377 if (_dist_jar_path != "") { 1381 if (_dist_jar_path != "") {
1378 create_dist_target = "${_template_name}__create_dist_jar" 1382 create_dist_target = "${_template_name}__create_dist_jar"
1379 final_deps += [ ":$create_dist_target" ] 1383 _final_deps += [ ":$create_dist_target" ]
1384 _incremental_final_deps += [ ":$create_dist_target" ]
1380 1385
1381 # TODO(cjhopman): This is only ever needed to calculate the list of tests to 1386 # TODO(cjhopman): This is only ever needed to calculate the list of tests to
1382 # run. See build/android/pylib/instrumentation/test_jar.py. We should be 1387 # run. See build/android/pylib/instrumentation/test_jar.py. We should be
1383 # able to just do that calculation at build time instead. 1388 # able to just do that calculation at build time instead.
1384 action(create_dist_target) { 1389 action(create_dist_target) {
1385 script = "//build/android/gyp/create_dist_jar.py" 1390 script = "//build/android/gyp/create_dist_jar.py"
1386 depfile = "$target_gen_dir/$target_name.d" 1391 depfile = "$target_gen_dir/$target_name.d"
1387 inputs = [ 1392 inputs = [
1388 _build_config, 1393 _build_config,
1389 ] 1394 ]
(...skipping 11 matching lines...) Expand all
1401 inputs += [ jar_path ] 1406 inputs += [ jar_path ]
1402 _rebased_jar_path = rebase_path([ jar_path ], root_build_dir) 1407 _rebased_jar_path = rebase_path([ jar_path ], root_build_dir)
1403 args += [ "--inputs=$_rebased_jar_path" ] 1408 args += [ "--inputs=$_rebased_jar_path" ]
1404 deps = [ 1409 deps = [
1405 ":$build_config_target", # Generates the build config file. 1410 ":$build_config_target", # Generates the build config file.
1406 ":$java_target", # Generates the jar file. 1411 ":$java_target", # Generates the jar file.
1407 ] 1412 ]
1408 } 1413 }
1409 } 1414 }
1410 1415
1411 final_deps += [ ":$final_dex_target_name" ]
1412 dex("$final_dex_target_name") { 1416 dex("$final_dex_target_name") {
1413 deps = [ 1417 deps = [
1414 ":$build_config_target", 1418 ":$build_config_target",
1415 ":$java_target", 1419 ":$java_target",
1416 ] 1420 ]
1417 sources = [ 1421 sources = [
1418 jar_path, 1422 jar_path,
1419 ] 1423 ]
1420 inputs = [ 1424 inputs = [
1421 _build_config, 1425 _build_config,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1476 } 1480 }
1477 1481
1478 if (is_debug) { 1482 if (is_debug) {
1479 rebased_gdbserver = rebase_path([ android_gdbserver ], root_build_dir) 1483 rebased_gdbserver = rebase_path([ android_gdbserver ], root_build_dir)
1480 inputs += [ android_gdbserver ] 1484 inputs += [ android_gdbserver ]
1481 args += [ "--libraries=$rebased_gdbserver" ] 1485 args += [ "--libraries=$rebased_gdbserver" ]
1482 } 1486 }
1483 } 1487 }
1484 } 1488 }
1485 1489
1486 final_deps += [ ":${_template_name}__create" ] 1490 _final_deps += [ ":${_template_name}__create" ]
1491 _incremental_final_deps += [ ":${_template_name}__create_incremental" ]
1487 create_apk("${_template_name}__create") { 1492 create_apk("${_template_name}__create") {
1488 forward_variables_from(invoker, [ "language_splits" ]) 1493 forward_variables_from(invoker, [ "language_splits" ])
1489 apk_path = _final_apk_path 1494 apk_path = _final_apk_path
1490 android_manifest = _android_manifest 1495 android_manifest = _android_manifest
1491 resources_zip = _all_resources_zip_path 1496 resources_zip = _all_resources_zip_path
1492 dex_path = final_dex_path 1497 dex_path = final_dex_path
1493 load_library_from_apk = _load_library_from_apk 1498 load_library_from_apk = _load_library_from_apk
1494 create_density_splits = _create_density_splits 1499 create_density_splits = _create_density_splits
1495 if (defined(invoker.extensions_to_not_compress)) { 1500 if (defined(invoker.extensions_to_not_compress)) {
1496 extensions_to_not_compress = invoker.extensions_to_not_compress 1501 extensions_to_not_compress = invoker.extensions_to_not_compress
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
1538 _manifest_rule = "${_template_name}__split_manifest_abi_${android_app_abi}" 1543 _manifest_rule = "${_template_name}__split_manifest_abi_${android_app_abi}"
1539 generate_split_manifest(_manifest_rule) { 1544 generate_split_manifest(_manifest_rule) {
1540 main_manifest = _android_manifest 1545 main_manifest = _android_manifest
1541 out_manifest = 1546 out_manifest =
1542 "$gen_dir/split-manifests/${android_app_abi}/AndroidManifest.xml" 1547 "$gen_dir/split-manifests/${android_app_abi}/AndroidManifest.xml"
1543 split_name = "abi_${android_app_abi}" 1548 split_name = "abi_${android_app_abi}"
1544 deps = _android_manifest_deps 1549 deps = _android_manifest_deps
1545 } 1550 }
1546 1551
1547 _apk_rule = "${_template_name}__split_apk_abi_${android_app_abi}" 1552 _apk_rule = "${_template_name}__split_apk_abi_${android_app_abi}"
1548 final_deps += [ ":$_apk_rule" ] 1553 _final_deps += [ ":$_apk_rule" ]
1554
1555 # Don't add this to _incremental_final_deps since for incremental installs
1556 # we skip abi splits altogether.
1549 create_apk(_apk_rule) { 1557 create_apk(_apk_rule) {
1550 _split_paths = process_file_template( 1558 apk_path = "${_final_apk_path_no_ext}-abi-${android_app_abi}.apk"
1551 [ _final_apk_path ],
1552 "{{source_dir}}/{{source_name_part}}-abi-${android_app_abi}.apk")
1553 apk_path = _split_paths[0]
1554 base_path = "$gen_dir/$_apk_rule" 1559 base_path = "$gen_dir/$_apk_rule"
1555 1560
1556 manifest_outputs = get_target_outputs(":${_manifest_rule}") 1561 manifest_outputs = get_target_outputs(":${_manifest_rule}")
1557 android_manifest = manifest_outputs[1] 1562 android_manifest = manifest_outputs[1]
1558 load_library_from_apk = _load_library_from_apk 1563 load_library_from_apk = _load_library_from_apk
1559 1564
1560 version_code = _version_code 1565 version_code = _version_code
1561 version_name = _version_name 1566 version_name = _version_name
1562 1567
1563 keystore_name = _keystore_name 1568 keystore_name = _keystore_name
1564 keystore_path = _keystore_path 1569 keystore_path = _keystore_path
1565 keystore_password = _keystore_password 1570 keystore_password = _keystore_password
1566 1571
1567 native_libs_dir = _native_libs_dir 1572 native_libs_dir = _native_libs_dir
1568 deps = [ 1573 deps = [
1569 ":${_template_name}__prepare_native", 1574 ":${_template_name}__prepare_native",
1570 ":${_manifest_rule}", 1575 ":${_manifest_rule}",
1571 ] 1576 ]
1572 } 1577 }
1573 } 1578 }
1574 1579
1575 group(target_name) { 1580 group(target_name) {
1576 forward_variables_from(invoker, [ "data_deps" ]) 1581 forward_variables_from(invoker, [ "data_deps" ])
1577 deps = final_deps 1582 deps = _final_deps
1583 }
1584 group("${target_name}_incremental") {
1585 deps = _incremental_final_deps
1586 if (defined(invoker.data_deps)) {
1587 data_deps = invoker.data_deps
1588 }
1578 } 1589 }
1579 } 1590 }
1580 1591
1581 # Declare an Android instrumentation test apk 1592 # Declare an Android instrumentation test apk
1582 # 1593 #
1583 # This target creates an Android instrumentation test apk. 1594 # This target creates an Android instrumentation test apk.
1584 # 1595 #
1585 # Variables 1596 # Variables
1586 # android_manifest: Path to AndroidManifest.xml. 1597 # android_manifest: Path to AndroidManifest.xml.
1587 # data_deps: List of dependencies needed at runtime. These will be built but 1598 # data_deps: List of dependencies needed at runtime. These will be built but
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
1957 1968
1958 # TODO(GYP): implement this. 1969 # TODO(GYP): implement this.
1959 template("uiautomator_test") { 1970 template("uiautomator_test") {
1960 set_sources_assignment_filter([]) 1971 set_sources_assignment_filter([])
1961 forward_variables_from(invoker, [ "testonly" ]) 1972 forward_variables_from(invoker, [ "testonly" ])
1962 assert(target_name != "") 1973 assert(target_name != "")
1963 assert(invoker.deps != [] || true) 1974 assert(invoker.deps != [] || true)
1964 group(target_name) { 1975 group(target_name) {
1965 } 1976 }
1966 } 1977 }
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