1# Copyright (C) 2009 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 17LOCAL_PATH := $(call my-dir) 18 19# include definition of core-junit-files 20include $(LOCAL_PATH)/Common.mk 21 22# note: ideally this should be junit-host, but leave as is for now to avoid 23# changing all its dependencies 24include $(CLEAR_VARS) 25LOCAL_SRC_FILES := $(call all-java-files-under, src) 26LOCAL_MODULE := junit 27LOCAL_MODULE_TAGS := optional 28LOCAL_STATIC_JAVA_LIBRARIES := hamcrest-host 29LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/Common.mk 30include $(BUILD_HOST_JAVA_LIBRARY) 31 32# ---------------------------------- 33# build a junit-targetdex jar 34 35include $(CLEAR_VARS) 36LOCAL_SRC_FILES := $(call all-java-files-under, src/junit/extensions) 37LOCAL_SRC_FILES += $(core-junit-files) 38LOCAL_SRC_FILES += $(junit-runner-files) 39# TODO: lose the suffix here and rename "junit" to "junit-hostdex" 40LOCAL_MODULE := junit-targetdex 41LOCAL_NO_STANDARD_LIBRARIES := true 42LOCAL_JAVA_LIBRARIES := core-oj core-libart 43LOCAL_MODULE_TAGS := tests 44LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/junit 45LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/Common.mk 46include $(BUILD_JAVA_LIBRARY) 47 48# ---------------------------------- 49# build a junit-hostdex jar 50 51ifeq ($(HOST_OS),linux) 52include $(CLEAR_VARS) 53LOCAL_SRC_FILES := $(call all-java-files-under, src/junit/extensions) 54LOCAL_SRC_FILES += $(core-junit-files) 55LOCAL_SRC_FILES += $(junit-runner-files) 56LOCAL_MODULE := junit-hostdex 57LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/Common.mk 58include $(BUILD_HOST_DALVIK_JAVA_LIBRARY) 59endif # HOST_OS == linux 60 61# ---------------------------------- 62# build a core-junit target jar that is built into Android system image 63 64# TODO: remove extensions once core-tests is no longer dependent on it 65include $(CLEAR_VARS) 66LOCAL_SRC_FILES := $(call all-java-files-under, src/junit/extensions) 67LOCAL_SRC_FILES += $(core-junit-files) 68LOCAL_NO_STANDARD_LIBRARIES := true 69LOCAL_JAVA_LIBRARIES := core-oj core-libart 70LOCAL_MODULE_TAGS := optional 71LOCAL_MODULE := core-junit 72LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/Common.mk 73include $(BUILD_JAVA_LIBRARY) 74 75# ---------------------------------- 76# build a core-junit-hostdex jar that contains exactly the same classes 77# as core-junit. 78 79ifeq ($(HOST_OS),linux) 80include $(CLEAR_VARS) 81# TODO: remove extensions once apache-harmony/luni/ is no longer dependent 82# on it 83LOCAL_SRC_FILES := $(call all-java-files-under, src/junit/extensions) 84LOCAL_SRC_FILES += $(core-junit-files) 85LOCAL_MODULE_TAGS := optional 86LOCAL_MODULE := core-junit-hostdex 87LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/Common.mk 88include $(BUILD_HOST_DALVIK_JAVA_LIBRARY) 89endif # HOST_OS == linux 90 91#------------------------------------------------------- 92# build a junit-runner jar for the host JVM 93# (like the junit classes in the frameworks/base android.test.runner.jar) 94 95include $(CLEAR_VARS) 96LOCAL_SRC_FILES := $(junit-runner-files) 97LOCAL_MODULE := junit-runner 98LOCAL_NO_STANDARD_LIBRARIES := true 99LOCAL_JAVA_LIBRARIES := core-oj core-libart core-junit 100LOCAL_MODULE_TAGS := optional 101LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/Common.mk 102include $(BUILD_STATIC_JAVA_LIBRARY) 103 104#------------------------------------------------------- 105# build a junit-runner for the host dalvikvm 106# (like the junit classes in the frameworks/base android.test.runner.jar) 107 108include $(CLEAR_VARS) 109LOCAL_SRC_FILES := $(junit-runner-files) 110LOCAL_MODULE := junit-runner-hostdex 111LOCAL_MODULE_TAGS := optional 112LOCAL_NO_STANDARD_LIBRARIES := true 113LOCAL_JAVA_LIBRARIES := core-oj-hostdex core-libart-hostdex core-junit-hostdex 114LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/Common.mk 115include $(BUILD_HOST_DALVIK_JAVA_LIBRARY) 116 117#------------------------------------------------------- 118# build a junit4-target jar representing the 119# classes in external/junit that are not in the core public API 4 120# Note: 'core' here means excluding the classes that are contained 121# in the optional library android.test.runner. Developers who 122# build against this jar shouldn't have to also include android.test.runner 123 124include $(CLEAR_VARS) 125LOCAL_SRC_FILES := $(junit4-target-src) 126LOCAL_MODULE := junit4-target 127LOCAL_MODULE_TAGS := optional 128LOCAL_SDK_VERSION := 4 129LOCAL_STATIC_JAVA_LIBRARIES := hamcrest 130LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/Common.mk 131include $(BUILD_STATIC_JAVA_LIBRARY) 132 133#------------------------------------------------------- 134# Same as above, but does not statically link in dependencies 135 136include $(CLEAR_VARS) 137LOCAL_SRC_FILES := $(junit4-target-src) 138LOCAL_MODULE := junit4-target-nodeps 139LOCAL_MODULE_TAGS := optional 140LOCAL_SDK_VERSION := 4 141LOCAL_JAVA_LIBRARIES := hamcrest 142LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/Common.mk 143include $(BUILD_STATIC_JAVA_LIBRARY) 144 145#------------------------------------------------------- 146# Same as above, but for host dalvik. However, since we don't have 147# the SDK to provide the junit.framework.* classes, we must add 148# an extra library. 149 150ifeq ($(HOST_OS),linux) 151include $(CLEAR_VARS) 152LOCAL_SRC_FILES := $(junit4-target-src) 153LOCAL_MODULE := junit4-target-hostdex 154LOCAL_MODULE_TAGS := optional 155LOCAL_JAVA_LIBRARIES := core-junit-hostdex 156LOCAL_STATIC_JAVA_LIBRARIES := hamcrest-hostdex 157LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/Common.mk 158include $(BUILD_HOST_DALVIK_JAVA_LIBRARY) 159endif # HOST_OS == linux 160