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