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

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

Issue 386473002: Add dexing for libraries and apks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@gn-apk-first
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
« no previous file with comments | « build/config/android/internal_rules.gni ('k') | no next file » | 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 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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 # ] 418 # ]
419 # jar_excluded_patterns = [ 419 # jar_excluded_patterns = [
420 # "*/FooService.class", "*/FooService##*.class" 420 # "*/FooService.class", "*/FooService##*.class"
421 # ] 421 # ]
422 # } 422 # }
423 template("android_library") { 423 template("android_library") {
424 assert(defined(invoker.java_files)) 424 assert(defined(invoker.java_files))
425 base_path = "$target_gen_dir/$target_name" 425 base_path = "$target_gen_dir/$target_name"
426 build_config = base_path + ".build_config" 426 build_config = base_path + ".build_config"
427 jar_path = base_path + ".jar" 427 jar_path = base_path + ".jar"
428 dex_path = base_path + ".dex.jar"
428 429
429 write_build_config("${target_name}__build_config") { 430 write_build_config("${target_name}__build_config") {
430 type = "android_library" 431 type = "android_library"
431 432
432 deps = [] 433 deps = []
433 if (defined(invoker.deps)) { 434 if (defined(invoker.deps)) {
434 deps += invoker.deps 435 deps += invoker.deps
435 } 436 }
436 437
437 # base_path 438 # base_path
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 # srcjar_deps = [ 489 # srcjar_deps = [
489 # ":foo_generated_enum" 490 # ":foo_generated_enum"
490 # ] 491 # ]
491 # native_libs = [ 492 # native_libs = [
492 # native_lib_path 493 # native_lib_path
493 # ] 494 # ]
494 # } 495 # }
495 template("android_apk") { 496 template("android_apk") {
496 gen_dir = "$target_gen_dir/$target_name" 497 gen_dir = "$target_gen_dir/$target_name"
497 base_path = "$gen_dir/$target_name" 498 base_path = "$gen_dir/$target_name"
498 build_config = base_path + ".build_config" 499 build_config = "$base_path.build_config"
499 resource_zip_path = base_path + ".resources.zip" 500 resources_zip_path = "$base_path.resources.zip"
500 all_resources_zip_path = base_path + ".resources.all.zip" 501 all_resources_zip_path = "$base_path.resources.all.zip"
501 resource_srcjar_path = base_path + ".resources.srcjar" 502 resource_srcjar_path = "$base_path.resources.srcjar"
502 jar_path = base_path + ".jar" 503 jar_path = "$base_path.jar"
504 final_dex_path = "$gen_dir/classes.dex"
503 505
504 # Just mark these as used for now. 506 # Just mark these as used for now.
505 assert(!defined(invoker.native_libs) 507 assert(!defined(invoker.native_libs)
506 || invoker.native_libs == [] || true) 508 || invoker.native_libs == [] || true)
507 assert(!defined(invoker.final_apk_path) 509 assert(!defined(invoker.final_apk_path)
508 || invoker.final_apk_path == "" || true) 510 || invoker.final_apk_path == "" || true)
509 511
510 final_deps = []
511 512
512 # TODO(cjhopman): Remove this once we correctly generate the real 513 # TODO(cjhopman): Remove this once we correctly generate the real
513 # NativeLibraries.java 514 # NativeLibraries.java
514 srcjar_deps = [ "//base:base_native_libraries_gen" ] 515 srcjar_deps = [ "//base:base_native_libraries_gen" ]
515 if (defined(invoker.srcjar_deps)) { 516 if (defined(invoker.srcjar_deps)) {
516 srcjar_deps += invoker.srcjar_deps 517 srcjar_deps += invoker.srcjar_deps
517 } 518 }
518 519
519 write_build_config("${target_name}__build_config") { 520 write_build_config("${target_name}__build_config") {
520 type = "android_apk" 521 type = "android_apk"
521 srcjar = resource_srcjar_path 522 srcjar = resource_srcjar_path
522 resources_zip = resource_zip_path 523 dex_path = final_dex_path
524 resources_zip = resources_zip_path
523 525
524 if (defined(invoker.deps)) { 526 if (defined(invoker.deps)) {
525 deps = invoker.deps 527 deps = invoker.deps
526 } 528 }
527 } 529 }
528 530
531 final_deps = []
532
529 final_deps += [":${target_name}__process_resources"] 533 final_deps += [":${target_name}__process_resources"]
530 process_resources("${target_name}__process_resources") { 534 process_resources("${target_name}__process_resources") {
531 android_manifest = invoker.android_manifest 535 android_manifest = invoker.android_manifest
532 536
533 resource_dirs = ["//build/android/ant/empty/res"] 537 resource_dirs = ["//build/android/ant/empty/res"]
534 zip_path = resource_zip_path 538 zip_path = resources_zip_path
535 srcjar_path = resource_srcjar_path 539 srcjar_path = resource_srcjar_path
536 540
537 generate_constant_ids = true 541 generate_constant_ids = true
538 } 542 }
539 543
544 rebased_build_config = rebase_path(build_config, root_build_dir)
545
540 final_deps += [":${target_name}__java"] 546 final_deps += [":${target_name}__java"]
541 android_java_library("${target_name}__java") { 547 android_java_library("${target_name}__java") {
542 java_files = invoker.java_files 548 java_files = invoker.java_files
549 dex_path = base_path + ".dex.jar"
543 } 550 }
544 551
545 # TODO(cjhopman): dex 552 final_deps += [":${target_name}__final_dex"]
546 # TODO(cjhopman): native 553 dex("${target_name}__final_dex") {
547 # TODO(cjhopman): create+finalize apk 554 sources = [jar_path]
555 inputs = [build_config]
556 output = final_dex_path
557 dex_arg_key = "${rebased_build_config}:apk_dex:dependency_dex_files"
558 args = ["--inputs=@FileArg($dex_arg_key)"]
559 }
548 560
549 group(target_name) { 561 group(target_name) {
550 deps = final_deps 562 deps = final_deps
551 } 563 }
552 } 564 }
553 565
554 566
555 # Declare an Android gtest apk 567 # Declare an Android gtest apk
556 # 568 #
557 # This target creates an Android apk for running gtest-based unittests. 569 # This target creates an Android apk for running gtest-based unittests.
(...skipping 19 matching lines...) Expand all
577 "//testing/android/java/src/org/chromium/native_test/ChromeNativeTestActiv ity.java" 589 "//testing/android/java/src/org/chromium/native_test/ChromeNativeTestActiv ity.java"
578 ] 590 ]
579 android_manifest = "//testing/android/java/AndroidManifest.xml" 591 android_manifest = "//testing/android/java/AndroidManifest.xml"
580 unittests_outputs = get_target_outputs(invoker.unittests_dep) 592 unittests_outputs = get_target_outputs(invoker.unittests_dep)
581 native_libs = [unittests_outputs[0]] 593 native_libs = [unittests_outputs[0]]
582 if (defined(invoker.deps)) { 594 if (defined(invoker.deps)) {
583 deps = invoker.deps 595 deps = invoker.deps
584 } 596 }
585 } 597 }
586 } 598 }
OLDNEW
« no previous file with comments | « build/config/android/internal_rules.gni ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698