aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2017-12-12 23:11:09 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-12-12 23:11:09 +0000
commite10619b63384ca0936a32bfcc81bf1597f9ed04f (patch)
treec16805a10fff6bff928d8108ff0cb75a99913cd3
parent2d09ec828c313edd6f9f5021c9b166854d742521 (diff)
parentc94cd613ebc40cbf9eb94452685fb19a18ab7264 (diff)
downloadtestng-e10619b63384ca0936a32bfcc81bf1597f9ed04f.tar.gz
Convert external/testng to Android.bp
am: c94cd613eb Change-Id: I50a58d69de2c98b733bb9c3abf66213aadc38c2f
-rw-r--r--Android.bp70
-rw-r--r--Android.mk96
-rw-r--r--GenerateTemplates.mk42
3 files changed, 70 insertions, 138 deletions
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 00000000..cd41f54b
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,70 @@
+// Copyright (C) 2016 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+//
+// Build support for testng within the Android Open Source Project
+// See https://source.android.com/source/building.html for more information
+//
+//
+// The following optional support has been disabled:
+// - ant
+// - bsh
+//
+// JUnit support is enabled, but needs to be explicitly added in with LOCAL_STATIC_JAVA_LIBRARIES
+// by whichever app/library is also including testng.
+
+// These files don't exist in the source tree, they need to be generated during the build.
+genrule {
+ name: "testng-generated-srcs",
+ tool_files: [
+ "generate-version-file",
+ "kobalt/src/Build.kt",
+ ],
+ srcs: [
+ "src/main/resources/org/testng/internal/VersionTemplateJava",
+ ],
+ cmd: "$(location generate-version-file) $(in) @version@ $(location kobalt/src/Build.kt) VERSION > $(out)",
+ out: ["src/generated/java/org/testng/internal/Version.java"],
+}
+
+java_library {
+ name: "testng",
+ host_supported: true,
+ hostdex: true,
+
+ srcs: [
+ "src/main/**/*.java",
+ ":testng-generated-srcs",
+ // Android-specific replacements of some of the excluded files.
+ "android-src/**/*.java",
+ ],
+ exclude_srcs: [
+ // These files don't build on Android, either due to missing java.* APIs or due to missing dependencies (see above).
+ "src/main/java/com/beust/testng/TestNGAntTask.java",
+ "src/main/java/org/testng/TestNGAntTask.java",
+ "src/main/java/org/testng/internal/Bsh.java",
+ "src/main/java/org/testng/internal/PropertyUtils.java",
+ "src/main/java/org/testng/internal/PathUtils.java",
+ ],
+
+ static_libs: [
+ "jcommander",
+ "snakeyaml",
+ "guice",
+ ],
+ libs: ["junit"],
+}
+
+// TODO: also add the tests once we have testng working.
diff --git a/Android.mk b/Android.mk
deleted file mode 100644
index 0b18629a..00000000
--- a/Android.mk
+++ /dev/null
@@ -1,96 +0,0 @@
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-#
-# Build support for testng within the Android Open Source Project
-# See https://source.android.com/source/building.html for more information
-#
-#
-# The following optional support has been disabled:
-# - ant
-# - bsh
-#
-# JUnit support is enabled, but needs to be explicitly added in with LOCAL_STATIC_JAVA_LIBRARIES
-# by whichever app/library is also including testng.
-
-LOCAL_PATH := $(call my-dir)
-
-##
-## Common variables, don't repeat yourself.
-##
-
-# Memorize path so we can use it later.
-testng_path := $(LOCAL_PATH)
-
-# These files don't build on Android, either due to missing java.* APIs or due to missing dependencies (see above).
-testng_android_unsupported_src_files := \
- src/main/java/com/beust/testng/TestNGAntTask.java \
- src/main/java/org/testng/TestNGAntTask.java \
- src/main/java/org/testng/internal/Bsh.java \
- src/main/java/org/testng/internal/PropertyUtils.java \
- src/main/java/org/testng/internal/PathUtils.java
-
-# These files don't exist in the source tree, they need to be generated during the build.
-testng_src_files_need_gen := src/generated/java/org/testng/internal/Version.java
-
-# Android-specific replacements of some of the above files.
-testng_src_files_android_specific := $(call all-java-files-under,android-src)
-# Everything under src/main, before we remove android-unsupported files.
-testng_src_files_unfiltered := $(call all-java-files-under,src/main)
-# The nominal files we use to build for Android is everything in src/main that's supported, plus everything in android-src.
-testng_src_files := $(filter-out $(testng_android_unsupported_src_files),$(testng_src_files_unfiltered)) $(testng_src_files_android_specific)
-
-##
-## Build rules follow.
-##
-
-# target jar (static)
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(testng_src_files)
-LOCAL_MODULE := testng
-LOCAL_STATIC_JAVA_LIBRARIES := jcommander snakeyaml guice
-LOCAL_JAVA_LIBRARIES := junit
-include $(LOCAL_PATH)/GenerateTemplates.mk # Generate Version.java
-include $(BUILD_STATIC_JAVA_LIBRARY)
-
-# target jar (standalone, e.g. add it to classpath manually)
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(testng_src_files)
-LOCAL_MODULE := testng-lib
-LOCAL_STATIC_JAVA_LIBRARIES := jcommander snakeyaml guice
-LOCAL_JAVA_LIBRARIES := junit
-include $(LOCAL_PATH)/GenerateTemplates.mk # Generate Version.java
-include $(BUILD_JAVA_LIBRARY)
-
-# host jar
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(testng_src_files)
-LOCAL_MODULE := testng-host
-LOCAL_STATIC_JAVA_LIBRARIES := jcommander-host snakeyaml-host guice-host
-LOCAL_JAVA_LIBRARIES := junit-host
-LOCAL_IS_HOST_MODULE := true
-include $(LOCAL_PATH)/GenerateTemplates.mk # Generate Version.java
-include $(BUILD_HOST_JAVA_LIBRARY)
-
-# host dex
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(testng_src_files)
-LOCAL_MODULE := testng-hostdex
-LOCAL_STATIC_JAVA_LIBRARIES := jcommander-hostdex snakeyaml-hostdex guice-hostdex
-LOCAL_JAVA_LIBRARIES := junit-hostdex
-include $(LOCAL_PATH)/GenerateTemplates.mk # Generate Version.java
-include $(BUILD_HOST_DALVIK_STATIC_JAVA_LIBRARY)
-
-# TODO: also add the tests once we have testng working.
diff --git a/GenerateTemplates.mk b/GenerateTemplates.mk
deleted file mode 100644
index ae024212..00000000
--- a/GenerateTemplates.mk
+++ /dev/null
@@ -1,42 +0,0 @@
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-#
-# Build support for testng within the Android Open Source Project
-# See https://source.android.com/source/building.html for more information
-#
-#
-
-# This file generates Version.java.
-# Factored out as a separate file for reuse between multiple Android build rules.
-
-LOCAL_MODULE_CLASS := JAVA_LIBRARIES
-
-# Apply all of the Android patches in src/patches/android by running patch-android-src script on them.
-intermediates:= $(local-generated-sources-dir)
-GEN := $(addprefix $(intermediates)/, $(testng_src_files_need_gen)) # List of all files that need to be generated.
-$(GEN) : PRIVATE_PATH := $(testng_path)
-## ./generate-version-file ./src/main/resources/org/testng/internal/VersionTemplateJava "@version@" kobalt/src/Build.kt "VERSION" > Version.java
-$(GEN) : PRIVATE_CUSTOM_TOOL = \
- $(PRIVATE_PATH)/generate-version-file "$(PRIVATE_PATH)/src/main/resources/org/testng/internal/VersionTemplateJava" \
- "@version@" \
- "$(PRIVATE_PATH)/kobalt/src/Build.kt" \
- "VERSION" > $@
-$(GEN): $(intermediates)/%.java : $(LOCAL_PATH)/src/main/resources/org/testng/internal/VersionTemplateJava \
- $(LOCAL_PATH)/kobalt/src/Build.kt \
- $(LOCAL_PATH)/generate-version-file
- $(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-