1 // Copyright (C) 2016 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 // 15 16 // 17 // Build support for testng within the Android Open Source Project 18 // See https://source.android.com/source/building.html for more information 19 // 20 // 21 // The following optional support has been disabled: 22 // - ant 23 // - bsh 24 // 25 // JUnit support is enabled, but needs to be explicitly added in with LOCAL_STATIC_JAVA_LIBRARIES 26 // by whichever app/library is also including testng. 27 28 // These files don't exist in the source tree, they need to be generated during the build. 29 genrule { 30 name: "testng-generated-srcs", 31 tool_files: [ 32 "generate-version-file", 33 "kobalt/src/Build.kt", 34 ], 35 srcs: [ 36 "src/main/resources/org/testng/internal/VersionTemplateJava", 37 ], 38 cmd: "$(location generate-version-file) $(in) @version@ $(location kobalt/src/Build.kt) VERSION > $(out)", 39 out: ["src/generated/java/org/testng/internal/Version.java"], 40 } 41 42 java_library { 43 name: "testng", 44 host_supported: true, 45 hostdex: true, 46 sdk_version: "core_current", 47 48 srcs: [ 49 "src/main/**/*.java", 50 ":testng-generated-srcs", 51 // Android-specific replacements of some of the excluded files. 52 "android-src/**/*.java", 53 ], 54 exclude_srcs: [ 55 // These files don't build on Android, either due to missing java.* APIs or due to missing dependencies (see above). 56 "src/main/java/com/beust/testng/TestNGAntTask.java", 57 "src/main/java/org/testng/TestNGAntTask.java", 58 "src/main/java/org/testng/internal/Bsh.java", 59 "src/main/java/org/testng/internal/PropertyUtils.java", 60 "src/main/java/org/testng/internal/PathUtils.java", 61 ], 62 63 static_libs: [ 64 "jcommander", 65 "snakeyaml", 66 "guice", 67 ], 68 libs: ["junit"], 69 } 70 71 // TODO: also add the tests once we have testng working. 72