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 |
1354 build_config_target = "${_template_name}__build_config" | 1360 build_config_target = "${_template_name}__build_config" |
1355 write_build_config(build_config_target) { | 1361 write_build_config(build_config_target) { |
1356 forward_variables_from(invoker, [ "apk_under_test" ]) | 1362 forward_variables_from(invoker, [ "apk_under_test" ]) |
1357 type = "android_apk" | 1363 type = "android_apk" |
1358 jar_path = _jar_path | 1364 jar_path = _jar_path |
1359 dex_path = final_dex_path | 1365 dex_path = final_dex_path |
1360 resources_zip = resources_zip_path | 1366 resources_zip = resources_zip_path |
1361 build_config = _build_config | 1367 build_config = _build_config |
1362 android_manifest = _android_manifest | 1368 android_manifest = _android_manifest |
1363 | 1369 |
1364 deps = _chromium_linker_dep + _android_manifest_deps | 1370 deps = _chromium_linker_dep + _android_manifest_deps |
1365 if (defined(invoker.deps)) { | 1371 if (defined(invoker.deps)) { |
1366 deps += invoker.deps | 1372 deps += invoker.deps |
1367 } | 1373 } |
1368 | 1374 |
| 1375 proguard_enabled = _proguard_enabled |
| 1376 if (_proguard_enabled) { |
| 1377 proguard_info = "$_proguard_jar_path.info" |
| 1378 } |
| 1379 |
1369 native_libs = _native_libs | 1380 native_libs = _native_libs |
1370 } | 1381 } |
1371 | 1382 |
1372 _final_deps = [] | 1383 _final_deps = [] |
1373 | 1384 |
| 1385 _generated_proguard_config = "$base_path.resources.proguard.txt" |
1374 process_resources_target = "${_template_name}__process_resources" | 1386 process_resources_target = "${_template_name}__process_resources" |
1375 process_resources(process_resources_target) { | 1387 process_resources(process_resources_target) { |
1376 forward_variables_from(invoker, [ "include_all_resources" ]) | 1388 forward_variables_from(invoker, [ "include_all_resources" ]) |
1377 srcjar_path = "${target_gen_dir}/${target_name}.srcjar" | 1389 srcjar_path = "${target_gen_dir}/${target_name}.srcjar" |
1378 r_text_path = "${target_gen_dir}/${target_name}_R.txt" | 1390 r_text_path = "${target_gen_dir}/${target_name}_R.txt" |
1379 android_manifest = _android_manifest | 1391 android_manifest = _android_manifest |
1380 resource_dirs = [ "//build/android/ant/empty/res" ] | 1392 resource_dirs = [ "//build/android/ant/empty/res" ] |
1381 zip_path = resources_zip_path | 1393 zip_path = resources_zip_path |
1382 all_resources_zip_path = _all_resources_zip_path | 1394 all_resources_zip_path = _all_resources_zip_path |
1383 generate_constant_ids = true | 1395 generate_constant_ids = true |
| 1396 proguard_file = _generated_proguard_config |
1384 | 1397 |
1385 build_config = _build_config | 1398 build_config = _build_config |
1386 deps = _android_manifest_deps + [ ":$build_config_target" ] | 1399 deps = _android_manifest_deps + [ ":$build_config_target" ] |
1387 if (defined(invoker.deps)) { | 1400 if (defined(invoker.deps)) { |
1388 deps += invoker.deps | 1401 deps += invoker.deps |
1389 } | 1402 } |
1390 } | 1403 } |
1391 _srcjar_deps += [ ":$process_resources_target" ] | 1404 _srcjar_deps += [ ":$process_resources_target" ] |
1392 | 1405 |
1393 if (_native_libs != []) { | 1406 if (_native_libs != []) { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1486 inputs += [ _jar_path ] | 1499 inputs += [ _jar_path ] |
1487 _rebased_jar_path = rebase_path([ _jar_path ], root_build_dir) | 1500 _rebased_jar_path = rebase_path([ _jar_path ], root_build_dir) |
1488 args += [ "--inputs=$_rebased_jar_path" ] | 1501 args += [ "--inputs=$_rebased_jar_path" ] |
1489 deps = [ | 1502 deps = [ |
1490 ":$build_config_target", # Generates the build config file. | 1503 ":$build_config_target", # Generates the build config file. |
1491 ":$java_target", # Generates the jar file. | 1504 ":$java_target", # Generates the jar file. |
1492 ] | 1505 ] |
1493 } | 1506 } |
1494 } | 1507 } |
1495 | 1508 |
| 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 |
1496 dex("$final_dex_target_name") { | 1541 dex("$final_dex_target_name") { |
1497 deps = [ | 1542 deps = _dex_deps + [ ":$build_config_target" ] |
1498 ":$build_config_target", | |
1499 ":$java_target", | |
1500 ] | |
1501 inputs = [ | 1543 inputs = [ |
1502 _build_config, | 1544 _build_config, |
1503 ] | 1545 ] |
| 1546 sources = _dex_sources |
1504 output = final_dex_path | 1547 output = final_dex_path |
1505 _dex_arg_key = "${_rebased_build_config}:final_dex:dependency_dex_files" | 1548 _dex_arg_key = "${_rebased_build_config}:final_dex:dependency_dex_files" |
1506 args = [ | 1549 args = [ "--inputs=@FileArg($_dex_arg_key)" ] |
1507 "--inputs=@FileArg($_dex_arg_key)", | |
1508 _rebased_lib_dex_path, | |
1509 ] | |
1510 } | 1550 } |
1511 | 1551 |
1512 if (_native_libs != []) { | 1552 if (_native_libs != []) { |
1513 _prepare_native_target_name = "${_template_name}__prepare_native" | 1553 _prepare_native_target_name = "${_template_name}__prepare_native" |
1514 action(_prepare_native_target_name) { | 1554 action(_prepare_native_target_name) { |
1515 forward_variables_from(invoker, | 1555 forward_variables_from(invoker, |
1516 [ | 1556 [ |
1517 "data_deps", | 1557 "data_deps", |
1518 "public_deps", | 1558 "public_deps", |
1519 ]) | 1559 ]) |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2105 } | 2145 } |
2106 | 2146 |
2107 android_library(target_name) { | 2147 android_library(target_name) { |
2108 java_files = [] | 2148 java_files = [] |
2109 srcjar_deps = [ ":${_template_name}__protoc_java" ] | 2149 srcjar_deps = [ ":${_template_name}__protoc_java" ] |
2110 deps = [ | 2150 deps = [ |
2111 "//third_party/android_protobuf:protobuf_nano_javalib", | 2151 "//third_party/android_protobuf:protobuf_nano_javalib", |
2112 ] | 2152 ] |
2113 } | 2153 } |
2114 } | 2154 } |
OLD | NEW |