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

Side by Side Diff: build/config/android/internal_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/android/gyp/write_build_config.py ('k') | build/config/android/rules.gni » ('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("//build/config/android/config.gni") 5 import("//build/config/android/config.gni")
6 6
7 assert(is_android) 7 assert(is_android)
8 8
9 rebased_android_sdk = rebase_path(android_sdk, root_build_dir) 9 rebased_android_sdk = rebase_path(android_sdk, root_build_dir)
10 rebased_android_sdk_root = rebase_path(android_sdk_root, root_build_dir) 10 rebased_android_sdk_root = rebase_path(android_sdk_root, root_build_dir)
11 rebased_android_sdk_build_tools = 11 rebased_android_sdk_build_tools =
12 rebase_path(android_sdk_build_tools, root_build_dir) 12 rebase_path(android_sdk_build_tools, root_build_dir)
13 13
14 android_sdk_jar = "$android_sdk/android.jar" 14 android_sdk_jar = "$android_sdk/android.jar"
15 rebased_android_sdk_jar = rebase_path(android_sdk_jar, root_build_dir) 15 rebased_android_sdk_jar = rebase_path(android_sdk_jar, root_build_dir)
16 android_aapt_path = "$rebased_android_sdk_build_tools/aapt" 16 android_aapt_path = "$rebased_android_sdk_build_tools/aapt"
17 17
18 template("android_lint") { 18 template("android_lint") {
19 set_sources_assignment_filter([]) 19 action(target_name) {
20 if (defined(invoker.testonly)) { 20 set_sources_assignment_filter([])
21 testonly = invoker.testonly 21 if (defined(invoker.testonly)) {
22 } 22 testonly = invoker.testonly
23 }
24 jar_path = invoker.jar_path
25 android_manifest = invoker.android_manifest
26 java_files = invoker.java_files
27 base_path = "$target_gen_dir/$target_name"
23 28
24 jar_path = invoker.jar_path
25 android_manifest = invoker.android_manifest
26 java_files = invoker.java_files
27 base_path = "$target_gen_dir/$target_name"
28
29 action(target_name) {
30 script = "//build/android/gyp/lint.py" 29 script = "//build/android/gyp/lint.py"
31 result_path = base_path + "/result.xml" 30 result_path = base_path + "/result.xml"
32 config_path = base_path + "/config.xml" 31 config_path = base_path + "/config.xml"
33 suppressions_file = "//build/android/lint/suppressions.xml" 32 suppressions_file = "//build/android/lint/suppressions.xml"
34 inputs = [ 33 inputs = [
35 suppressions_file, 34 suppressions_file,
36 android_manifest, 35 android_manifest,
37 jar_path, 36 jar_path,
38 ] + java_files 37 ] + java_files
39 38
(...skipping 26 matching lines...) Expand all
66 } 65 }
67 if (defined(invoker.public_deps)) { 66 if (defined(invoker.public_deps)) {
68 public_deps = invoker.public_deps 67 public_deps = invoker.public_deps
69 } 68 }
70 if (defined(invoker.data_deps)) { 69 if (defined(invoker.data_deps)) {
71 data_deps = invoker.data_deps 70 data_deps = invoker.data_deps
72 } 71 }
73 } 72 }
74 } 73 }
75 74
75 template("proguard") {
76 action(target_name) {
77 set_sources_assignment_filter([])
78 if (defined(invoker.testonly)) {
79 testonly = invoker.testonly
80 }
81 script = "//build/android/gyp/proguard.py"
82 _proguard_jar_path = "$android_sdk_root/tools/proguard/lib/proguard.jar"
83
84 _output_jar_path = invoker.output_jar_path
85 inputs = [
86 android_sdk_jar,
87 _proguard_jar_path,
88 ]
89 if (defined(invoker.inputs)) {
90 inputs += invoker.inputs
91 }
92 depfile = "${target_gen_dir}/${target_name}.d"
93 outputs = [
94 depfile,
95 _output_jar_path,
96 "$_output_jar_path.dump",
97 "$_output_jar_path.seeds",
98 "$_output_jar_path.mapping",
99 "$_output_jar_path.usage",
100 ]
101 args = [
102 "--depfile",
103 rebase_path(depfile, root_build_dir),
104 "--proguard-path",
105 rebase_path(_proguard_jar_path, root_build_dir),
106 "--output-path",
107 rebase_path(_output_jar_path, root_build_dir),
108 "--classpath",
109 rebased_android_sdk_jar,
110 ]
111 if (defined(invoker.args)) {
112 args += invoker.args
113 }
114 if (defined(invoker.deps)) {
115 deps = invoker.deps
116 }
117 if (defined(invoker.public_deps)) {
118 public_deps = invoker.public_deps
119 }
120 if (defined(invoker.data_deps)) {
121 data_deps = invoker.data_deps
122 }
123 }
124 }
125
76 template("findbugs") { 126 template("findbugs") {
77 jar_path = invoker.jar_path 127 jar_path = invoker.jar_path
78 128
79 build_config = invoker.build_config 129 build_config = invoker.build_config
80 130
81 action(target_name) { 131 action(target_name) {
82 script = "//build/android/findbugs_diff.py" 132 script = "//build/android/findbugs_diff.py"
83 depfile = "$target_gen_dir/$target_name.d" 133 depfile = "$target_gen_dir/$target_name.d"
84 result_path = "$target_gen_dir/$target_name/result.xml" 134 result_path = "$target_gen_dir/$target_name/result.xml"
85 exclusions_file = "//build/android/findbugs_filter/findbugs_exclude.xml" 135 exclusions_file = "//build/android/findbugs_filter/findbugs_exclude.xml"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 rebase_path(jar_path, root_build_dir), 167 rebase_path(jar_path, root_build_dir),
118 ] 168 ]
119 } 169 }
120 } 170 }
121 171
122 template("dex") { 172 template("dex") {
123 set_sources_assignment_filter([]) 173 set_sources_assignment_filter([])
124 if (defined(invoker.testonly)) { 174 if (defined(invoker.testonly)) {
125 testonly = invoker.testonly 175 testonly = invoker.testonly
126 } 176 }
127
128 assert(defined(invoker.output))
129 action(target_name) { 177 action(target_name) {
178 assert(defined(invoker.output))
130 script = "//build/android/gyp/dex.py" 179 script = "//build/android/gyp/dex.py"
131 depfile = "$target_gen_dir/$target_name.d" 180 depfile = "$target_gen_dir/$target_name.d"
132 if (defined(invoker.sources)) { 181 if (defined(invoker.sources)) {
133 sources = invoker.sources 182 sources = invoker.sources
134 } 183 }
135 outputs = [ 184 outputs = [
136 depfile, 185 depfile,
137 invoker.output, 186 invoker.output,
138 ] 187 ]
139 if (defined(invoker.inputs)) { 188 if (defined(invoker.inputs)) {
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 # Write the target's .build_config file. This is a json file that contains a 271 # Write the target's .build_config file. This is a json file that contains a
223 # dictionary of information about how to build this target (things that 272 # dictionary of information about how to build this target (things that
224 # require knowledge about this target's dependencies and cannot be calculated 273 # require knowledge about this target's dependencies and cannot be calculated
225 # at gn-time). There is a special syntax to add a value in that dictionary to 274 # at gn-time). There is a special syntax to add a value in that dictionary to
226 # an action/action_foreachs args: 275 # an action/action_foreachs args:
227 # --python-arg=@FileArg($rebased_build_config_path:key0:key1) 276 # --python-arg=@FileArg($rebased_build_config_path:key0:key1)
228 # At runtime, such an arg will be replaced by the value in the build_config. 277 # At runtime, such an arg will be replaced by the value in the build_config.
229 # See build/android/gyp/write_build_config.py and 278 # See build/android/gyp/write_build_config.py and
230 # build/android/gyp/util/build_utils.py:ExpandFileArgs 279 # build/android/gyp/util/build_utils.py:ExpandFileArgs
231 template("write_build_config") { 280 template("write_build_config") {
232 set_sources_assignment_filter([]) 281 action(target_name) {
233 if (defined(invoker.testonly)) { 282 set_sources_assignment_filter([])
234 testonly = invoker.testonly 283 if (defined(invoker.testonly)) {
235 } 284 testonly = invoker.testonly
285 }
236 286
237 assert(defined(invoker.type)) 287 assert(defined(invoker.type))
238 assert(defined(invoker.build_config)) 288 assert(defined(invoker.build_config))
239 289
240 type = invoker.type 290 type = invoker.type
241 build_config = invoker.build_config 291 build_config = invoker.build_config
242 292
243 assert(type == "android_apk" || type == "java_library" || 293 assert(type == "android_apk" || type == "java_library" ||
244 type == "android_resources" || type == "deps_dex") 294 type == "android_resources" || type == "deps_dex")
245 295
246 action(target_name) {
247 if (defined(invoker.visibility)) { 296 if (defined(invoker.visibility)) {
248 visibility = invoker.visibility 297 visibility = invoker.visibility
249 } 298 }
250 299
251 script = "//build/android/gyp/write_build_config.py" 300 script = "//build/android/gyp/write_build_config.py"
252 depfile = "$target_gen_dir/$target_name.d" 301 depfile = "$target_gen_dir/$target_name.d"
253 inputs = [] 302 inputs = []
254 303
255 deps = [] 304 deps = []
256 if (defined(invoker.deps)) { 305 if (defined(invoker.deps)) {
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 if (is_apk) { 420 if (is_apk) {
372 if (defined(invoker.native_libs)) { 421 if (defined(invoker.native_libs)) {
373 inputs += invoker.native_libs 422 inputs += invoker.native_libs
374 rebased_native_libs = rebase_path(invoker.native_libs, root_build_dir) 423 rebased_native_libs = rebase_path(invoker.native_libs, root_build_dir)
375 rebased_android_readelf = rebase_path(android_readelf, root_build_dir) 424 rebased_android_readelf = rebase_path(android_readelf, root_build_dir)
376 args += [ 425 args += [
377 "--native-libs=$rebased_native_libs", 426 "--native-libs=$rebased_native_libs",
378 "--readelf-path=$rebased_android_readelf", 427 "--readelf-path=$rebased_android_readelf",
379 ] 428 ]
380 } 429 }
430
431 if (defined(invoker.proguard_enabled) && invoker.proguard_enabled) {
432 args += [
433 "--proguard-enabled",
434 "--proguard-info",
435 rebase_path(invoker.proguard_info, root_build_dir),
436 ]
437 }
381 } 438 }
382 439
383 if (defined(invoker.srcjar)) { 440 if (defined(invoker.srcjar)) {
384 args += [ 441 args += [
385 "--srcjar", 442 "--srcjar",
386 rebase_path(invoker.srcjar, root_build_dir), 443 rebase_path(invoker.srcjar, root_build_dir),
387 ] 444 ]
388 } 445 }
389 } 446 }
390 } 447 }
391 448
392 template("process_java_prebuilt") { 449 template("process_java_prebuilt") {
393 set_sources_assignment_filter([]) 450 set_sources_assignment_filter([])
394 if (defined(invoker.testonly)) { 451 if (defined(invoker.testonly)) {
395 testonly = invoker.testonly 452 testonly = invoker.testonly
396 } 453 }
397 454
398 _input_jar_path = invoker.input_jar_path 455 _input_jar_path = invoker.input_jar_path
399 _output_jar_path = invoker.output_jar_path 456 _output_jar_path = invoker.output_jar_path
400 _jar_toc_path = _output_jar_path + ".TOC" 457 _jar_toc_path = _output_jar_path + ".TOC"
401 458
402 assert(invoker.build_config != "") 459 assert(invoker.build_config != "")
403 460
404 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) { 461 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) {
405 _proguard_jar_path = "$android_sdk_root/tools/proguard/lib/proguard.jar"
406 _proguard_config_path = invoker.proguard_config
407 _build_config = invoker.build_config 462 _build_config = invoker.build_config
408 _rebased_build_config = rebase_path(_build_config, root_build_dir) 463 _rebased_build_config = rebase_path(_build_config, root_build_dir)
464 _proguard_config_path = invoker.proguard_config
409 _output_jar_target = "${target_name}__proguard_process" 465 _output_jar_target = "${target_name}__proguard_process"
410 action(_output_jar_target) { 466 proguard(_output_jar_target) {
411 script = "//build/android/gyp/proguard.py"
412 inputs = [ 467 inputs = [
413 android_sdk_jar,
414 _proguard_jar_path,
415 _build_config, 468 _build_config,
416 _input_jar_path, 469 _input_jar_path,
417 _proguard_config_path, 470 _proguard_config_path,
418 ] 471 ]
419 depfile = "${target_gen_dir}/${target_name}.d" 472 output_jar_path = _output_jar_path
420 outputs = [ 473 _rebased_input_paths = [ rebase_path(_input_jar_path, root_build_dir) ]
421 depfile, 474 _rebased_proguard_configs =
422 _output_jar_path, 475 [ rebase_path(_proguard_config_path, root_build_dir) ]
423 ]
424 args = [ 476 args = [
425 "--depfile", 477 "--input-paths=$_rebased_input_paths",
426 rebase_path(depfile, root_build_dir), 478 "--proguard-configs=$_rebased_proguard_configs",
427 "--proguard-path",
428 rebase_path(_proguard_jar_path, root_build_dir),
429 "--input-path",
430 rebase_path(_input_jar_path, root_build_dir),
431 "--output-path",
432 rebase_path(_output_jar_path, root_build_dir),
433 "--proguard-config",
434 rebase_path(_proguard_config_path, root_build_dir),
435 "--classpath",
436 rebased_android_sdk_jar,
437 "--classpath=@FileArg($_rebased_build_config:javac:classpath)", 479 "--classpath=@FileArg($_rebased_build_config:javac:classpath)",
438 ] 480 ]
439 481
440 if (defined(invoker.deps)) { 482 if (defined(invoker.deps)) {
441 deps = invoker.deps 483 deps = invoker.deps
442 } 484 }
443 if (defined(invoker.public_deps)) { 485 if (defined(invoker.public_deps)) {
444 public_deps = invoker.public_deps 486 public_deps = invoker.public_deps
445 } 487 }
446 if (defined(invoker.data_deps)) { 488 if (defined(invoker.data_deps)) {
(...skipping 925 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 1414
1373 if (defined(invoker.all_resources_zip_path)) { 1415 if (defined(invoker.all_resources_zip_path)) {
1374 all_resources_zip = invoker.all_resources_zip_path 1416 all_resources_zip = invoker.all_resources_zip_path
1375 outputs += [ all_resources_zip ] 1417 outputs += [ all_resources_zip ]
1376 args += [ 1418 args += [
1377 "--all-resources-zip-out", 1419 "--all-resources-zip-out",
1378 rebase_path(all_resources_zip, root_build_dir), 1420 rebase_path(all_resources_zip, root_build_dir),
1379 ] 1421 ]
1380 } 1422 }
1381 1423
1424 if (defined(invoker.proguard_file)) {
1425 outputs += [ invoker.proguard_file ]
1426 args += [
1427 "--proguard-file",
1428 rebase_path(invoker.proguard_file, root_build_dir),
1429 ]
1430 }
1431
1382 if (defined(invoker.args)) { 1432 if (defined(invoker.args)) {
1383 args += invoker.args 1433 args += invoker.args
1384 } 1434 }
1385 if (defined(invoker.deps)) { 1435 if (defined(invoker.deps)) {
1386 deps = invoker.deps 1436 deps = invoker.deps
1387 } 1437 }
1388 } 1438 }
1389 } 1439 }
1390 1440
1391 template("copy_ex") { 1441 template("copy_ex") {
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
1570 ] 1620 ]
1571 args = [ 1621 args = [
1572 "--depfile", 1622 "--depfile",
1573 rebase_path(depfile, root_build_dir), 1623 rebase_path(depfile, root_build_dir),
1574 "--script-output-path", 1624 "--script-output-path",
1575 rebase_path(generated_script, root_build_dir), 1625 rebase_path(generated_script, root_build_dir),
1576 ] 1626 ]
1577 args += test_runner_args 1627 args += test_runner_args
1578 } 1628 }
1579 } 1629 }
OLDNEW
« no previous file with comments | « build/android/gyp/write_build_config.py ('k') | build/config/android/rules.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698