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

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

Issue 1133013003: Enable proguard for apks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@javac-no-java
Patch Set: Created 5 years, 7 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
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("//tools/grit/grit_rule.gni") 8 import("//tools/grit/grit_rule.gni")
9 import("//tools/relocation_packer/config.gni") 9 import("//tools/relocation_packer/config.gni")
10 10
(...skipping 1285 matching lines...) Expand 10 before | Expand all | Expand 10 after
1296 _android_manifest = invoker.android_manifest 1296 _android_manifest = invoker.android_manifest
1297 _rebased_build_config = rebase_path(_build_config, root_build_dir) 1297 _rebased_build_config = rebase_path(_build_config, root_build_dir)
1298 _create_abi_split = 1298 _create_abi_split =
1299 defined(invoker.create_abi_split) && invoker.create_abi_split 1299 defined(invoker.create_abi_split) && invoker.create_abi_split
1300 _create_density_splits = 1300 _create_density_splits =
1301 defined(invoker.create_density_splits) && invoker.create_density_splits 1301 defined(invoker.create_density_splits) && invoker.create_density_splits
1302 1302
1303 # Help GN understand that _create_abi_split is not unused (bug in GN). 1303 # Help GN understand that _create_abi_split is not unused (bug in GN).
1304 assert(_create_abi_split || true) 1304 assert(_create_abi_split || true)
1305 1305
1306 _proguard_enabled = false
1307 if (defined(invoker.proguard_enabled) && invoker.proguard_enabled) {
1308 _proguard_enabled = true
1309 _proguard_jar_path = "$base_path.proguard.jar"
1310 }
1311
1306 write_build_config("${_template_name}__build_config") { 1312 write_build_config("${_template_name}__build_config") {
1307 type = "android_apk" 1313 type = "android_apk"
1308 dex_path = final_dex_path 1314 dex_path = final_dex_path
1309 resources_zip = resources_zip_path 1315 resources_zip = resources_zip_path
1310 build_config = _build_config 1316 build_config = _build_config
1311 android_manifest = _android_manifest 1317 android_manifest = _android_manifest
1312 1318
1313 if (defined(invoker.deps)) { 1319 if (defined(invoker.deps)) {
1314 deps = invoker.deps 1320 deps = invoker.deps
1315 } 1321 }
1316 1322
1317 if (defined(invoker.apk_under_test)) { 1323 if (defined(invoker.apk_under_test)) {
1318 apk_under_test = invoker.apk_under_test 1324 apk_under_test = invoker.apk_under_test
1319 } 1325 }
1320 1326
1327 if (_proguard_enabled) {
1328 proguard_enabled = true
1329 proguard_info = "$_proguard_jar_path.info"
1330 }
1331
1321 native_libs = _native_libs 1332 native_libs = _native_libs
1322 } 1333 }
1323 1334
1324 final_deps = [] 1335 final_deps = []
1325 1336
1326 final_deps += [ ":${_template_name}__process_resources" ] 1337 final_deps += [ ":${_template_name}__process_resources" ]
1338 _generated_proguard_config = "$base_path.resources.proguard.txt"
1327 process_resources("${_template_name}__process_resources") { 1339 process_resources("${_template_name}__process_resources") {
1328 srcjar_path = "${target_gen_dir}/${target_name}.srcjar" 1340 srcjar_path = "${target_gen_dir}/${target_name}.srcjar"
1329 r_text_path = "${target_gen_dir}/${target_name}_R.txt" 1341 r_text_path = "${target_gen_dir}/${target_name}_R.txt"
1330 android_manifest = _android_manifest 1342 android_manifest = _android_manifest
1331 resource_dirs = [ "//build/android/ant/empty/res" ] 1343 resource_dirs = [ "//build/android/ant/empty/res" ]
1332 zip_path = resources_zip_path 1344 zip_path = resources_zip_path
1333 all_resources_zip_path = _all_resources_zip_path 1345 all_resources_zip_path = _all_resources_zip_path
1334 generate_constant_ids = true 1346 generate_constant_ids = true
1347 proguard_file = _generated_proguard_config
1335 build_config = _build_config 1348 build_config = _build_config
1336 1349
1337 if (defined(invoker.include_all_resources)) { 1350 if (defined(invoker.include_all_resources)) {
1338 include_all_resources = invoker.include_all_resources 1351 include_all_resources = invoker.include_all_resources
1339 } 1352 }
1340 } 1353 }
1341 _srcjar_deps += [ ":${_template_name}__process_resources" ] 1354 _srcjar_deps += [ ":${_template_name}__process_resources" ]
1342 1355
1343 if (_native_libs != []) { 1356 if (_native_libs != []) {
1344 _enable_chromium_linker_tests = false 1357 _enable_chromium_linker_tests = false
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 rebase_path(_dist_jar_path, root_build_dir), 1427 rebase_path(_dist_jar_path, root_build_dir),
1415 "--inputs=@FileArg($_rebased_build_config:dist_jar:dependency_jars)", 1428 "--inputs=@FileArg($_rebased_build_config:dist_jar:dependency_jars)",
1416 ] 1429 ]
1417 inputs += [ jar_path ] 1430 inputs += [ jar_path ]
1418 _rebased_jar_path = rebase_path([ jar_path ], root_build_dir) 1431 _rebased_jar_path = rebase_path([ jar_path ], root_build_dir)
1419 args += [ "--inputs=$_rebased_jar_path" ] 1432 args += [ "--inputs=$_rebased_jar_path" ]
1420 } 1433 }
1421 } 1434 }
1422 1435
1423 final_deps += [ ":${_template_name}__final_dex" ] 1436 final_deps += [ ":${_template_name}__final_dex" ]
1437
1438 dex_jar_path = jar_path
1439 if (defined(invoker.proguard_enabled) && invoker.proguard_enabled) {
1440 _proguard_configs = [ _generated_proguard_config ]
1441 if (defined(invoker.proguard_configs)) {
1442 _proguard_configs += invoker.proguard_configs
1443 }
1444 proguard("${_template_name}__proguard") {
1445 inputs = [
newt (away) 2015/05/29 01:43:04 funky indentation. this would be more normal:
1446 _build_config,
1447 jar_path,
1448 ] + _proguard_configs
1449
1450 output_jar_path = _proguard_jar_path
1451 rebased_proguard_configs = rebase_path(_proguard_configs, root_build_dir)
1452 args = [
1453 "--proguard-configs=$rebased_proguard_configs",
1454 "--tested-apk-info=@FileArg($_rebased_build_config:proguard:tested_apk_i nfo)",
1455 "--input-paths=@FileArg($_rebased_build_config:proguard:input_paths)",
1456 ]
1457 }
1458 dex_jar_path = _proguard_jar_path
1459 }
1460
1424 dex("${_template_name}__final_dex") { 1461 dex("${_template_name}__final_dex") {
1425 deps = [ 1462 deps = [
1426 ":${_template_name}__java", 1463 ":${_template_name}__java",
1427 ] 1464 ]
1428 sources = [ 1465 sources = [
1429 jar_path, 1466 dex_jar_path,
1430 ] 1467 ]
1431 inputs = [ 1468 inputs = [
1432 _build_config, 1469 _build_config,
1433 ] 1470 ]
1434 output = final_dex_path 1471 output = final_dex_path
1435 dex_arg_key = "${_rebased_build_config}:final_dex:dependency_dex_files" 1472 dex_arg_key = "${_rebased_build_config}:final_dex:dependency_dex_files"
1436 args = [ "--inputs=@FileArg($dex_arg_key)" ] 1473 args = [ "--inputs=@FileArg($dex_arg_key)" ]
1437 } 1474 }
1438 1475
1439 if (_native_libs != []) { 1476 if (_native_libs != []) {
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
1863 template("uiautomator_test") { 1900 template("uiautomator_test") {
1864 set_sources_assignment_filter([]) 1901 set_sources_assignment_filter([])
1865 if (defined(invoker.testonly)) { 1902 if (defined(invoker.testonly)) {
1866 testonly = invoker.testonly 1903 testonly = invoker.testonly
1867 } 1904 }
1868 assert(target_name != "") 1905 assert(target_name != "")
1869 assert(invoker.deps != [] || true) 1906 assert(invoker.deps != [] || true)
1870 group(target_name) { 1907 group(target_name) {
1871 } 1908 }
1872 } 1909 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698