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

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: fix deps Created 5 years, 5 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') | chrome/android/BUILD.gn » ('j') | 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("//third_party/android_platform/config.gni") 8 import("//third_party/android_platform/config.gni")
9 import("//tools/grit/grit_rule.gni") 9 import("//tools/grit/grit_rule.gni")
10 10
(...skipping 1452 matching lines...) Expand 10 before | Expand all | Expand 10 after
1463 1463
1464 _rebased_build_config = rebase_path(_build_config, root_build_dir) 1464 _rebased_build_config = rebase_path(_build_config, root_build_dir)
1465 _create_abi_split = 1465 _create_abi_split =
1466 defined(invoker.create_abi_split) && invoker.create_abi_split 1466 defined(invoker.create_abi_split) && invoker.create_abi_split
1467 _create_density_splits = 1467 _create_density_splits =
1468 defined(invoker.create_density_splits) && invoker.create_density_splits 1468 defined(invoker.create_density_splits) && invoker.create_density_splits
1469 1469
1470 # Help GN understand that _create_abi_split is not unused (bug in GN). 1470 # Help GN understand that _create_abi_split is not unused (bug in GN).
1471 assert(_create_abi_split || true) 1471 assert(_create_abi_split || true)
1472 1472
1473 _proguard_enabled = false
1474 if (defined(invoker.proguard_enabled) && invoker.proguard_enabled) {
1475 _proguard_enabled = true
1476 _proguard_jar_path = "$base_path.proguard.jar"
1477 }
1478
1473 build_config_target = "${_template_name}__build_config" 1479 build_config_target = "${_template_name}__build_config"
1474 write_build_config(build_config_target) { 1480 write_build_config(build_config_target) {
1475 type = "android_apk" 1481 type = "android_apk"
1476 dex_path = final_dex_path 1482 dex_path = final_dex_path
1477 resources_zip = resources_zip_path 1483 resources_zip = resources_zip_path
1478 build_config = _build_config 1484 build_config = _build_config
1479 android_manifest = _android_manifest 1485 android_manifest = _android_manifest
1480 1486
1481 deps = _chromium_linker_dep + _android_manifest_deps 1487 deps = _chromium_linker_dep + _android_manifest_deps
1482 if (defined(invoker.deps)) { 1488 if (defined(invoker.deps)) {
1483 deps += invoker.deps 1489 deps += invoker.deps
1484 } 1490 }
1485 1491
1486 if (defined(invoker.apk_under_test)) { 1492 if (defined(invoker.apk_under_test)) {
1487 apk_under_test = invoker.apk_under_test 1493 apk_under_test = invoker.apk_under_test
1488 } 1494 }
1489 1495
1496 if (_proguard_enabled) {
1497 proguard_enabled = true
1498 proguard_info = "$_proguard_jar_path.info"
1499 }
1500
1490 native_libs = _native_libs 1501 native_libs = _native_libs
1491 } 1502 }
1492 1503
1493 final_deps = [] 1504 final_deps = []
1494 1505
1506 _generated_proguard_config = "$base_path.resources.proguard.txt"
1495 process_resources_target = "${_template_name}__process_resources" 1507 process_resources_target = "${_template_name}__process_resources"
1496 final_deps += [ ":$process_resources_target" ] 1508 final_deps += [ ":$process_resources_target" ]
1497 process_resources(process_resources_target) { 1509 process_resources(process_resources_target) {
1498 srcjar_path = "${target_gen_dir}/${target_name}.srcjar" 1510 srcjar_path = "${target_gen_dir}/${target_name}.srcjar"
1499 r_text_path = "${target_gen_dir}/${target_name}_R.txt" 1511 r_text_path = "${target_gen_dir}/${target_name}_R.txt"
1500 android_manifest = _android_manifest 1512 android_manifest = _android_manifest
1501 resource_dirs = [ "//build/android/ant/empty/res" ] 1513 resource_dirs = [ "//build/android/ant/empty/res" ]
1502 zip_path = resources_zip_path 1514 zip_path = resources_zip_path
1503 all_resources_zip_path = _all_resources_zip_path 1515 all_resources_zip_path = _all_resources_zip_path
1504 generate_constant_ids = true 1516 generate_constant_ids = true
1517 proguard_file = _generated_proguard_config
1505 1518
1506 if (defined(invoker.include_all_resources)) { 1519 if (defined(invoker.include_all_resources)) {
1507 include_all_resources = invoker.include_all_resources 1520 include_all_resources = invoker.include_all_resources
1508 } 1521 }
1509 1522
1510 build_config = _build_config 1523 build_config = _build_config
1511 deps = _android_manifest_deps + [ ":$build_config_target" ] 1524 deps = _android_manifest_deps + [ ":$build_config_target" ]
1512 if (defined(invoker.deps)) { 1525 if (defined(invoker.deps)) {
1513 deps += invoker.deps 1526 deps += invoker.deps
1514 } 1527 }
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1603 inputs += [ jar_path ] 1616 inputs += [ jar_path ]
1604 _rebased_jar_path = rebase_path([ jar_path ], root_build_dir) 1617 _rebased_jar_path = rebase_path([ jar_path ], root_build_dir)
1605 args += [ "--inputs=$_rebased_jar_path" ] 1618 args += [ "--inputs=$_rebased_jar_path" ]
1606 deps = [ 1619 deps = [
1607 ":$build_config_target", # Generates the build config file. 1620 ":$build_config_target", # Generates the build config file.
1608 ":$java_target", # Generates the jar file. 1621 ":$java_target", # Generates the jar file.
1609 ] 1622 ]
1610 } 1623 }
1611 } 1624 }
1612 1625
1626 if (defined(invoker.proguard_enabled) && invoker.proguard_enabled) {
1627 _proguard_configs = [ _generated_proguard_config ]
1628 if (defined(invoker.proguard_configs)) {
1629 _proguard_configs += invoker.proguard_configs
1630 }
1631 proguard_target = "${_template_name}__proguard"
1632 proguard(proguard_target) {
1633 deps = [
1634 ":$build_config_target",
1635 ":$process_resources_target",
1636 ":$java_target",
1637 ]
1638 inputs = [
1639 _build_config,
1640 jar_path,
1641 ] + _proguard_configs
1642
1643 output_jar_path = _proguard_jar_path
1644 rebased_proguard_configs = rebase_path(_proguard_configs, root_build_dir)
1645 args = [
1646 "--proguard-configs=$rebased_proguard_configs",
1647 "--tested-apk-info=@FileArg($_rebased_build_config:proguard:tested_apk_i nfo)",
1648 "--input-paths=@FileArg($_rebased_build_config:proguard:input_paths)",
1649 ]
1650 }
1651 dex_jar_path = _proguard_jar_path
1652 dex_deps = [ ":$proguard_target" ]
1653 } else {
1654 dex_jar_path = jar_path
1655 dex_deps = [ ":$java_target" ]
1656 }
1657
1613 final_deps += [ ":$final_dex_target_name" ] 1658 final_deps += [ ":$final_dex_target_name" ]
1614 dex("$final_dex_target_name") { 1659 dex("$final_dex_target_name") {
1615 deps = [ 1660 deps = dex_deps + [ ":$build_config_target" ]
1616 ":$build_config_target",
1617 ":$java_target",
1618 ]
1619 sources = [ 1661 sources = [
1620 jar_path, 1662 dex_jar_path,
1621 ] 1663 ]
1622 inputs = [ 1664 inputs = [
1623 _build_config, 1665 _build_config,
1624 ] 1666 ]
1625 output = final_dex_path 1667 output = final_dex_path
1626 dex_arg_key = "${_rebased_build_config}:final_dex:dependency_dex_files" 1668 dex_arg_key = "${_rebased_build_config}:final_dex:dependency_dex_files"
1627 args = [ "--inputs=@FileArg($dex_arg_key)" ] 1669 args = [ "--inputs=@FileArg($dex_arg_key)" ]
1628 } 1670 }
1629 1671
1630 if (_native_libs != []) { 1672 if (_native_libs != []) {
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1874 } 1916 }
1875 if (defined(invoker.apk_name)) { 1917 if (defined(invoker.apk_name)) {
1876 apk_name = invoker.apk_name 1918 apk_name = invoker.apk_name
1877 } 1919 }
1878 if (defined(invoker.final_apk_path)) { 1920 if (defined(invoker.final_apk_path)) {
1879 final_apk_path = invoker.final_apk_path 1921 final_apk_path = invoker.final_apk_path
1880 } 1922 }
1881 if (defined(invoker.native_libs)) { 1923 if (defined(invoker.native_libs)) {
1882 native_libs = invoker.native_libs 1924 native_libs = invoker.native_libs
1883 } 1925 }
1926 if (defined(invoker.proguard_enabled)) {
1927 proguard_enabled = invoker.proguard_enabled
1928 }
1884 if (defined(invoker.apk_under_test)) { 1929 if (defined(invoker.apk_under_test)) {
1885 apk_under_test = invoker.apk_under_test 1930 apk_under_test = invoker.apk_under_test
1886 } 1931 }
1887 if (defined(invoker.DEPRECATED_java_in_dir)) { 1932 if (defined(invoker.DEPRECATED_java_in_dir)) {
1888 DEPRECATED_java_in_dir = invoker.DEPRECATED_java_in_dir 1933 DEPRECATED_java_in_dir = invoker.DEPRECATED_java_in_dir
1889 } 1934 }
1890 } 1935 }
1891 } 1936 }
1892 1937
1893 # Declare an Android gtest apk 1938 # Declare an Android gtest apk
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
2211 template("uiautomator_test") { 2256 template("uiautomator_test") {
2212 set_sources_assignment_filter([]) 2257 set_sources_assignment_filter([])
2213 if (defined(invoker.testonly)) { 2258 if (defined(invoker.testonly)) {
2214 testonly = invoker.testonly 2259 testonly = invoker.testonly
2215 } 2260 }
2216 assert(target_name != "") 2261 assert(target_name != "")
2217 assert(invoker.deps != [] || true) 2262 assert(invoker.deps != [] || true)
2218 group(target_name) { 2263 group(target_name) {
2219 } 2264 }
2220 } 2265 }
OLDNEW
« no previous file with comments | « build/config/android/internal_rules.gni ('k') | chrome/android/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698