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 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 # Declare an Android gtest apk | 588 # Declare an Android gtest apk |
589 # | 589 # |
590 # This target creates an Android apk for running gtest-based unittests. | 590 # This target creates an Android apk for running gtest-based unittests. |
591 # | 591 # |
592 # Variables | 592 # Variables |
593 # deps: Specifies the dependencies of this target. These will be passed to | 593 # deps: Specifies the dependencies of this target. These will be passed to |
594 # the underlying android_apk invocation and should include the java and | 594 # the underlying android_apk invocation and should include the java and |
595 # resource dependencies of the apk. | 595 # resource dependencies of the apk. |
596 # unittests_dep: This should be the label of the gtest native target. This | 596 # unittests_dep: This should be the label of the gtest native target. This |
597 # target must be defined previously in the same file. | 597 # target must be defined previously in the same file. |
| 598 # unittests_binary: The name of the binary produced by the unittests_dep |
| 599 # target, relative to the root build directory. If unspecified, it assumes |
| 600 # the name of the unittests_dep target (which will be correct unless that |
| 601 # target specifies an "output_name". |
| 602 # TODO(brettw) make this automatic by allowing get_target_outputs to |
| 603 # support executables. |
598 # | 604 # |
599 # Example | 605 # Example |
600 # unittest_apk("foo_unittests_apk") { | 606 # unittest_apk("foo_unittests_apk") { |
601 # deps = [ ":foo_java", ":foo_resources" ] | 607 # deps = [ ":foo_java", ":foo_resources" ] |
602 # unittests_dep = ":foo_unittests" | 608 # unittests_dep = ":foo_unittests" |
603 # } | 609 # } |
604 template("unittest_apk") { | 610 template("unittest_apk") { |
| 611 assert(defined(invoker.unittests_dep), "Need unittests_dep for $target_name") |
| 612 |
605 test_suite_name = get_label_info(invoker.unittests_dep, "name") | 613 test_suite_name = get_label_info(invoker.unittests_dep, "name") |
| 614 |
| 615 if (defined(invoker.unittests_binary)) { |
| 616 unittests_binary = root_out_dir + "/" + invoker.unittests_binary |
| 617 } else { |
| 618 unittests_binary = root_out_dir + "/" + test_suite_name |
| 619 } |
| 620 |
606 android_apk(target_name) { | 621 android_apk(target_name) { |
607 apk_name = test_suite_name | 622 apk_name = test_suite_name |
608 final_apk_path = "$root_build_dir/${apk_name}_apk/${apk_name}-debug.apk" | 623 final_apk_path = "$root_build_dir/${apk_name}_apk/${apk_name}-debug.apk" |
609 java_files = [ | 624 java_files = [ |
610 "//testing/android/java/src/org/chromium/native_test/ChromeNativeTestActiv
ity.java" | 625 "//testing/android/java/src/org/chromium/native_test/ChromeNativeTestActiv
ity.java" |
611 ] | 626 ] |
612 android_manifest = "//testing/android/java/AndroidManifest.xml" | 627 android_manifest = "//testing/android/java/AndroidManifest.xml" |
613 unittests_outputs = get_target_outputs(invoker.unittests_dep) | 628 unittests_outputs = [ unittests_binary ] |
614 native_libs = [unittests_outputs[0]] | 629 native_libs = [unittests_outputs[0]] |
615 if (defined(invoker.deps)) { | 630 if (defined(invoker.deps)) { |
616 deps = invoker.deps | 631 deps = invoker.deps |
617 } | 632 } |
618 } | 633 } |
619 } | 634 } |
OLD | NEW |