Android.mk revision 2e5746b83c6c04a15042990e60cb88c8cf13f858
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) 39LOCAL_MODULE := junit-targetdex # TODO: lose the suffix here and rename "junit" to "junit-hostdex" 40LOCAL_MODULE_TAGS := tests 41LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/junit 42LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/Common.mk 43include $(BUILD_JAVA_LIBRARY) 44 45# ---------------------------------- 46# build a junit-hostdex jar 47 48ifeq ($(WITH_HOST_DALVIK),true) 49include $(CLEAR_VARS) 50LOCAL_SRC_FILES := $(call all-java-files-under, src/junit/extensions) 51LOCAL_SRC_FILES += $(core-junit-files) 52LOCAL_SRC_FILES += $(junit-runner-files) 53LOCAL_MODULE := junit-hostdex 54LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/Common.mk 55include $(BUILD_HOST_DALVIK_JAVA_LIBRARY) 56endif 57 58# ---------------------------------- 59# build a core-junit target jar that is built into Android system image 60 61# TODO: remove extensions once core-tests is no longer dependent on it 62include $(CLEAR_VARS) 63LOCAL_SRC_FILES := $(call all-java-files-under, src/junit/extensions) 64LOCAL_SRC_FILES += $(core-junit-files) 65LOCAL_NO_STANDARD_LIBRARIES := true 66LOCAL_JAVA_LIBRARIES := core 67LOCAL_JAVACFLAGS := $(local_javac_flags) 68LOCAL_MODULE_TAGS := optional 69LOCAL_MODULE := core-junit 70LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/Common.mk 71include $(BUILD_JAVA_LIBRARY) 72 73# ---------------------------------- 74# build a core-junit-hostdex jar that contains exactly the same classes 75# as core-junit. 76 77ifeq ($(WITH_HOST_DALVIK),true) 78include $(CLEAR_VARS) 79# TODO: remove extensions once apache-harmony/luni/ is no longer dependent 80# on it 81LOCAL_SRC_FILES := $(call all-java-files-under, src/junit/extensions) 82LOCAL_SRC_FILES += $(core-junit-files) 83LOCAL_JAVACFLAGS := $(local_javac_flags) 84LOCAL_MODULE_TAGS := optional 85LOCAL_MODULE := core-junit-hostdex 86LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/Common.mk 87include $(BUILD_HOST_DALVIK_JAVA_LIBRARY) 88endif 89 90#------------------------------------------------------- 91# build a junit-runner jar for the host JVM 92# (like the junit classes in the frameworks/base android.test.runner.jar) 93 94include $(CLEAR_VARS) 95LOCAL_SRC_FILES := $(junit-runner-files) 96LOCAL_MODULE := junit-runner 97LOCAL_MODULE_TAGS := optional 98LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/Common.mk 99include $(BUILD_STATIC_JAVA_LIBRARY) 100 101#------------------------------------------------------- 102# build a junit-runner for the host dalvikvm 103# (like the junit classes in the frameworks/base android.test.runner.jar) 104 105ifeq ($(WITH_HOST_DALVIK),true) 106include $(CLEAR_VARS) 107LOCAL_SRC_FILES := $(junit-runner-files) 108LOCAL_MODULE := junit-runner-hostdex 109LOCAL_MODULE_TAGS := optional 110LOCAL_JAVA_LIBRARIES := core-junit-hostdex 111LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/Common.mk 112include $(BUILD_HOST_DALVIK_JAVA_LIBRARY) 113endif 114 115#------------------------------------------------------- 116# build a junit4-target jar representing the 117# classes in external/junit that are not in the core public API 4 118# Note: 'core' here means excluding the classes that are contained 119# in the optional library android.test.runner. Developers who 120# build against this jar shouldn't have to also include android.test.runner 121 122include $(CLEAR_VARS) 123LOCAL_SRC_FILES := $(junit4-target-src) 124LOCAL_MODULE := junit4-target 125LOCAL_MODULE_TAGS := optional 126LOCAL_SDK_VERSION := 4 127LOCAL_STATIC_JAVA_LIBRARIES := hamcrest 128LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/Common.mk 129include $(BUILD_STATIC_JAVA_LIBRARY) 130 131#------------------------------------------------------- 132# Same as above, but does not statically link in dependencies 133 134include $(CLEAR_VARS) 135LOCAL_SRC_FILES := $(junit4-target-src) 136LOCAL_MODULE := junit4-target-nodeps 137LOCAL_MODULE_TAGS := optional 138LOCAL_SDK_VERSION := 4 139LOCAL_JAVA_LIBRARIES := hamcrest 140LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk $(LOCAL_PATH)/Common.mk 141include $(BUILD_STATIC_JAVA_LIBRARY) 142