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 errorprone: { 27 javacflags: [ 28 "-Xep:IdentityBinaryExpression:WARN", 29 "-Xep:BadShiftAmount:WARN", 30 ], 31 }, 32} 33 34java_binary_host { 35 name: "vmtests-buildutil", 36 static_libs: [ "cts-vmtests-dot", "junit" ], 37 srcs: [ 38 "build/src/util/build/BuildCTSHostSources.java", 39 "build/src/util/build/BuildCTSMainsSources.java", 40 "build/src/util/build/BuildUtilBase.java", 41 "build/src/util/build/FileUtil.java", 42 "build/src/util/build/JUnitTestCollector.java", 43 ], 44 wrapper: "etc/vmtests-buildutil.sh", 45} 46 47java_genrule_host { 48 name: "vmtests_generated_host_test_sources", 49 tools: [ 50 "vmtests-buildutil", 51 "soong_zip", 52 ], 53 cmd: "$(location vmtests-buildutil) util.build.BuildCTSHostSources $(genDir) " + 54 " && $(location soong_zip) -jar -o $(out) -C $(genDir) -D $(genDir)/dot", 55 out: ["vmtests.host.generated.srcjar"], 56} 57 58java_library_host { 59 name: "host-cts-vmtests", 60 libs: [ 61 "junit", 62 "tradefed", 63 ], 64 srcs : [ ":vmtests_generated_host_test_sources" ], 65 installable: false, 66} 67 68java_genrule_host { 69 name: "vmtests-dfh-dex-generated", 70 tools: [ 71 "cfassembler", 72 "soong_zip", 73 ], 74 tool_files: ["etc/vmtests-cfassembler.sh"], 75 srcs: ["src/dot/**/*.dfh"], 76 cmd: "$(location etc/vmtests-cfassembler.sh) $(location cfassembler) $(location soong_zip) $(genDir) $(out) $(in)", 77 out: ["vmtests_dfh_dex_generated.jar"], 78} 79 80java_genrule { 81 name: "vmtests_generated_mains_test_sources", 82 tools: [ 83 "vmtests-buildutil", 84 "soong_zip", 85 ], 86 cmd: "mkdir $(genDir)/src" 87 + " && $(location vmtests-buildutil) util.build.BuildCTSMainsSources $(genDir)/src " 88 + " && $(location soong_zip) -jar -o $(out) -C $(genDir)/src -D $(genDir)/src", 89 out: ["vmtests.mains.generated.srcjar"], 90} 91 92java_library { 93 name: "vmtests-mains", 94 installable: true, 95 libs: [ "cts-vmtests-dot" ], 96 srcs: [":vmtests_generated_mains_test_sources"], 97} 98 99// TODO: Add vmtests-mains' dex jar to vmtests-generated-resources when 100// it can be addressed. 101 102java_library_host { 103 name: "vmtests-generated-resources", 104 static_libs: [ 105 "host-cts-vmtests", 106 "vmtests-dfh-dex-generated", 107 ], 108 installable: false, 109} 110 111java_library_host { 112 name: "cts-tf-dalvik-buildutil", 113 srcs: [ 114 "build/src/**/*.java", 115 "src/**/*.java", 116 ], 117 libs: [ 118 "junit", 119 "jsr305", 120 "d8", 121 "smali", 122 ], 123 errorprone: { 124 javacflags: [ 125 "-Xep:IdentityBinaryExpression:WARN", 126 "-Xep:BadShiftAmount:WARN", 127 ], 128 }, 129} 130 131java_genrule_host { 132 name: "vm-tests-tf-lib", 133 tools: [ 134 "soong_zip", 135 "d8" 136 ], 137 srcs: [ 138 ":cts-tf-dalvik-buildutil", 139 ":vmtests-generated-resources", 140 ":vmtests-mains", 141 ":cts-vmtests-dot", 142 ":junit", 143 ":d8", 144 ":smali", 145 ], 146 cmd: "echo Generating BuildDalvikSuite tests" + 147 " && mkdir -p $(genDir)/classes" + 148 " && unzip -bq $(location :cts-tf-dalvik-buildutil) -d $(genDir)/classes" + 149 " && mkdir -p $(genDir)/tests" + 150 " && java" + 151 " -cp $(location :cts-tf-dalvik-buildutil):$(location :junit):$(location :d8):$(location :smali):$(location :cts-vmtests-dot)" + 152 " util.build.BuildDalvikSuite" + 153 " cts/tools/vm-tests-tf/src" + 154 " $(genDir)/tests" + 155 " $(genDir)/classes" + 156 " && echo Generating dexcore tests" + 157 " && $(location soong_zip) -jar -o $(genDir)/tests/dot/junit/dexcore.jar-class.jar" + 158 " -C $(genDir)/classes" + 159 " -f $(genDir)/classes/dot/junit/DxUtil.class" + 160 " -f $(genDir)/classes/dot/junit/DxAbstractMain.class" + 161 " -f $(genDir)/classes/dot/junit/AssertionFailedException.class" + 162 " && mkdir -p $(genDir)/dexcore" + 163 " && $(location d8) -JXms16M -JXmx2048M" + 164 " --output $(genDir)/dexcore" + 165 " $(genDir)/tests/dot/junit/dexcore.jar-class.jar" + 166 " && $(location soong_zip) -jar -o $(genDir)/tests/dot/junit/dexcore.jar" + 167 " -C $(genDir)/dexcore" + 168 " -D $(genDir)/dexcore" + 169 " && echo Combining tests" + 170 " && mkdir -p $(genDir)/out" + 171 " && unzip -bq $(location :vmtests-generated-resources) -d $(genDir)/generated-resources" + 172 " && cp $(location :vmtests-mains) $(genDir)/mains.jar" + 173 " && $(location soong_zip) -o $(out)" + 174 " -C $(genDir)/generated-resources" + 175 " -D $(genDir)/generated-resources" + 176 " -C $(genDir)" + 177 " -D $(genDir)/tests" + 178 " -j -P tests -f $(genDir)/mains.jar", 179 out: ["vm-tests-tf-lib.jar"], 180} 181 182java_test_host { 183 name: "vm-tests-tf", 184 static_libs: [ 185 "compatibility-host-vm-targetprep", 186 "vm-tests-tf-lib", 187 ], 188 test_config: "AndroidTest.xml", 189 test_suites: [ 190 "cts", 191 "general-tests", 192 ], 193} 194