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 import("//build/config/android/internal_rules.gni") | 6 import("//build/config/android/internal_rules.gni") |
7 import("//tools/grit/grit_rule.gni") | 7 import("//tools/grit/grit_rule.gni") |
8 | 8 |
9 assert(is_android) | 9 assert(is_android) |
10 | 10 |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
395 # Variables | 395 # Variables |
396 # deps: Specifies the dependencies of this target. Java targets in this list | 396 # deps: Specifies the dependencies of this target. Java targets in this list |
397 # will be added to the javac classpath. Android resources in dependencies | 397 # will be added to the javac classpath. Android resources in dependencies |
398 # will be used when building this library. | 398 # will be used when building this library. |
399 # java_files: List of .java files included in this library. | 399 # java_files: List of .java files included in this library. |
400 # srcjar_deps: List of srcjar dependencies. The .java files in the srcjars | 400 # srcjar_deps: List of srcjar dependencies. The .java files in the srcjars |
401 # will be added to java_files and be included in this library. | 401 # will be added to java_files and be included in this library. |
402 # chromium_code: If true, extra static analysis warning/errors will be enabled . | 402 # chromium_code: If true, extra static analysis warning/errors will be enabled . |
403 # jar_excluded_patterns: List of patterns of .class files to exclude from the | 403 # jar_excluded_patterns: List of patterns of .class files to exclude from the |
404 # final jar. | 404 # final jar. |
405 # proguard_preprocess: If true, proguard preprocessing will be run. This can | |
newt (away)
2014/08/18 21:08:44
enable_proguard or proguard_enabled seems like a c
cjhopman
2014/08/18 21:28:27
Yeah, I'm just trying to keep the same as the exis
| |
406 # be used to remove unwanted parts of the library. | |
407 # proguard_confg: Path to the proguard config for preprocessing. | |
newt (away)
2014/08/18 21:08:44
s/confg/config
cjhopman
2014/08/18 21:28:26
Done.
| |
405 # | 408 # |
406 # Example | 409 # Example |
407 # android_library("foo_java") { | 410 # android_library("foo_java") { |
408 # java_files = [ | 411 # java_files = [ |
409 # "android/org/chromium/foo/Foo.java", | 412 # "android/org/chromium/foo/Foo.java", |
410 # "android/org/chromium/foo/FooInterface.java", | 413 # "android/org/chromium/foo/FooInterface.java", |
411 # "android/org/chromium/foo/FooService.java", | 414 # "android/org/chromium/foo/FooService.java", |
412 # ] | 415 # ] |
413 # deps = [ | 416 # deps = [ |
414 # ":bar_java" | 417 # ":bar_java" |
(...skipping 26 matching lines...) Expand all Loading... | |
441 _chromium_code = true | 444 _chromium_code = true |
442 if (defined(invoker.chromium_code)) { | 445 if (defined(invoker.chromium_code)) { |
443 _chromium_code = invoker.chromium_code | 446 _chromium_code = invoker.chromium_code |
444 } | 447 } |
445 | 448 |
446 android_java_library(target_name) { | 449 android_java_library(target_name) { |
447 chromium_code = _chromium_code | 450 chromium_code = _chromium_code |
448 java_files = invoker.java_files | 451 java_files = invoker.java_files |
449 build_config = build_config | 452 build_config = build_config |
450 | 453 |
454 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) { | |
455 proguard_preprocess = true | |
456 proguard_config = invoker.proguard_config | |
457 } | |
458 | |
451 if (defined(invoker.jar_excluded_patterns)) { | 459 if (defined(invoker.jar_excluded_patterns)) { |
452 jar_excluded_patterns = invoker.jar_excluded_patterns | 460 jar_excluded_patterns = invoker.jar_excluded_patterns |
453 } | 461 } |
454 | 462 |
455 if (defined(invoker.srcjar_deps)) { | 463 if (defined(invoker.srcjar_deps)) { |
456 srcjar_deps = invoker.srcjar_deps | 464 srcjar_deps = invoker.srcjar_deps |
457 } | 465 } |
458 } | 466 } |
459 } | 467 } |
460 | 468 |
461 | 469 |
470 # Declare an Android library target for a prebuilt jar | |
471 # | |
472 # This target creates an Android library containing java code and Android | |
473 # resources. | |
474 # | |
475 # Variables | |
476 # deps: Specifies the dependencies of this target. Java targets in this list | |
477 # will be added to the javac classpath. Android resources in dependencies | |
478 # will be used when building this library. | |
479 # jar_path: Path to the prebuilt jar. | |
480 # proguard_preprocess: If true, proguard preprocessing will be run. This can | |
481 # be used to remove unwanted parts of the library. | |
482 # proguard_confg: Path to the proguard config for preprocessing. | |
newt (away)
2014/08/18 21:08:44
s/confg/config
cjhopman
2014/08/18 21:28:26
Done.
| |
483 # | |
484 # Example | |
485 # android_java_library("foo_java") { | |
newt (away)
2014/08/18 21:08:44
update example
cjhopman
2014/08/18 21:28:27
Done.
| |
486 # jar_path = "foo.jar" | |
487 # deps = [ | |
488 # ":foo_resources", | |
489 # ":bar_java" | |
490 # ] | |
491 # } | |
492 template("android_java_prebuilt") { | |
493 assert(defined(invoker.jar_path)) | |
494 _base_path = "${target_gen_dir}/$target_name" | |
495 _jar_path = _base_path + ".jar" | |
496 _dex_path = _base_path + ".dex.jar" | |
497 _build_config = _base_path + ".build_config" | |
498 | |
499 write_build_config("${target_name}__build_config") { | |
500 type = "android_library" | |
501 | |
502 deps = [] | |
503 if (defined(invoker.deps)) { | |
504 deps += invoker.deps | |
505 } | |
506 build_config = _build_config | |
507 jar_path = _jar_path | |
508 dex_path = _dex_path | |
509 } | |
510 | |
511 java_prebuilt("${target_name}__process_jar") { | |
512 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) { | |
513 proguard_preprocess = true | |
514 proguard_config = invoker.proguard_config | |
515 } | |
516 | |
517 build_config = _build_config | |
518 input_jar_path = invoker.jar_path | |
519 output_jar_path = _jar_path | |
520 } | |
521 | |
522 dex("${target_name}__dex") { | |
523 sources = [_jar_path] | |
524 output = _dex_path | |
525 } | |
526 | |
527 group(target_name) { | |
528 deps = [ | |
529 ":${target_name}__dex", | |
530 ] | |
531 } | |
532 } | |
533 | |
534 | |
535 | |
462 # Declare an Android apk target | 536 # Declare an Android apk target |
463 # | 537 # |
464 # This target creates an Android APK containing java code, resources, assets, | 538 # This target creates an Android APK containing java code, resources, assets, |
465 # and (possibly) native libraries. | 539 # and (possibly) native libraries. |
466 # | 540 # |
467 # Variables | 541 # Variables |
468 # android_manifest: Path to AndroidManifest.xml. | 542 # android_manifest: Path to AndroidManifest.xml. |
469 # deps: List of dependencies. All Android java resources and libraries in the | 543 # deps: List of dependencies. All Android java resources and libraries in the |
470 # "transitive closure" of these dependencies will be included in the apk. | 544 # "transitive closure" of these dependencies will be included in the apk. |
471 # Note: this "transitive closure" actually only includes such targets if | 545 # Note: this "transitive closure" actually only includes such targets if |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
617 "//testing/android/java/src/org/chromium/native_test/ChromeNativeTestActiv ity.java" | 691 "//testing/android/java/src/org/chromium/native_test/ChromeNativeTestActiv ity.java" |
618 ] | 692 ] |
619 android_manifest = "//testing/android/java/AndroidManifest.xml" | 693 android_manifest = "//testing/android/java/AndroidManifest.xml" |
620 unittests_outputs = get_target_outputs(invoker.unittests_dep) | 694 unittests_outputs = get_target_outputs(invoker.unittests_dep) |
621 native_libs = [unittests_outputs[0]] | 695 native_libs = [unittests_outputs[0]] |
622 if (defined(invoker.deps)) { | 696 if (defined(invoker.deps)) { |
623 deps = invoker.deps | 697 deps = invoker.deps |
624 } | 698 } |
625 } | 699 } |
626 } | 700 } |
OLD | NEW |