xref: /aosp_15_r20/tools/asuite/atest/bazel/runner/Android.bp (revision c2e18aaa1096c836b086f94603d04f4eb9cf37f5)
1*c2e18aaaSAndroid Build Coastguard Worker// Copyright (C) 2022 The Android Open Source Project
2*c2e18aaaSAndroid Build Coastguard Worker//
3*c2e18aaaSAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License");
4*c2e18aaaSAndroid Build Coastguard Worker// you may not use this file except in compliance with the License.
5*c2e18aaaSAndroid Build Coastguard Worker// You may obtain a copy of the License at
6*c2e18aaaSAndroid Build Coastguard Worker//
7*c2e18aaaSAndroid Build Coastguard Worker//      http://www.apache.org/licenses/LICENSE-2.0
8*c2e18aaaSAndroid Build Coastguard Worker//
9*c2e18aaaSAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software
10*c2e18aaaSAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS,
11*c2e18aaaSAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*c2e18aaaSAndroid Build Coastguard Worker// See the License for the specific language governing permissions and
13*c2e18aaaSAndroid Build Coastguard Worker// limitations under the License.
14*c2e18aaaSAndroid Build Coastguard Worker
15*c2e18aaaSAndroid Build Coastguard Workerpackage {
16*c2e18aaaSAndroid Build Coastguard Worker    default_applicable_licenses: ["Android-Apache-2.0"],
17*c2e18aaaSAndroid Build Coastguard Worker}
18*c2e18aaaSAndroid Build Coastguard Worker
19*c2e18aaaSAndroid Build Coastguard Workerjava_library_host {
20*c2e18aaaSAndroid Build Coastguard Worker    name: "bazel-test-runner",
21*c2e18aaaSAndroid Build Coastguard Worker    srcs: [
22*c2e18aaaSAndroid Build Coastguard Worker        "src/com/android/tradefed/testtype/bazel/BazelTest.java",
23*c2e18aaaSAndroid Build Coastguard Worker        "src/com/android/tradefed/testtype/bazel/BepFileTailer.java",
24*c2e18aaaSAndroid Build Coastguard Worker        "src/com/android/tradefed/testtype/bazel/ForwardingTestListener.java",
25*c2e18aaaSAndroid Build Coastguard Worker        "src/com/android/tradefed/testtype/bazel/BazelTestListener.java",
26*c2e18aaaSAndroid Build Coastguard Worker        "src/com/android/tradefed/testtype/bazel/NullTestListener.java",
27*c2e18aaaSAndroid Build Coastguard Worker        "src/com/android/tradefed/testtype/bazel/InvocationLogCollector.java",
28*c2e18aaaSAndroid Build Coastguard Worker        "src/com/android/tradefed/testtype/bazel/LogPathUpdatingListener.java",
29*c2e18aaaSAndroid Build Coastguard Worker        "src/com/android/tradefed/testtype/bazel/TestListeners.java",
30*c2e18aaaSAndroid Build Coastguard Worker        "src/com/android/tradefed/testtype/bazel/SparseTestListener.java",
31*c2e18aaaSAndroid Build Coastguard Worker        "src/main/protobuf/*.proto",
32*c2e18aaaSAndroid Build Coastguard Worker    ],
33*c2e18aaaSAndroid Build Coastguard Worker    // b/267831518: Pin tradefed and dependencies to Java 11.
34*c2e18aaaSAndroid Build Coastguard Worker    java_version: "11",
35*c2e18aaaSAndroid Build Coastguard Worker    libs: [
36*c2e18aaaSAndroid Build Coastguard Worker        "tradefed",
37*c2e18aaaSAndroid Build Coastguard Worker    ],
38*c2e18aaaSAndroid Build Coastguard Worker    java_resource_dirs: [
39*c2e18aaaSAndroid Build Coastguard Worker        "config",
40*c2e18aaaSAndroid Build Coastguard Worker    ],
41*c2e18aaaSAndroid Build Coastguard Worker    proto: {
42*c2e18aaaSAndroid Build Coastguard Worker        type: "full",
43*c2e18aaaSAndroid Build Coastguard Worker        include_dirs: [
44*c2e18aaaSAndroid Build Coastguard Worker            "external/protobuf/src",
45*c2e18aaaSAndroid Build Coastguard Worker        ],
46*c2e18aaaSAndroid Build Coastguard Worker        canonical_path_from_root: false,
47*c2e18aaaSAndroid Build Coastguard Worker    },
48*c2e18aaaSAndroid Build Coastguard Worker}
49*c2e18aaaSAndroid Build Coastguard Worker
50*c2e18aaaSAndroid Build Coastguard Workerjava_genrule_host {
51*c2e18aaaSAndroid Build Coastguard Worker    name: "empty-bazel-test-suite",
52*c2e18aaaSAndroid Build Coastguard Worker    cmd: "BAZEL_SUITE_DIR=$(genDir)/android-bazel-suite && " +
53*c2e18aaaSAndroid Build Coastguard Worker        "mkdir \"$${BAZEL_SUITE_DIR}\" && " +
54*c2e18aaaSAndroid Build Coastguard Worker        "mkdir \"$${BAZEL_SUITE_DIR}\"/tools && " +
55*c2e18aaaSAndroid Build Coastguard Worker        "mkdir \"$${BAZEL_SUITE_DIR}\"/testcases && " +
56*c2e18aaaSAndroid Build Coastguard Worker        "cp $(location :tradefed) \"$${BAZEL_SUITE_DIR}\"/tools && " +
57*c2e18aaaSAndroid Build Coastguard Worker        "cp $(location :compatibility-host-util) \"$${BAZEL_SUITE_DIR}\"/tools && " +
58*c2e18aaaSAndroid Build Coastguard Worker        "cp $(location :compatibility-tradefed) \"$${BAZEL_SUITE_DIR}\"/tools && " +
59*c2e18aaaSAndroid Build Coastguard Worker        "cp $(location :bazel-test-runner) \"$${BAZEL_SUITE_DIR}\"/testcases && " +
60*c2e18aaaSAndroid Build Coastguard Worker        "$(location soong_zip) -o $(out) -d -C $(genDir) -D \"$${BAZEL_SUITE_DIR}\" -sha256",
61*c2e18aaaSAndroid Build Coastguard Worker    out: ["empty-bazel-test-suite.zip"],
62*c2e18aaaSAndroid Build Coastguard Worker    srcs: [
63*c2e18aaaSAndroid Build Coastguard Worker        ":tradefed",
64*c2e18aaaSAndroid Build Coastguard Worker        ":bazel-test-runner",
65*c2e18aaaSAndroid Build Coastguard Worker        ":compatibility-host-util",
66*c2e18aaaSAndroid Build Coastguard Worker        ":compatibility-tradefed",
67*c2e18aaaSAndroid Build Coastguard Worker    ],
68*c2e18aaaSAndroid Build Coastguard Worker    tools: [
69*c2e18aaaSAndroid Build Coastguard Worker        "soong_zip",
70*c2e18aaaSAndroid Build Coastguard Worker    ],
71*c2e18aaaSAndroid Build Coastguard Worker    dist: {
72*c2e18aaaSAndroid Build Coastguard Worker        targets: ["empty-bazel-test-suite"],
73*c2e18aaaSAndroid Build Coastguard Worker    },
74*c2e18aaaSAndroid Build Coastguard Worker}
75*c2e18aaaSAndroid Build Coastguard Worker
76*c2e18aaaSAndroid Build Coastguard Workerjava_test_host {
77*c2e18aaaSAndroid Build Coastguard Worker    name: "bazel-test-runner-tests",
78*c2e18aaaSAndroid Build Coastguard Worker    srcs: [
79*c2e18aaaSAndroid Build Coastguard Worker        "tests/src/com/android/tradefed/testtype/bazel/BazelTestTest.java",
80*c2e18aaaSAndroid Build Coastguard Worker    ],
81*c2e18aaaSAndroid Build Coastguard Worker    static_libs: [
82*c2e18aaaSAndroid Build Coastguard Worker        "bazel-test-runner",
83*c2e18aaaSAndroid Build Coastguard Worker        "tradefed",
84*c2e18aaaSAndroid Build Coastguard Worker        "mockito",
85*c2e18aaaSAndroid Build Coastguard Worker        "objenesis",
86*c2e18aaaSAndroid Build Coastguard Worker    ],
87*c2e18aaaSAndroid Build Coastguard Worker    test_options: {
88*c2e18aaaSAndroid Build Coastguard Worker        unit_test: true,
89*c2e18aaaSAndroid Build Coastguard Worker    },
90*c2e18aaaSAndroid Build Coastguard Worker}
91