Colin Cross | c94cd61 | 2017-12-08 18:31:03 -0800 | [diff] [blame^] | 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 | |
| 47 | srcs: [ |
| 48 | "src/main/**/*.java", |
| 49 | ":testng-generated-srcs", |
| 50 | // Android-specific replacements of some of the excluded files. |
| 51 | "android-src/**/*.java", |
| 52 | ], |
| 53 | exclude_srcs: [ |
| 54 | // These files don't build on Android, either due to missing java.* APIs or due to missing dependencies (see above). |
| 55 | "src/main/java/com/beust/testng/TestNGAntTask.java", |
| 56 | "src/main/java/org/testng/TestNGAntTask.java", |
| 57 | "src/main/java/org/testng/internal/Bsh.java", |
| 58 | "src/main/java/org/testng/internal/PropertyUtils.java", |
| 59 | "src/main/java/org/testng/internal/PathUtils.java", |
| 60 | ], |
| 61 | |
| 62 | static_libs: [ |
| 63 | "jcommander", |
| 64 | "snakeyaml", |
| 65 | "guice", |
| 66 | ], |
| 67 | libs: ["junit"], |
| 68 | } |
| 69 | |
| 70 | // TODO: also add the tests once we have testng working. |