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 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1344 _create_abi_split = | 1344 _create_abi_split = |
1345 defined(invoker.create_abi_split) && invoker.create_abi_split | 1345 defined(invoker.create_abi_split) && invoker.create_abi_split |
1346 _create_density_splits = | 1346 _create_density_splits = |
1347 defined(invoker.create_density_splits) && invoker.create_density_splits | 1347 defined(invoker.create_density_splits) && invoker.create_density_splits |
1348 _create_language_splits = | 1348 _create_language_splits = |
1349 defined(invoker.language_splits) && invoker.language_splits != [] | 1349 defined(invoker.language_splits) && invoker.language_splits != [] |
1350 | 1350 |
1351 # Help GN understand that _create_abi_split is not unused (bug in GN). | 1351 # Help GN understand that _create_abi_split is not unused (bug in GN). |
1352 assert(_create_abi_split || true) | 1352 assert(_create_abi_split || true) |
1353 | 1353 |
1354 _proguard_enabled = | |
1355 defined(invoker.proguard_enabled) && invoker.proguard_enabled | |
1356 if (_proguard_enabled) { | |
1357 _proguard_jar_path = "$base_path.proguard.jar" | |
1358 } | |
1359 | |
1360 build_config_target = "${_template_name}__build_config" | 1354 build_config_target = "${_template_name}__build_config" |
1361 write_build_config(build_config_target) { | 1355 write_build_config(build_config_target) { |
1362 forward_variables_from(invoker, [ "apk_under_test" ]) | 1356 forward_variables_from(invoker, [ "apk_under_test" ]) |
1363 type = "android_apk" | 1357 type = "android_apk" |
1364 jar_path = _jar_path | 1358 jar_path = _jar_path |
1365 dex_path = final_dex_path | 1359 dex_path = final_dex_path |
1366 resources_zip = resources_zip_path | 1360 resources_zip = resources_zip_path |
1367 build_config = _build_config | 1361 build_config = _build_config |
1368 android_manifest = _android_manifest | 1362 android_manifest = _android_manifest |
1369 | 1363 |
1370 deps = _chromium_linker_dep + _android_manifest_deps | 1364 deps = _chromium_linker_dep + _android_manifest_deps |
1371 if (defined(invoker.deps)) { | 1365 if (defined(invoker.deps)) { |
1372 deps += invoker.deps | 1366 deps += invoker.deps |
1373 } | 1367 } |
1374 | 1368 |
1375 proguard_enabled = _proguard_enabled | |
1376 if (_proguard_enabled) { | |
1377 proguard_info = "$_proguard_jar_path.info" | |
1378 } | |
1379 | |
1380 native_libs = _native_libs | 1369 native_libs = _native_libs |
1381 } | 1370 } |
1382 | 1371 |
1383 _final_deps = [] | 1372 _final_deps = [] |
1384 | 1373 |
1385 _generated_proguard_config = "$base_path.resources.proguard.txt" | |
1386 process_resources_target = "${_template_name}__process_resources" | 1374 process_resources_target = "${_template_name}__process_resources" |
1387 process_resources(process_resources_target) { | 1375 process_resources(process_resources_target) { |
1388 forward_variables_from(invoker, [ "include_all_resources" ]) | 1376 forward_variables_from(invoker, [ "include_all_resources" ]) |
1389 srcjar_path = "${target_gen_dir}/${target_name}.srcjar" | 1377 srcjar_path = "${target_gen_dir}/${target_name}.srcjar" |
1390 r_text_path = "${target_gen_dir}/${target_name}_R.txt" | 1378 r_text_path = "${target_gen_dir}/${target_name}_R.txt" |
1391 android_manifest = _android_manifest | 1379 android_manifest = _android_manifest |
1392 resource_dirs = [ "//build/android/ant/empty/res" ] | 1380 resource_dirs = [ "//build/android/ant/empty/res" ] |
1393 zip_path = resources_zip_path | 1381 zip_path = resources_zip_path |
1394 all_resources_zip_path = _all_resources_zip_path | 1382 all_resources_zip_path = _all_resources_zip_path |
1395 generate_constant_ids = true | 1383 generate_constant_ids = true |
1396 proguard_file = _generated_proguard_config | |
1397 | 1384 |
1398 build_config = _build_config | 1385 build_config = _build_config |
1399 deps = _android_manifest_deps + [ ":$build_config_target" ] | 1386 deps = _android_manifest_deps + [ ":$build_config_target" ] |
1400 if (defined(invoker.deps)) { | 1387 if (defined(invoker.deps)) { |
1401 deps += invoker.deps | 1388 deps += invoker.deps |
1402 } | 1389 } |
1403 } | 1390 } |
1404 _srcjar_deps += [ ":$process_resources_target" ] | 1391 _srcjar_deps += [ ":$process_resources_target" ] |
1405 | 1392 |
1406 if (_native_libs != []) { | 1393 if (_native_libs != []) { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1499 inputs += [ _jar_path ] | 1486 inputs += [ _jar_path ] |
1500 _rebased_jar_path = rebase_path([ _jar_path ], root_build_dir) | 1487 _rebased_jar_path = rebase_path([ _jar_path ], root_build_dir) |
1501 args += [ "--inputs=$_rebased_jar_path" ] | 1488 args += [ "--inputs=$_rebased_jar_path" ] |
1502 deps = [ | 1489 deps = [ |
1503 ":$build_config_target", # Generates the build config file. | 1490 ":$build_config_target", # Generates the build config file. |
1504 ":$java_target", # Generates the jar file. | 1491 ":$java_target", # Generates the jar file. |
1505 ] | 1492 ] |
1506 } | 1493 } |
1507 } | 1494 } |
1508 | 1495 |
1509 if (_proguard_enabled) { | |
1510 _proguard_configs = [ _generated_proguard_config ] | |
1511 if (defined(invoker.proguard_configs)) { | |
1512 _proguard_configs += invoker.proguard_configs | |
1513 } | |
1514 _proguard_target = "${_template_name}__proguard" | |
1515 proguard(_proguard_target) { | |
1516 deps = [ | |
1517 ":$build_config_target", | |
1518 ":$process_resources_target", | |
1519 ":$java_target", | |
1520 ] | |
1521 inputs = [ | |
1522 _build_config, | |
1523 _jar_path, | |
1524 ] + _proguard_configs | |
1525 | |
1526 output_jar_path = _proguard_jar_path | |
1527 rebased_proguard_configs = rebase_path(_proguard_configs, root_build_dir) | |
1528 args = [ | |
1529 "--proguard-configs=$rebased_proguard_configs", | |
1530 "--tested-apk-info=@FileArg($_rebased_build_config:proguard:tested_apk_i
nfo)", | |
1531 "--input-paths=@FileArg($_rebased_build_config:proguard:input_paths)", | |
1532 ] | |
1533 } | |
1534 _dex_sources = [ _proguard_jar_path ] | |
1535 _dex_deps = [ ":$_proguard_target" ] | |
1536 } else { | |
1537 _dex_sources = [ _lib_dex_path ] | |
1538 _dex_deps = [ ":$java_target" ] | |
1539 } | |
1540 | |
1541 dex("$final_dex_target_name") { | 1496 dex("$final_dex_target_name") { |
1542 deps = _dex_deps + [ ":$build_config_target" ] | 1497 deps = [ |
| 1498 ":$build_config_target", |
| 1499 ":$java_target", |
| 1500 ] |
1543 inputs = [ | 1501 inputs = [ |
1544 _build_config, | 1502 _build_config, |
1545 ] | 1503 ] |
1546 sources = _dex_sources | |
1547 output = final_dex_path | 1504 output = final_dex_path |
1548 _dex_arg_key = "${_rebased_build_config}:final_dex:dependency_dex_files" | 1505 _dex_arg_key = "${_rebased_build_config}:final_dex:dependency_dex_files" |
1549 args = [ "--inputs=@FileArg($_dex_arg_key)" ] | 1506 args = [ |
| 1507 "--inputs=@FileArg($_dex_arg_key)", |
| 1508 _rebased_lib_dex_path, |
| 1509 ] |
1550 } | 1510 } |
1551 | 1511 |
1552 if (_native_libs != []) { | 1512 if (_native_libs != []) { |
1553 _prepare_native_target_name = "${_template_name}__prepare_native" | 1513 _prepare_native_target_name = "${_template_name}__prepare_native" |
1554 action(_prepare_native_target_name) { | 1514 action(_prepare_native_target_name) { |
1555 forward_variables_from(invoker, | 1515 forward_variables_from(invoker, |
1556 [ | 1516 [ |
1557 "data_deps", | 1517 "data_deps", |
1558 "public_deps", | 1518 "public_deps", |
1559 ]) | 1519 ]) |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2145 } | 2105 } |
2146 | 2106 |
2147 android_library(target_name) { | 2107 android_library(target_name) { |
2148 java_files = [] | 2108 java_files = [] |
2149 srcjar_deps = [ ":${_template_name}__protoc_java" ] | 2109 srcjar_deps = [ ":${_template_name}__protoc_java" ] |
2150 deps = [ | 2110 deps = [ |
2151 "//third_party/android_protobuf:protobuf_nano_javalib", | 2111 "//third_party/android_protobuf:protobuf_nano_javalib", |
2152 ] | 2112 ] |
2153 } | 2113 } |
2154 } | 2114 } |
OLD | NEW |