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

Side by Side Diff: build/config/android/rules.gni

Issue 484813002: Add support for prebuilt jars (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn-lint
Patch Set: Created 6 years, 4 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
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 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 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 # Variables 401 # Variables
402 # deps: Specifies the dependencies of this target. Java targets in this list 402 # deps: Specifies the dependencies of this target. Java targets in this list
403 # will be added to the javac classpath. Android resources in dependencies 403 # will be added to the javac classpath. Android resources in dependencies
404 # will be used when building this library. 404 # will be used when building this library.
405 # java_files: List of .java files included in this library. 405 # java_files: List of .java files included in this library.
406 # srcjar_deps: List of srcjar dependencies. The .java files in the srcjars 406 # srcjar_deps: List of srcjar dependencies. The .java files in the srcjars
407 # will be added to java_files and be included in this library. 407 # will be added to java_files and be included in this library.
408 # chromium_code: If true, extra static analysis warning/errors will be enabled . 408 # chromium_code: If true, extra static analysis warning/errors will be enabled .
409 # jar_excluded_patterns: List of patterns of .class files to exclude from the 409 # jar_excluded_patterns: List of patterns of .class files to exclude from the
410 # final jar. 410 # final jar.
411 # proguard_preprocess: If true, proguard preprocessing will be run. This can
412 # be used to remove unwanted parts of the library.
413 # proguard_config: Path to the proguard config for preprocessing.
411 # 414 #
412 # Example 415 # Example
413 # android_library("foo_java") { 416 # android_library("foo_java") {
414 # java_files = [ 417 # java_files = [
415 # "android/org/chromium/foo/Foo.java", 418 # "android/org/chromium/foo/Foo.java",
416 # "android/org/chromium/foo/FooInterface.java", 419 # "android/org/chromium/foo/FooInterface.java",
417 # "android/org/chromium/foo/FooService.java", 420 # "android/org/chromium/foo/FooService.java",
418 # ] 421 # ]
419 # deps = [ 422 # deps = [
420 # ":bar_java" 423 # ":bar_java"
(...skipping 26 matching lines...) Expand all
447 _chromium_code = true 450 _chromium_code = true
448 if (defined(invoker.chromium_code)) { 451 if (defined(invoker.chromium_code)) {
449 _chromium_code = invoker.chromium_code 452 _chromium_code = invoker.chromium_code
450 } 453 }
451 454
452 android_java_library(target_name) { 455 android_java_library(target_name) {
453 chromium_code = _chromium_code 456 chromium_code = _chromium_code
454 java_files = invoker.java_files 457 java_files = invoker.java_files
455 build_config = build_config 458 build_config = build_config
456 459
460 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) {
461 proguard_preprocess = true
462 proguard_config = invoker.proguard_config
463 }
464
457 if (defined(invoker.jar_excluded_patterns)) { 465 if (defined(invoker.jar_excluded_patterns)) {
458 jar_excluded_patterns = invoker.jar_excluded_patterns 466 jar_excluded_patterns = invoker.jar_excluded_patterns
459 } 467 }
460 468
461 if (defined(invoker.srcjar_deps)) { 469 if (defined(invoker.srcjar_deps)) {
462 srcjar_deps = invoker.srcjar_deps 470 srcjar_deps = invoker.srcjar_deps
463 } 471 }
464 } 472 }
465 } 473 }
466 474
467 475
476 # Declare an Android library target for a prebuilt jar
477 #
478 # This target creates an Android library containing java code and Android
479 # resources.
480 #
481 # Variables
482 # deps: Specifies the dependencies of this target. Java targets in this list
483 # will be added to the javac classpath. Android resources in dependencies
484 # will be used when building this library.
485 # jar_path: Path to the prebuilt jar.
486 # proguard_preprocess: If true, proguard preprocessing will be run. This can
487 # be used to remove unwanted parts of the library.
488 # proguard_config: Path to the proguard config for preprocessing.
489 #
490 # Example
491 # android_java_prebuilt("foo_java") {
492 # jar_path = "foo.jar"
493 # deps = [
494 # ":foo_resources",
495 # ":bar_java"
496 # ]
497 # }
498 template("android_java_prebuilt") {
499 assert(defined(invoker.jar_path))
500 _base_path = "${target_gen_dir}/$target_name"
501 _jar_path = _base_path + ".jar"
502 _dex_path = _base_path + ".dex.jar"
503 _build_config = _base_path + ".build_config"
504
505 write_build_config("${target_name}__build_config") {
506 type = "android_library"
507
508 deps = []
509 if (defined(invoker.deps)) {
510 deps += invoker.deps
511 }
512 build_config = _build_config
513 jar_path = _jar_path
514 dex_path = _dex_path
515 }
516
517 java_prebuilt("${target_name}__process_jar") {
518 if (defined(invoker.proguard_preprocess) && invoker.proguard_preprocess) {
519 proguard_preprocess = true
520 proguard_config = invoker.proguard_config
521 }
522
523 build_config = _build_config
524 input_jar_path = invoker.jar_path
525 output_jar_path = _jar_path
526 }
527
528 dex("${target_name}__dex") {
529 sources = [_jar_path]
530 output = _dex_path
531 }
532
533 group(target_name) {
534 deps = [
535 ":${target_name}__dex",
536 ]
537 }
538 }
539
540
541
468 # Declare an Android apk target 542 # Declare an Android apk target
469 # 543 #
470 # This target creates an Android APK containing java code, resources, assets, 544 # This target creates an Android APK containing java code, resources, assets,
471 # and (possibly) native libraries. 545 # and (possibly) native libraries.
472 # 546 #
473 # Variables 547 # Variables
474 # android_manifest: Path to AndroidManifest.xml. 548 # android_manifest: Path to AndroidManifest.xml.
475 # deps: List of dependencies. All Android java resources and libraries in the 549 # deps: List of dependencies. All Android java resources and libraries in the
476 # "transitive closure" of these dependencies will be included in the apk. 550 # "transitive closure" of these dependencies will be included in the apk.
477 # Note: this "transitive closure" actually only includes such targets if 551 # Note: this "transitive closure" actually only includes such targets if
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
696 "//testing/android/java/src/org/chromium/native_test/ChromeNativeTestActiv ity.java" 770 "//testing/android/java/src/org/chromium/native_test/ChromeNativeTestActiv ity.java"
697 ] 771 ]
698 android_manifest = "//testing/android/java/AndroidManifest.xml" 772 android_manifest = "//testing/android/java/AndroidManifest.xml"
699 unittests_outputs = [ unittests_binary ] 773 unittests_outputs = [ unittests_binary ]
700 native_libs = [unittests_outputs[0]] 774 native_libs = [unittests_outputs[0]]
701 if (defined(invoker.deps)) { 775 if (defined(invoker.deps)) {
702 deps = invoker.deps 776 deps = invoker.deps
703 } 777 }
704 } 778 }
705 } 779 }
OLDNEW
« no previous file with comments | « build/config/android/internal_rules.gni ('k') | build/secondary/third_party/android_tools/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698