OLD | NEW |
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 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1143 set_sources_assignment_filter([]) | 1143 set_sources_assignment_filter([]) |
1144 forward_variables_from(invoker, [ "testonly" ]) | 1144 forward_variables_from(invoker, [ "testonly" ]) |
1145 | 1145 |
1146 assert(defined(invoker.final_apk_path) || defined(invoker.apk_name)) | 1146 assert(defined(invoker.final_apk_path) || defined(invoker.apk_name)) |
1147 assert(defined(invoker.android_manifest)) | 1147 assert(defined(invoker.android_manifest)) |
1148 gen_dir = "$target_gen_dir/$target_name" | 1148 gen_dir = "$target_gen_dir/$target_name" |
1149 base_path = "$gen_dir/$target_name" | 1149 base_path = "$gen_dir/$target_name" |
1150 _build_config = "$target_gen_dir/$target_name.build_config" | 1150 _build_config = "$target_gen_dir/$target_name.build_config" |
1151 resources_zip_path = "$base_path.resources.zip" | 1151 resources_zip_path = "$base_path.resources.zip" |
1152 _all_resources_zip_path = "$base_path.resources.all.zip" | 1152 _all_resources_zip_path = "$base_path.resources.all.zip" |
1153 jar_path = "$base_path.jar" | 1153 _jar_path = "$base_path.jar" |
| 1154 _lib_dex_path = "$base_path.dex.jar" |
| 1155 _rebased_lib_dex_path = rebase_path(_lib_dex_path, root_build_dir) |
1154 _template_name = target_name | 1156 _template_name = target_name |
1155 | 1157 |
1156 final_dex_path = "$gen_dir/classes.dex" | 1158 final_dex_path = "$gen_dir/classes.dex" |
1157 final_dex_target_name = "${_template_name}__final_dex" | 1159 final_dex_target_name = "${_template_name}__final_dex" |
1158 | 1160 |
1159 _final_apk_path = "" | 1161 _final_apk_path = "" |
1160 if (defined(invoker.final_apk_path)) { | 1162 if (defined(invoker.final_apk_path)) { |
1161 _final_apk_path = invoker.final_apk_path | 1163 _final_apk_path = invoker.final_apk_path |
1162 } else if (defined(invoker.apk_name)) { | 1164 } else if (defined(invoker.apk_name)) { |
1163 _final_apk_path = "$root_build_dir/apks/" + invoker.apk_name + ".apk" | 1165 _final_apk_path = "$root_build_dir/apks/" + invoker.apk_name + ".apk" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1279 _create_language_splits = | 1281 _create_language_splits = |
1280 defined(invoker.language_splits) && invoker.language_splits != [] | 1282 defined(invoker.language_splits) && invoker.language_splits != [] |
1281 | 1283 |
1282 # Help GN understand that _create_abi_split is not unused (bug in GN). | 1284 # Help GN understand that _create_abi_split is not unused (bug in GN). |
1283 assert(_create_abi_split || true) | 1285 assert(_create_abi_split || true) |
1284 | 1286 |
1285 build_config_target = "${_template_name}__build_config" | 1287 build_config_target = "${_template_name}__build_config" |
1286 write_build_config(build_config_target) { | 1288 write_build_config(build_config_target) { |
1287 forward_variables_from(invoker, [ "apk_under_test" ]) | 1289 forward_variables_from(invoker, [ "apk_under_test" ]) |
1288 type = "android_apk" | 1290 type = "android_apk" |
| 1291 jar_path = _jar_path |
1289 dex_path = final_dex_path | 1292 dex_path = final_dex_path |
1290 resources_zip = resources_zip_path | 1293 resources_zip = resources_zip_path |
1291 build_config = _build_config | 1294 build_config = _build_config |
1292 android_manifest = _android_manifest | 1295 android_manifest = _android_manifest |
1293 | 1296 |
1294 deps = _chromium_linker_dep + _android_manifest_deps | 1297 deps = _chromium_linker_dep + _android_manifest_deps |
1295 if (defined(invoker.deps)) { | 1298 if (defined(invoker.deps)) { |
1296 deps += invoker.deps | 1299 deps += invoker.deps |
1297 } | 1300 } |
1298 | 1301 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1371 android_manifest = _android_manifest | 1374 android_manifest = _android_manifest |
1372 chromium_code = true | 1375 chromium_code = true |
1373 if (defined(invoker.java_files)) { | 1376 if (defined(invoker.java_files)) { |
1374 java_files = invoker.java_files | 1377 java_files = invoker.java_files |
1375 } else if (defined(invoker.DEPRECATED_java_in_dir)) { | 1378 } else if (defined(invoker.DEPRECATED_java_in_dir)) { |
1376 DEPRECATED_java_in_dir = invoker.DEPRECATED_java_in_dir | 1379 DEPRECATED_java_in_dir = invoker.DEPRECATED_java_in_dir |
1377 } else { | 1380 } else { |
1378 java_files = [] | 1381 java_files = [] |
1379 } | 1382 } |
1380 srcjar_deps = _srcjar_deps | 1383 srcjar_deps = _srcjar_deps |
1381 dex_path = base_path + ".dex.jar" | 1384 jar_path = _jar_path |
| 1385 dex_path = _lib_dex_path |
1382 | 1386 |
1383 if (defined(invoker.deps)) { | 1387 if (defined(invoker.deps)) { |
1384 deps += invoker.deps | 1388 deps += invoker.deps |
1385 } | 1389 } |
1386 } | 1390 } |
1387 | 1391 |
1388 if (_dist_jar_path != "") { | 1392 if (_dist_jar_path != "") { |
1389 create_dist_target = "${_template_name}__create_dist_jar" | 1393 create_dist_target = "${_template_name}__create_dist_jar" |
1390 _final_deps += [ ":$create_dist_target" ] | 1394 _final_deps += [ ":$create_dist_target" ] |
1391 _incremental_final_deps += [ ":$create_dist_target" ] | 1395 _incremental_final_deps += [ ":$create_dist_target" ] |
(...skipping 11 matching lines...) Expand all Loading... |
1403 depfile, | 1407 depfile, |
1404 _dist_jar_path, | 1408 _dist_jar_path, |
1405 ] | 1409 ] |
1406 args = [ | 1410 args = [ |
1407 "--depfile", | 1411 "--depfile", |
1408 rebase_path(depfile, root_build_dir), | 1412 rebase_path(depfile, root_build_dir), |
1409 "--output", | 1413 "--output", |
1410 rebase_path(_dist_jar_path, root_build_dir), | 1414 rebase_path(_dist_jar_path, root_build_dir), |
1411 "--inputs=@FileArg($_rebased_build_config:dist_jar:dependency_jars)", | 1415 "--inputs=@FileArg($_rebased_build_config:dist_jar:dependency_jars)", |
1412 ] | 1416 ] |
1413 inputs += [ jar_path ] | 1417 inputs += [ _jar_path ] |
1414 _rebased_jar_path = rebase_path([ jar_path ], root_build_dir) | 1418 _rebased_jar_path = rebase_path([ _jar_path ], root_build_dir) |
1415 args += [ "--inputs=$_rebased_jar_path" ] | 1419 args += [ "--inputs=$_rebased_jar_path" ] |
1416 deps = [ | 1420 deps = [ |
1417 ":$build_config_target", # Generates the build config file. | 1421 ":$build_config_target", # Generates the build config file. |
1418 ":$java_target", # Generates the jar file. | 1422 ":$java_target", # Generates the jar file. |
1419 ] | 1423 ] |
1420 } | 1424 } |
1421 } | 1425 } |
1422 | 1426 |
1423 dex("$final_dex_target_name") { | 1427 dex("$final_dex_target_name") { |
1424 deps = [ | 1428 deps = [ |
1425 ":$build_config_target", | 1429 ":$build_config_target", |
1426 ":$java_target", | 1430 ":$java_target", |
1427 ] | 1431 ] |
1428 sources = [ | |
1429 jar_path, | |
1430 ] | |
1431 inputs = [ | 1432 inputs = [ |
1432 _build_config, | 1433 _build_config, |
1433 ] | 1434 ] |
1434 output = final_dex_path | 1435 output = final_dex_path |
1435 dex_arg_key = "${_rebased_build_config}:final_dex:dependency_dex_files" | 1436 _dex_arg_key = "${_rebased_build_config}:final_dex:dependency_dex_files" |
1436 args = [ "--inputs=@FileArg($dex_arg_key)" ] | 1437 args = [ |
| 1438 "--inputs=@FileArg($_dex_arg_key)", |
| 1439 _rebased_lib_dex_path, |
| 1440 ] |
1437 } | 1441 } |
1438 | 1442 |
1439 if (_native_libs != []) { | 1443 if (_native_libs != []) { |
1440 action("${_template_name}__prepare_native") { | 1444 action("${_template_name}__prepare_native") { |
1441 forward_variables_from(invoker, | 1445 forward_variables_from(invoker, |
1442 [ | 1446 [ |
1443 "data_deps", | 1447 "data_deps", |
1444 "public_deps", | 1448 "public_deps", |
1445 ]) | 1449 ]) |
1446 script = "//build/android/gyp/pack_relocations.py" | 1450 script = "//build/android/gyp/pack_relocations.py" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1580 deps = [ | 1584 deps = [ |
1581 ":${_template_name}__prepare_native", | 1585 ":${_template_name}__prepare_native", |
1582 ":${_manifest_rule}", | 1586 ":${_manifest_rule}", |
1583 ] | 1587 ] |
1584 } | 1588 } |
1585 } | 1589 } |
1586 | 1590 |
1587 _create_incremental_script_rule_name = "${_template_name}__incremental_script" | 1591 _create_incremental_script_rule_name = "${_template_name}__incremental_script" |
1588 _incremental_final_deps += [ ":${_create_incremental_script_rule_name}" ] | 1592 _incremental_final_deps += [ ":${_create_incremental_script_rule_name}" ] |
1589 action(_create_incremental_script_rule_name) { | 1593 action(_create_incremental_script_rule_name) { |
1590 script = "//build/android/gn/create_incremental_install_script.py" | 1594 script = "//build/android/incremental_install/create_install_script.py" |
1591 depfile = "$target_gen_dir/$target_name.d" | 1595 depfile = "$target_gen_dir/$target_name.d" |
1592 | 1596 |
1593 _generated_script_path = | 1597 _generated_script_path = |
1594 "${root_out_dir}/bin/install_incremental_${_template_name}" | 1598 "${root_out_dir}/bin/install_incremental_${_template_name}" |
1595 outputs = [ | 1599 outputs = [ |
1596 depfile, | 1600 depfile, |
1597 _generated_script_path, | 1601 _generated_script_path, |
1598 ] | 1602 ] |
1599 | 1603 |
1600 _rebased_apk_path_no_ext = | 1604 _rebased_apk_path_no_ext = |
1601 rebase_path(_final_apk_path_no_ext, root_build_dir) | 1605 rebase_path(_final_apk_path_no_ext, root_build_dir) |
1602 _rebased_generated_script_path = | 1606 _rebased_generated_script_path = |
1603 rebase_path(_generated_script_path, root_build_dir) | 1607 rebase_path(_generated_script_path, root_build_dir) |
1604 _rebased_depfile = rebase_path(depfile, root_build_dir) | 1608 _rebased_depfile = rebase_path(depfile, root_build_dir) |
| 1609 _dex_arg_key = "${_rebased_build_config}:final_dex:dependency_dex_files" |
1605 args = [ | 1610 args = [ |
1606 "--apk-path=${_rebased_apk_path_no_ext}_incremental.apk", | 1611 "--apk-path=${_rebased_apk_path_no_ext}_incremental.apk", |
1607 "--script-output-path=$_rebased_generated_script_path", | 1612 "--script-output-path=$_rebased_generated_script_path", |
| 1613 "--dex-file=$_rebased_lib_dex_path", |
| 1614 "--dex-file-list=@FileArg($_dex_arg_key)", |
1608 "--depfile=$_rebased_depfile", | 1615 "--depfile=$_rebased_depfile", |
1609 ] | 1616 ] |
1610 if (defined(_native_libs_dir)) { | 1617 if (defined(_native_libs_dir)) { |
1611 _rebased_native_libs_dir = rebase_path(_native_libs_dir, root_build_dir) | 1618 _rebased_native_libs_dir = rebase_path(_native_libs_dir, root_build_dir) |
1612 args += [ "--lib-dir=$_rebased_native_libs_dir/$android_app_abi" ] | 1619 args += [ "--lib-dir=$_rebased_native_libs_dir/$android_app_abi" ] |
1613 } | 1620 } |
1614 if (_create_density_splits) { | 1621 if (_create_density_splits) { |
1615 args += [ "--split=${_rebased_apk_path_no_ext}-density-*.apk" ] | 1622 args += [ "--split=${_rebased_apk_path_no_ext}-density-*.apk" ] |
1616 } | 1623 } |
1617 if (_create_language_splits) { | 1624 if (_create_language_splits) { |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2010 | 2017 |
2011 # TODO(GYP): implement this. | 2018 # TODO(GYP): implement this. |
2012 template("uiautomator_test") { | 2019 template("uiautomator_test") { |
2013 set_sources_assignment_filter([]) | 2020 set_sources_assignment_filter([]) |
2014 forward_variables_from(invoker, [ "testonly" ]) | 2021 forward_variables_from(invoker, [ "testonly" ]) |
2015 assert(target_name != "") | 2022 assert(target_name != "") |
2016 assert(invoker.deps != [] || true) | 2023 assert(invoker.deps != [] || true) |
2017 group(target_name) { | 2024 group(target_name) { |
2018 } | 2025 } |
2019 } | 2026 } |
OLD | NEW |