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. 29package { 30 default_applicable_licenses: ["external_testng_license"], 31} 32 33// Added automatically by a large-scale-change that took the approach of 34// 'apply every license found to every target'. While this makes sure we respect 35// every license restriction, it may not be entirely correct. 36// 37// e.g. GPL in an MIT project might only apply to the contrib/ directory. 38// 39// Please consider splitting the single license below into multiple licenses, 40// taking care not to lose any license_kind information, and overriding the 41// default license using the 'licenses: [...]' property on targets as needed. 42// 43// For unused files, consider creating a 'fileGroup' with "//visibility:private" 44// to attach the license to, and including a comment whether the files may be 45// used in the current project. 46// 47// large-scale-change included anything that looked like it might be a license 48// text as a license_text. e.g. LICENSE, NOTICE, COPYING etc. 49// 50// Please consider removing redundant or irrelevant files from 'license_text:'. 51// See: http://go/android-license-faq 52license { 53 name: "external_testng_license", 54 visibility: [":__subpackages__"], 55 license_kinds: [ 56 "SPDX-license-identifier-Apache-2.0", 57 "SPDX-license-identifier-CPL-1.0", 58 ], 59 license_text: [ 60 "LICENSE.txt", 61 "NOTICE", 62 ], 63} 64 65genrule { 66 name: "testng-generated-srcs", 67 tool_files: [ 68 "generate-version-file", 69 "kobalt/src/Build.kt", 70 ], 71 srcs: [ 72 "src/main/resources/org/testng/internal/VersionTemplateJava", 73 ], 74 cmd: "$(location generate-version-file) $(in) @version@ $(location kobalt/src/Build.kt) VERSION > $(out)", 75 out: ["src/generated/java/org/testng/internal/Version.java"], 76} 77 78java_library { 79 name: "testng", 80 host_supported: true, 81 hostdex: true, 82 sdk_version: "core_current", 83 84 srcs: [ 85 "src/main/**/*.java", 86 ":testng-generated-srcs", 87 // Android-specific replacements of some of the excluded files. 88 "android-src/**/*.java", 89 ], 90 exclude_srcs: [ 91 // These files don't build on Android, either due to missing java.* APIs or due to missing dependencies (see above). 92 "src/main/java/com/beust/testng/TestNGAntTask.java", 93 "src/main/java/org/testng/TestNGAntTask.java", 94 "src/main/java/org/testng/internal/Bsh.java", 95 "src/main/java/org/testng/internal/PropertyUtils.java", 96 "src/main/java/org/testng/internal/PathUtils.java", 97 ], 98 99 static_libs: [ 100 "jcommander", 101 "snakeyaml", 102 "guice", 103 ], 104 libs: ["junit"], 105} 106 107// TODO: also add the tests once we have testng working. 108