OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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/rules.gni") | 6 import("//build/config/android/rules.gni") |
7 import("//chrome/common/features.gni") | 7 import("//chrome/common/features.gni") |
8 import("//third_party/leakcanary/config.gni") | 8 import("//third_party/leakcanary/config.gni") |
9 import("channel.gni") | 9 import("channel.gni") |
10 | 10 |
11 declare_args() { | 11 declare_args() { |
12 # Whether chrome_public_apk should use the crazy linker. | 12 # Whether chrome_public_apk should use the crazy linker. |
13 chrome_public_apk_use_chromium_linker = chromium_linker_supported | 13 chrome_public_apk_use_chromium_linker = chromium_linker_supported |
14 | 14 |
15 # Whether chrome_public_apk should use the relocation packer. | 15 # Whether chrome_public_apk should use the relocation packer. |
16 # TODO: Enable packed relocations for x64. See: b/20532404 | 16 # TODO: Enable packed relocations for x64. See: b/20532404 |
17 chrome_public_apk_use_relocation_packer = | 17 chrome_public_apk_use_relocation_packer = |
18 chromium_linker_supported && current_cpu != "x64" | 18 chromium_linker_supported && current_cpu != "x64" |
19 | 19 |
20 # Whether native libraries should be loaded from within the apk. | 20 # Whether native libraries should be loaded from within the apk. |
21 # Only attempt loading the library from the APK for 64 bit devices | 21 # Only attempt loading the library from the APK for 64 bit devices |
22 # until the number of 32 bit devices which don't support this | 22 # until the number of 32 bit devices which don't support this |
23 # approach falls to a minimal level - http://crbug.com/390618. | 23 # approach falls to a minimal level - http://crbug.com/390618. |
24 chrome_public_apk_load_library_from_apk = | 24 chrome_public_apk_load_library_from_apk = |
25 chromium_linker_supported && | 25 chromium_linker_supported && |
26 (current_cpu == "arm64" || current_cpu == "x64") | 26 (current_cpu == "arm64" || current_cpu == "x64") |
| 27 |
| 28 # Enables ProGuard obfuscation of Chromium packages. |
| 29 enable_proguard_obfuscation = false |
27 } | 30 } |
28 | 31 |
29 default_chrome_public_jinja_variables = [ | 32 default_chrome_public_jinja_variables = [ |
30 "channel=$android_channel", | 33 "channel=$android_channel", |
31 "enable_leakcanary=$enable_leakcanary", | 34 "enable_leakcanary=$enable_leakcanary", |
32 "enable_vr_shell=$enable_vr_shell", | 35 "enable_vr_shell=$enable_vr_shell", |
33 ] | 36 ] |
34 | 37 |
35 template("chrome_public_apk_tmpl") { | 38 template("chrome_public_apk_tmpl") { |
36 android_apk(target_name) { | 39 android_apk(target_name) { |
37 forward_variables_from(invoker, "*") | 40 forward_variables_from(invoker, "*") |
38 _native_lib_file = | 41 _native_lib_file = |
39 rebase_path("$root_gen_dir/CHROME_VERSION.json", root_out_dir) | 42 rebase_path("$root_gen_dir/CHROME_VERSION.json", root_out_dir) |
40 native_lib_version_arg = "@FileArg($_native_lib_file:full-quoted)" | 43 native_lib_version_arg = "@FileArg($_native_lib_file:full-quoted)" |
41 | 44 |
42 if (is_java_debug) { | 45 if (is_java_debug) { |
43 enable_multidex = true | 46 enable_multidex = true |
44 } else { | 47 } else { |
45 proguard_enabled = true | 48 proguard_enabled = true |
46 if (!defined(proguard_configs)) { | 49 if (!defined(proguard_configs)) { |
47 proguard_configs = [] | 50 proguard_configs = [] |
48 } | 51 } |
49 proguard_configs += [ | 52 proguard_configs += [ |
50 "//chrome/android/java/proguard.flags", | 53 "//chrome/android/java/proguard.flags", |
51 "//base/android/proguard/chromium_apk.flags", | 54 "//base/android/proguard/chromium_apk.flags", |
52 "//base/android/proguard/chromium_code.flags", | 55 "//base/android/proguard/chromium_code.flags", |
53 ] | 56 ] |
| 57 if (enable_proguard_obfuscation) { |
| 58 proguard_configs += [ "//chrome/android/java/proguard-obfuscate.flags" ] |
| 59 } else { |
| 60 proguard_configs += |
| 61 [ "//chrome/android/java/proguard-dont-obfuscate.flags" ] |
| 62 } |
54 } | 63 } |
55 | 64 |
56 if (!defined(use_chromium_linker)) { | 65 if (!defined(use_chromium_linker)) { |
57 use_chromium_linker = chrome_public_apk_use_chromium_linker | 66 use_chromium_linker = chrome_public_apk_use_chromium_linker |
58 } | 67 } |
59 | 68 |
60 if (use_chromium_linker) { | 69 if (use_chromium_linker) { |
61 if (!defined(load_library_from_apk)) { | 70 if (!defined(load_library_from_apk)) { |
62 load_library_from_apk = chrome_public_apk_load_library_from_apk | 71 load_library_from_apk = chrome_public_apk_load_library_from_apk |
63 } | 72 } |
64 | 73 |
65 if (!defined(enable_relocation_packing)) { | 74 if (!defined(enable_relocation_packing)) { |
66 enable_relocation_packing = chrome_public_apk_use_relocation_packer | 75 enable_relocation_packing = chrome_public_apk_use_relocation_packer |
67 } | 76 } |
68 } | 77 } |
69 } | 78 } |
70 } | 79 } |
OLD | NEW |