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