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 LOCAL_PATH := $(call my-dir) 29 30 ## 31 ## Common variables, don't repeat yourself. 32 ## 33 34 # Memorize path so we can use it later. 35 testng_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). 38 testng_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. 46 testng_src_files_need_gen := src/generated/java/org/testng/internal/Version.java 47 48 # Android-specific replacements of some of the above files. 49 testng_src_files_android_specific := $(call all-java-files-under,android-src) 50 # Everything under src/main, before we remove android-unsupported files. 51 testng_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. 53 testng_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) 60 include $(CLEAR_VARS) 61 LOCAL_SRC_FILES := $(testng_src_files) 62 LOCAL_MODULE := testng 63 LOCAL_STATIC_JAVA_LIBRARIES := jcommander snakeyaml guice 64 LOCAL_JAVA_LIBRARIES := junit 65 include $(LOCAL_PATH)/GenerateTemplates.mk # Generate Version.java 66 include $(BUILD_STATIC_JAVA_LIBRARY) 67 68 # target jar (standalone, e.g. add it to classpath manually) 69 include $(CLEAR_VARS) 70 LOCAL_SRC_FILES := $(testng_src_files) 71 LOCAL_MODULE := testng-lib 72 LOCAL_STATIC_JAVA_LIBRARIES := jcommander snakeyaml guice 73 LOCAL_JAVA_LIBRARIES := junit 74 include $(LOCAL_PATH)/GenerateTemplates.mk # Generate Version.java 75 include $(BUILD_JAVA_LIBRARY) 76 77 # host jar 78 include $(CLEAR_VARS) 79 LOCAL_SRC_FILES := $(testng_src_files) 80 LOCAL_MODULE := testng-host 81 LOCAL_STATIC_JAVA_LIBRARIES := jcommander-host snakeyaml-host guice-host 82 LOCAL_JAVA_LIBRARIES := junit-host 83 LOCAL_IS_HOST_MODULE := true 84 include $(LOCAL_PATH)/GenerateTemplates.mk # Generate Version.java 85 include $(BUILD_HOST_JAVA_LIBRARY) 86 87 # host dex 88 include $(CLEAR_VARS) 89 LOCAL_SRC_FILES := $(testng_src_files) 90 LOCAL_MODULE := testng-hostdex 91 LOCAL_STATIC_JAVA_LIBRARIES := jcommander-hostdex snakeyaml-hostdex guice-hostdex 92 LOCAL_JAVA_LIBRARIES := junit-hostdex 93 include $(LOCAL_PATH)/GenerateTemplates.mk # Generate Version.java 94 include $(BUILD_HOST_DALVIK_STATIC_JAVA_LIBRARY) 95 96 # TODO: also add the tests once we have testng working. 97