1// Copyright (C) 2018 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package {
16    default_applicable_licenses: ["Android-Apache-2.0"],
17}
18
19java_library {
20    name: "cts-vmtests-dot",
21    libs: [ "junit" ],
22    srcs: [ "src/dot/**/*.java" ],
23    installable: false,
24    include_srcs: true,
25    host_supported: true,
26}
27
28java_binary_host {
29    name: "vmtests-buildutil",
30    static_libs: [ "cts-vmtests-dot", "junit" ],
31    srcs: [
32        "build/src/util/build/BuildCTSHostSources.java",
33        "build/src/util/build/BuildCTSMainsSources.java",
34        "build/src/util/build/BuildUtilBase.java",
35        "build/src/util/build/FileUtil.java",
36        "build/src/util/build/JUnitTestCollector.java",
37    ],
38    wrapper: "etc/vmtests-buildutil.sh",
39}
40
41java_genrule_host {
42    name: "vmtests_generated_host_test_sources",
43    tools: [
44        "vmtests-buildutil",
45        "soong_zip",
46    ],
47    cmd: "$(location vmtests-buildutil) util.build.BuildCTSHostSources $(genDir) " +
48         " && $(location soong_zip) -jar -o $(out) -C $(genDir) -D $(genDir)/dot",
49    out: ["vmtests.host.generated.srcjar"],
50}
51
52java_library_host {
53    name: "host-cts-vmtests",
54    libs: [
55        "junit",
56        "tradefed",
57    ],
58    srcs : [ ":vmtests_generated_host_test_sources" ],
59    installable: false,
60}
61
62java_genrule_host {
63    name: "vmtests-dfh-dex-generated",
64    tools: [
65        "cfassembler",
66        "soong_zip",
67    ],
68    tool_files: ["etc/vmtests-cfassembler.sh"],
69    srcs: ["src/dot/**/*.dfh"],
70    cmd: "$(location etc/vmtests-cfassembler.sh) $(location cfassembler) $(location soong_zip) $(genDir) $(out) $(in)",
71    out: ["vmtests_dfh_dex_generated.jar"],
72}
73
74java_genrule {
75    name: "vmtests_generated_mains_test_sources",
76    tools: [
77        "vmtests-buildutil",
78        "soong_zip",
79    ],
80    cmd: "mkdir $(genDir)/src"
81       + " && $(location vmtests-buildutil) util.build.BuildCTSMainsSources $(genDir)/src "
82       + " && $(location soong_zip) -jar -o $(out) -C $(genDir)/src -D $(genDir)/src",
83    out: ["vmtests.mains.generated.srcjar"],
84}
85
86java_library {
87    name: "vmtests-mains",
88    installable: true,
89    libs: [ "cts-vmtests-dot" ],
90    srcs: [":vmtests_generated_mains_test_sources"],
91}
92
93// TODO: Add vmtests-mains' dex jar to vmtests-generated-resources when
94//       it can be addressed.
95
96java_library_host {
97    name: "vmtests-generated-resources",
98    static_libs: [
99        "host-cts-vmtests",
100        "vmtests-dfh-dex-generated",
101    ],
102    installable: false,
103}
104