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 28LOCAL_PATH := $(call my-dir) 29 30## 31## Common variables, don't repeat yourself. 32## 33 34# Memorize path so we can use it later. 35testng_path := $(LOCAL_PATH) 36 37# These files don't build on Android, either due to missing java.* APIs or due to missing dependencies (see above). 38testng_android_unsupported_src_files := \ 39 src/main/java/com/beust/testng/TestNGAntTask.java \ 40 src/main/java/org/testng/TestNGAntTask.java \ 41 src/main/java/org/testng/internal/Bsh.java \ 42 src/main/java/org/testng/internal/PropertyUtils.java \ 43 src/main/java/org/testng/internal/PathUtils.java 44 45# These files don't exist in the source tree, they need to be generated during the build. 46testng_src_files_need_gen := src/generated/java/org/testng/internal/Version.java 47 48# Android-specific replacements of some of the above files. 49testng_src_files_android_specific := $(call all-java-files-under,android-src) 50# Everything under src/main, before we remove android-unsupported files. 51testng_src_files_unfiltered := $(call all-java-files-under,src/main) 52# The nominal files we use to build for Android is everything in src/main that's supported, plus everything in android-src. 53testng_src_files := $(filter-out $(testng_android_unsupported_src_files),$(testng_src_files_unfiltered)) $(testng_src_files_android_specific) 54 55## 56## Build rules follow. 57## 58 59# target jar (static) 60include $(CLEAR_VARS) 61LOCAL_SRC_FILES := $(testng_src_files) 62LOCAL_MODULE := testng 63LOCAL_STATIC_JAVA_LIBRARIES := jcommander snakeyaml guice 64LOCAL_JAVA_LIBRARIES := junit-targetdex junit4-target 65include $(LOCAL_PATH)/GenerateTemplates.mk # Generate Version.java 66include $(BUILD_STATIC_JAVA_LIBRARY) 67 68# target jar (standalone, e.g. add it to classpath manually) 69include $(CLEAR_VARS) 70LOCAL_SRC_FILES := $(testng_src_files) 71LOCAL_MODULE := testng-lib 72LOCAL_STATIC_JAVA_LIBRARIES := jcommander snakeyaml guice 73LOCAL_JAVA_LIBRARIES := junit-targetdex junit4-target 74include $(LOCAL_PATH)/GenerateTemplates.mk # Generate Version.java 75include $(BUILD_JAVA_LIBRARY) 76 77# host jar 78include $(CLEAR_VARS) 79LOCAL_SRC_FILES := $(testng_src_files) 80LOCAL_MODULE := testng-host 81LOCAL_STATIC_JAVA_LIBRARIES := jcommander-host snakeyaml-host guice-host 82LOCAL_JAVA_LIBRARIES := junit 83LOCAL_IS_HOST_MODULE := true 84include $(LOCAL_PATH)/GenerateTemplates.mk # Generate Version.java 85include $(BUILD_HOST_JAVA_LIBRARY) 86 87# host dex 88include $(CLEAR_VARS) 89LOCAL_SRC_FILES := $(testng_src_files) 90LOCAL_MODULE := testng-hostdex 91LOCAL_STATIC_JAVA_LIBRARIES := jcommander-hostdex snakeyaml-hostdex guice-hostdex 92LOCAL_JAVA_LIBRARIES := junit-hostdex junit4-target-hostdex 93include $(LOCAL_PATH)/GenerateTemplates.mk # Generate Version.java 94include $(BUILD_HOST_DALVIK_JAVA_LIBRARY) 95 96# TODO: also add the tests once we have testng working. 97