修改拨动开关
[mytuuics.git] / libcore / JavaLibrary.mk
blob7179fda9144ebb8cdf16d44631817ca5db04a6f1
1 # -*- mode: makefile -*-
2 # Copyright (C) 2007 The Android Open Source Project
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
17 # Definitions for building the Java library and associated tests.
21 # Common definitions for host and target.
24 # libcore is divided into modules.
26 # The structure of each module is:
28 # src/
29 # main/ # To be shipped on every device.
30 # java/ # Java source for library code.
31 # native/ # C++ source for library code.
32 # resources/ # Support files.
33 # test/ # Built only on demand, for testing.
34 # java/ # Java source for tests.
35 # native/ # C++ source for tests (rare).
36 # resources/ # Support files.
38 # All subdirectories are optional (hence the "2> /dev/null"s below).
40 define all-main-java-files-under
41 $(foreach dir,$(1),$(patsubst ./%,%,$(shell cd $(LOCAL_PATH) && find $(dir)/src/main/java -name "*.java" 2> /dev/null)))
42 endef
44 define all-test-java-files-under
45 $(foreach dir,$(1),$(patsubst ./%,%,$(shell cd $(LOCAL_PATH) && find $(dir)/src/test/java -name "*.java" 2> /dev/null)))
46 endef
48 define all-core-resource-dirs
49 $(shell cd $(LOCAL_PATH) && ls -d */src/$(1)/{java,resources} 2> /dev/null)
50 endef
52 # The Java files and their associated resources.
53 core_src_files := $(call all-main-java-files-under,dalvik dom json luni support xml)
54 core_resource_dirs := $(call all-core-resource-dirs,main)
55 test_resource_dirs := $(call all-core-resource-dirs,test)
57 ifeq ($(EMMA_INSTRUMENT),true)
58 core_src_files += $(call all-java-files-under, ../external/emma/core ../external/emma/pregenerated)
59 core_resource_dirs += ../external/emma/core/res ../external/emma/pregenerated/res
60 endif
62 local_javac_flags=-encoding UTF-8
63 #local_javac_flags+=-Xlint:all -Xlint:-serial,-deprecation,-unchecked
64 local_javac_flags+=-Xmaxwarns 9999999
67 # Build for the target (device).
70 # Definitions to make the core library.
72 include $(CLEAR_VARS)
74 LOCAL_SRC_FILES := $(core_src_files)
75 LOCAL_JAVA_RESOURCE_DIRS := $(core_resource_dirs)
77 LOCAL_NO_STANDARD_LIBRARIES := true
78 LOCAL_JAVACFLAGS := $(local_javac_flags)
79 LOCAL_DX_FLAGS := --core-library
81 LOCAL_NO_EMMA_INSTRUMENT := true
82 LOCAL_NO_EMMA_COMPILE := true
83 LOCAL_MODULE_TAGS := optional
84 LOCAL_MODULE := core
86 include $(BUILD_JAVA_LIBRARY)
88 core-intermediates := ${intermediates}
91 # Make core-junit
92 include $(CLEAR_VARS)
93 LOCAL_SRC_FILES := $(call all-main-java-files-under,junit)
94 LOCAL_NO_STANDARD_LIBRARIES := true
95 LOCAL_JAVA_LIBRARIES := core
96 LOCAL_JAVACFLAGS := $(local_javac_flags)
97 LOCAL_MODULE_TAGS := optional
98 LOCAL_MODULE := core-junit
99 include $(BUILD_JAVA_LIBRARY)
101 # Make the core-tests library.
102 include $(CLEAR_VARS)
103 LOCAL_SRC_FILES := $(call all-test-java-files-under,dalvik dom json luni support xml)
104 LOCAL_JAVA_RESOURCE_DIRS := $(test_resource_dirs)
105 LOCAL_NO_STANDARD_LIBRARIES := true
106 LOCAL_JAVA_LIBRARIES := bouncycastle core core-junit
107 LOCAL_STATIC_JAVA_LIBRARIES := sqlite-jdbc mockwebserver
108 LOCAL_JAVACFLAGS := $(local_javac_flags)
109 LOCAL_MODULE_TAGS := tests
110 LOCAL_MODULE := core-tests
111 LOCAL_NO_EMMA_INSTRUMENT := true
112 LOCAL_NO_EMMA_COMPILE := true
113 include $(BUILD_STATIC_JAVA_LIBRARY)
115 # This one's tricky. One of our tests needs to have a
116 # resource with a "#" in its name, but Perforce doesn't
117 # allow us to submit such a file. So we create it here
118 # on-the-fly.
119 TMP_RESOURCE_DIR := $(intermediates.COMMON)/tmp/
120 TMP_RESOURCE_FILE := org/apache/harmony/luni/tests/java/lang/test\#.properties
122 $(TMP_RESOURCE_DIR)$(TMP_RESOURCE_FILE):
123 @mkdir -p $(dir $@)
124 @echo "Hello, world!" > $@
126 $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_EXTRA_JAR_ARGS := $(extra_jar_args) -C "$(TMP_RESOURCE_DIR)" "$(TMP_RESOURCE_FILE)"
127 $(LOCAL_INTERMEDIATE_TARGETS): $(TMP_RESOURCE_DIR)$(TMP_RESOURCE_FILE)
131 # Build for the host.
134 ifeq ($(WITH_HOST_DALVIK),true)
136 # Definitions to make the core library.
138 include $(CLEAR_VARS)
140 LOCAL_SRC_FILES := $(core_src_files)
141 LOCAL_JAVA_RESOURCE_DIRS := $(core_resource_dirs)
143 LOCAL_NO_STANDARD_LIBRARIES := true
144 LOCAL_JAVACFLAGS := $(local_javac_flags)
145 LOCAL_DX_FLAGS := --core-library
147 LOCAL_NO_EMMA_INSTRUMENT := true
148 LOCAL_NO_EMMA_COMPILE := true
149 LOCAL_BUILD_HOST_DEX := true
151 LOCAL_MODULE_TAGS := optional
152 LOCAL_MODULE := core-hostdex
154 include $(BUILD_HOST_JAVA_LIBRARY)
156 # Make core-junit
157 include $(CLEAR_VARS)
158 LOCAL_SRC_FILES := $(call all-main-java-files-under,junit)
159 LOCAL_NO_STANDARD_LIBRARIES := true
160 LOCAL_JAVA_LIBRARIES := core-hostdex
161 LOCAL_JAVACFLAGS := $(local_javac_flags)
162 LOCAL_MODULE_TAGS := optional
163 LOCAL_MODULE := core-junit-hostdex
164 LOCAL_BUILD_HOST_DEX := true
165 include $(BUILD_HOST_JAVA_LIBRARY)
167 # Make the core-tests library.
168 include $(CLEAR_VARS)
169 LOCAL_SRC_FILES := $(call all-test-java-files-under,dalvik dom json luni support xml)
170 LOCAL_JAVA_RESOURCE_DIRS := $(test_resource_dirs)
171 LOCAL_NO_STANDARD_LIBRARIES := true
172 LOCAL_JAVA_LIBRARIES := bouncycastle-hostdex core-hostdex core-junit-hostdex
173 LOCAL_STATIC_JAVA_LIBRARIES := sqlite-jdbc-host mockwebserver-hostdex
174 LOCAL_JAVACFLAGS := $(local_javac_flags)
175 LOCAL_MODULE_TAGS := tests
176 LOCAL_MODULE := core-tests-hostdex
177 LOCAL_NO_EMMA_INSTRUMENT := true
178 LOCAL_NO_EMMA_COMPILE := true
179 LOCAL_BUILD_HOST_DEX := true
180 include $(BUILD_HOST_JAVA_LIBRARY)
181 endif
184 # Local droiddoc for faster libcore testing
187 # Run with:
188 # m libcore-docs
190 # Main output:
191 # out/target/common/docs/libcore/reference/packages.html
193 # All text for proofreading (or running tools over):
194 # out/target/common/docs/libcore-proofread.txt
196 # TODO list of missing javadoc, etc:
197 # out/target/common/docs/libcore-docs-todo.html
199 # Rerun:
200 # rm -rf out/target/common/docs/libcore-timestamp && m libcore-docs
202 include $(CLEAR_VARS)
204 # for shared defintion of libcore_to_document
205 include $(LOCAL_PATH)/Docs.mk
207 LOCAL_SRC_FILES:=$(call libcore_to_document,$(LOCAL_PATH))
208 # rerun doc generation without recompiling the java
209 LOCAL_JAVA_LIBRARIES:=
210 LOCAL_JAVACFLAGS := $(local_javac_flags)
211 LOCAL_MODULE_CLASS:=JAVA_LIBRARIES
213 LOCAL_MODULE := libcore
215 LOCAL_DROIDDOC_OPTIONS:= \
216 -offlinemode \
217 -title "libcore" \
218 -proofread $(OUT_DOCS)/$(LOCAL_MODULE)-proofread.txt \
219 -todo ../$(LOCAL_MODULE)-docs-todo.html \
220 -hdf android.whichdoc offline
222 LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=build/tools/droiddoc/templates-sdk
224 include $(BUILD_DROIDDOC)