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("//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 | 9 |
10 rebased_android_sdk = rebase_path(android_sdk, root_build_dir) | 10 rebased_android_sdk = rebase_path(android_sdk, root_build_dir) |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 assert(defined(invoker.output)) | 171 assert(defined(invoker.output)) |
172 action(target_name) { | 172 action(target_name) { |
173 script = "//build/android/gyp/dex.py" | 173 script = "//build/android/gyp/dex.py" |
174 depfile = "$target_gen_dir/$target_name.d" | 174 depfile = "$target_gen_dir/$target_name.d" |
175 sources = invoker.sources | 175 sources = invoker.sources |
176 outputs = [depfile, invoker.output] | 176 outputs = [depfile, invoker.output] |
177 if (defined(invoker.inputs)) { | 177 if (defined(invoker.inputs)) { |
178 inputs = invoker.inputs | 178 inputs = invoker.inputs |
179 } | 179 } |
180 | 180 |
| 181 if (defined(invoker.deps)) { |
| 182 deps = invoker.deps |
| 183 } |
| 184 |
181 rebased_output = rebase_path(invoker.output, root_build_dir) | 185 rebased_output = rebase_path(invoker.output, root_build_dir) |
182 | 186 |
183 args = [ | 187 args = [ |
184 "--depfile", rebase_path(depfile, root_build_dir), | 188 "--depfile", rebase_path(depfile, root_build_dir), |
185 "--android-sdk-tools", rebased_android_sdk_build_tools, | 189 "--android-sdk-tools", rebased_android_sdk_build_tools, |
186 "--dex-path", rebased_output, | 190 "--dex-path", rebased_output, |
187 ] | 191 ] |
188 | 192 |
189 if (defined(invoker.no_locals) && invoker.no_locals) { | 193 if (defined(invoker.no_locals) && invoker.no_locals) { |
190 args += [ | 194 args += [ |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
509 # This adds Android-specific parts to the java_library template. | 513 # This adds Android-specific parts to the java_library template. |
510 # | 514 # |
511 # Runs Android lint against the compiled java files. | 515 # Runs Android lint against the compiled java files. |
512 # Dexes the output jar for inclusion in an APK. | 516 # Dexes the output jar for inclusion in an APK. |
513 template("android_java_library") { | 517 template("android_java_library") { |
514 assert(defined(invoker.java_files) || defined(invoker.DEPRECATED_java_in_dir)) | 518 assert(defined(invoker.java_files) || defined(invoker.DEPRECATED_java_in_dir)) |
515 assert(defined(invoker.build_config)) | 519 assert(defined(invoker.build_config)) |
516 assert(defined(invoker.jar_path)) | 520 assert(defined(invoker.jar_path)) |
517 assert(defined(invoker.dex_path)) | 521 assert(defined(invoker.dex_path)) |
518 | 522 |
| 523 _srcjar_deps = [] |
| 524 if (defined(invoker.srcjar_deps)) { |
| 525 _srcjar_deps = invoker.srcjar_deps |
| 526 } |
| 527 |
519 _java_files = [] | 528 _java_files = [] |
520 if (defined(invoker.java_files)) { | 529 if (defined(invoker.java_files)) { |
521 _java_files = invoker.java_files | 530 _java_files = invoker.java_files |
522 } else { | 531 } else { |
523 _java_files_build_rel = exec_script( | 532 _java_files_build_rel = exec_script( |
524 "//build/android/gyp/find.py", | 533 "//build/android/gyp/find.py", |
525 [ | 534 [ |
526 "--pattern", | 535 "--pattern", |
527 "*.java", | 536 "*.java", |
528 rebase_path(invoker.DEPRECATED_java_in_dir, root_build_dir) | 537 rebase_path(invoker.DEPRECATED_java_in_dir, root_build_dir) |
529 ], | 538 ], |
530 "list lines" | 539 "list lines" |
531 ) | 540 ) |
532 _java_files = rebase_path(_java_files_build_rel, ".", root_build_dir) | 541 _java_files = rebase_path(_java_files_build_rel, ".", root_build_dir) |
533 } | 542 } |
| 543 assert(_java_files != [] || _srcjar_deps != []) |
534 | 544 |
535 _jar_path = invoker.jar_path | 545 _jar_path = invoker.jar_path |
536 _dex_path = invoker.dex_path | 546 _dex_path = invoker.dex_path |
537 | 547 |
538 _android_manifest = "//build/android/AndroidManifest.xml" | 548 _android_manifest = "//build/android/AndroidManifest.xml" |
539 if (defined(invoker.android_manifest)) { | 549 if (defined(invoker.android_manifest)) { |
540 _android_manifest = invoker.android_manifest | 550 _android_manifest = invoker.android_manifest |
541 } | 551 } |
542 assert(_android_manifest != "") | 552 assert(_android_manifest != "") |
543 | 553 |
544 _final_deps = [] | 554 _final_deps = [] |
| 555 _final_datadeps = [] |
545 | 556 |
546 java_library("${target_name}__java_library") { | 557 java_library("${target_name}__java_library") { |
547 jar_path = _jar_path | 558 jar_path = _jar_path |
548 if (defined(invoker.jar_excluded_patterns)) { | 559 if (defined(invoker.jar_excluded_patterns)) { |
549 jar_excluded_patterns = invoker.jar_excluded_patterns | 560 jar_excluded_patterns = invoker.jar_excluded_patterns |
550 } | 561 } |
551 build_config = invoker.build_config | 562 build_config = invoker.build_config |
552 java_files = _java_files | 563 java_files = _java_files |
| 564 srcjar_deps = _srcjar_deps |
553 | 565 |
554 if (defined(invoker.srcjar_deps)) { | |
555 srcjar_deps = invoker.srcjar_deps | |
556 } | |
557 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) { | 566 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) { |
558 proguard_preprocess = invoker.proguard_preprocess | 567 proguard_preprocess = invoker.proguard_preprocess |
559 proguard_config = invoker.proguard_config | 568 proguard_config = invoker.proguard_config |
560 } | 569 } |
| 570 |
| 571 if (defined(invoker.dist_jar_path)) { |
| 572 dist_jar_path = invoker.dist_jar_path |
| 573 } |
561 } | 574 } |
562 | 575 |
563 if (defined(invoker.chromium_code) && invoker.chromium_code) { | 576 if (defined(invoker.chromium_code) && invoker.chromium_code) { |
564 _final_deps += [ ":${target_name}__lint" ] | 577 _final_datadeps += [ ":${target_name}__lint" ] |
565 android_lint("${target_name}__lint") { | 578 android_lint("${target_name}__lint") { |
566 android_manifest = _android_manifest | 579 android_manifest = _android_manifest |
567 jar_path = _jar_path | 580 jar_path = _jar_path |
568 java_files = _java_files | 581 java_files = _java_files |
569 } | 582 } |
570 } | 583 } |
571 | 584 |
572 dex("${target_name}__dex") { | 585 dex("${target_name}__dex") { |
573 sources = [_jar_path] | 586 sources = [_jar_path] |
574 output = _dex_path | 587 output = _dex_path |
575 } | 588 } |
576 | 589 |
577 group(target_name) { | 590 group(target_name) { |
578 deps = [ | 591 deps = [ |
579 ":${target_name}__java_library", | 592 ":${target_name}__java_library", |
580 ":${target_name}__dex", | 593 ":${target_name}__dex", |
581 ] + _final_deps | 594 ] + _final_deps + _final_datadeps |
582 } | 595 } |
583 } | 596 } |
584 | 597 |
585 # Runs process_resources.py | 598 # Runs process_resources.py |
586 template("process_resources") { | 599 template("process_resources") { |
587 zip_path = invoker.zip_path | 600 zip_path = invoker.zip_path |
588 srcjar_path = invoker.srcjar_path | 601 srcjar_path = invoker.srcjar_path |
589 build_config = invoker.build_config | 602 build_config = invoker.build_config |
590 resource_dirs = invoker.resource_dirs | 603 resource_dirs = invoker.resource_dirs |
591 android_manifest = invoker.android_manifest | 604 android_manifest = invoker.android_manifest |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 "--dest", rebase_path(invoker.dest, root_build_dir), | 691 "--dest", rebase_path(invoker.dest, root_build_dir), |
679 ] | 692 ] |
680 if (defined(invoker.args)) { | 693 if (defined(invoker.args)) { |
681 args += invoker.args | 694 args += invoker.args |
682 } | 695 } |
683 if (defined(invoker.clear_dir) && invoker.clear_dir) { | 696 if (defined(invoker.clear_dir) && invoker.clear_dir) { |
684 args += ["--clear"] | 697 args += ["--clear"] |
685 } | 698 } |
686 } | 699 } |
687 } | 700 } |
OLD | NEW |