JavaLibrary.mk revision d610834e0a53866778efdab2a529e7c2f9a75dc9
17ee3a061452c5a7e5c8e661219a1f08a14171858Elliott Hughes# -*- mode: makefile -*-
26ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# Copyright (C) 2007 The Android Open Source Project
36ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein#
46ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# Licensed under the Apache License, Version 2.0 (the "License");
56ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# you may not use this file except in compliance with the License.
66ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# You may obtain a copy of the License at
76ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein#
86ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein#      http://www.apache.org/licenses/LICENSE-2.0
96ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein#
106ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# Unless required by applicable law or agreed to in writing, software
116ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# distributed under the License is distributed on an "AS IS" BASIS,
126ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
136ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# See the License for the specific language governing permissions and
146ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# limitations under the License.
156ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
166ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein#
176ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# Definitions for building the Java library and associated tests.
186ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein#
196ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
206ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein#
216ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# Common definitions for host and target.
226ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein#
236ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
24d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilson# libcore is divided into modules.
25d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilson#
26d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilson# The structure of each module is:
27d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilson#
28d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilson#   src/
29d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilson#       main/               # To be shipped on every device.
30d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilson#            java/          # Java source for library code.
31d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilson#            native/        # C++ source for library code.
32d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilson#            resources/     # Support files.
33d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilson#       test/               # Built only on demand, for testing.
34d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilson#            java/          # Java source for tests.
35d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilson#            native/        # C++ source for tests (rare).
36d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilson#            resources/     # Support files.
37d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilson#
38d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilson# All subdirectories are optional (hence the "2> /dev/null"s below).
396ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
4032cfe9539e1cc988fa433c18c12a89a18afe1f55Jesse Wilsondefine all-main-java-files-under
4132cfe9539e1cc988fa433c18c12a89a18afe1f55Jesse Wilson$(foreach dir,$(1),$(patsubst ./%,%,$(shell cd $(LOCAL_PATH) && find $(dir)/src/main/java -name "*.java" 2> /dev/null)))
4232cfe9539e1cc988fa433c18c12a89a18afe1f55Jesse Wilsonendef
4332cfe9539e1cc988fa433c18c12a89a18afe1f55Jesse Wilson
4432cfe9539e1cc988fa433c18c12a89a18afe1f55Jesse Wilsondefine all-test-java-files-under
4532cfe9539e1cc988fa433c18c12a89a18afe1f55Jesse Wilson$(patsubst ./%,%,$(shell cd $(LOCAL_PATH) && find $(1)/src/test/java -name "*.java" 2> /dev/null))
466ac43c29e4f1918d40441178c22bfca7409101beDan Bornsteinendef
476ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
486ac43c29e4f1918d40441178c22bfca7409101beDan Bornsteindefine all-core-resource-dirs
496ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein$(shell cd $(LOCAL_PATH) && ls -d */src/$(1)/{java,resources} 2> /dev/null)
506ac43c29e4f1918d40441178c22bfca7409101beDan Bornsteinendef
516ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
52d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilson# The Java files and their associated resources.
53e590b9c7ecbe9b35c33fd2d101b1abc6bd7d1489Jesse Wilsoncore_src_files := $(call all-main-java-files-under,dalvik dom json luni support xml)
546ac43c29e4f1918d40441178c22bfca7409101beDan Bornsteincore_resource_dirs := $(call all-core-resource-dirs,main)
556ac43c29e4f1918d40441178c22bfca7409101beDan Bornsteintest_resource_dirs := $(call all-core-resource-dirs,test)
566ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
577898a917ea805abf9f320ed42285ff3adf79968dJesse Wilsonifeq ($(EMMA_INSTRUMENT),true)
587898a917ea805abf9f320ed42285ff3adf79968dJesse Wilson    core_src_files += $(call all-java-files-under, ../external/emma/core ../external/emma/pregenerated)
597898a917ea805abf9f320ed42285ff3adf79968dJesse Wilson    core_resource_dirs += ../external/emma/core/res ../external/emma/pregenerated/res
607898a917ea805abf9f320ed42285ff3adf79968dJesse Wilsonendif
617898a917ea805abf9f320ed42285ff3adf79968dJesse Wilson
6248d0b3ffb83c2d9f08d9f4debb09e9798cf67c6aElliott Hugheslocal_javac_flags=-encoding UTF-8
6348d0b3ffb83c2d9f08d9f4debb09e9798cf67c6aElliott Hughes#local_javac_flags+=-Xlint:all -Xlint:-serial,-deprecation,-unchecked
6448d0b3ffb83c2d9f08d9f4debb09e9798cf67c6aElliott Hugheslocal_javac_flags+=-Xmaxwarns 9999999
656ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
666ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein#
676ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# Build for the target (device).
686ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein#
696ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
706ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# Definitions to make the core library.
716ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
726ac43c29e4f1918d40441178c22bfca7409101beDan Bornsteininclude $(CLEAR_VARS)
736ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
746ac43c29e4f1918d40441178c22bfca7409101beDan BornsteinLOCAL_SRC_FILES := $(core_src_files)
756ac43c29e4f1918d40441178c22bfca7409101beDan BornsteinLOCAL_JAVA_RESOURCE_DIRS := $(core_resource_dirs)
766ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
776ac43c29e4f1918d40441178c22bfca7409101beDan BornsteinLOCAL_NO_STANDARD_LIBRARIES := true
7848d0b3ffb83c2d9f08d9f4debb09e9798cf67c6aElliott HughesLOCAL_JAVACFLAGS := $(local_javac_flags)
796ac43c29e4f1918d40441178c22bfca7409101beDan BornsteinLOCAL_DX_FLAGS := --core-library
806ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
816ac43c29e4f1918d40441178c22bfca7409101beDan BornsteinLOCAL_NO_EMMA_INSTRUMENT := true
826ac43c29e4f1918d40441178c22bfca7409101beDan BornsteinLOCAL_NO_EMMA_COMPILE := true
8353fbc0a776feebcc04f6c24b34f2c7ba39e6b5a1Jesse WilsonLOCAL_MODULE_TAGS := optional
846ac43c29e4f1918d40441178c22bfca7409101beDan BornsteinLOCAL_MODULE := core
856ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
866ac43c29e4f1918d40441178c22bfca7409101beDan Bornsteininclude $(BUILD_JAVA_LIBRARY)
876ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
886ac43c29e4f1918d40441178c22bfca7409101beDan Bornsteincore-intermediates := ${intermediates}
896ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
906ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
9132cfe9539e1cc988fa433c18c12a89a18afe1f55Jesse Wilson# Make core-junit
9232cfe9539e1cc988fa433c18c12a89a18afe1f55Jesse Wilsoninclude $(CLEAR_VARS)
9332cfe9539e1cc988fa433c18c12a89a18afe1f55Jesse WilsonLOCAL_SRC_FILES := $(call all-main-java-files-under,junit)
9432cfe9539e1cc988fa433c18c12a89a18afe1f55Jesse WilsonLOCAL_NO_STANDARD_LIBRARIES := true
9532cfe9539e1cc988fa433c18c12a89a18afe1f55Jesse WilsonLOCAL_JAVA_LIBRARIES := core
96d610834e0a53866778efdab2a529e7c2f9a75dc9Elliott HughesLOCAL_JAVACFLAGS := $(local_javac_flags)
9753fbc0a776feebcc04f6c24b34f2c7ba39e6b5a1Jesse WilsonLOCAL_MODULE_TAGS := optional
9832cfe9539e1cc988fa433c18c12a89a18afe1f55Jesse WilsonLOCAL_MODULE := core-junit
9932cfe9539e1cc988fa433c18c12a89a18afe1f55Jesse Wilsoninclude $(BUILD_JAVA_LIBRARY)
10032cfe9539e1cc988fa433c18c12a89a18afe1f55Jesse Wilson
1011708c119626a936797c7c9257af52cd629a28cbbJesse Wilson# Make core-junitrunner
1026ac43c29e4f1918d40441178c22bfca7409101beDan Bornsteininclude $(CLEAR_VARS)
1031708c119626a936797c7c9257af52cd629a28cbbJesse WilsonLOCAL_SRC_FILES := $(call all-test-java-files-under,junit)
104d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_JAVA_RESOURCE_DIRS := $(test_resource_dirs)
105d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_NO_STANDARD_LIBRARIES := true
1061708c119626a936797c7c9257af52cd629a28cbbJesse WilsonLOCAL_JAVA_LIBRARIES := core core-junit
107d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_DX_FLAGS := --core-library
108d610834e0a53866778efdab2a529e7c2f9a75dc9Elliott HughesLOCAL_JAVACFLAGS := $(local_javac_flags)
109d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_MODULE_TAGS := tests
1101708c119626a936797c7c9257af52cd629a28cbbJesse WilsonLOCAL_MODULE := core-junitrunner
111d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilsoninclude $(BUILD_JAVA_LIBRARY)
1126ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
113b9cf9cb6d681614fe3aa282511a99c3ed3329fceElliott Hughes# Definitions to make the sqlite JDBC driver.
1146ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
115d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilsoninclude $(CLEAR_VARS)
116b9cf9cb6d681614fe3aa282511a99c3ed3329fceElliott HughesLOCAL_SRC_FILES := $(call all-main-java-files-under,sqlite-jdbc)
1176ac43c29e4f1918d40441178c22bfca7409101beDan BornsteinLOCAL_NO_STANDARD_LIBRARIES := true
118b9cf9cb6d681614fe3aa282511a99c3ed3329fceElliott HughesLOCAL_JAVA_LIBRARIES := core
119d610834e0a53866778efdab2a529e7c2f9a75dc9Elliott HughesLOCAL_JAVACFLAGS := $(local_javac_flags)
12053fbc0a776feebcc04f6c24b34f2c7ba39e6b5a1Jesse WilsonLOCAL_MODULE_TAGS := optional
121b9cf9cb6d681614fe3aa282511a99c3ed3329fceElliott HughesLOCAL_MODULE := sqlite-jdbc
122d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilsoninclude $(BUILD_JAVA_LIBRARY)
1236ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
1247ee3a061452c5a7e5c8e661219a1f08a14171858Elliott Hughes
1257ee3a061452c5a7e5c8e661219a1f08a14171858Elliott Hughes# Definitions to make the core-tests libraries.
1267ee3a061452c5a7e5c8e661219a1f08a14171858Elliott Hughes#
1277ee3a061452c5a7e5c8e661219a1f08a14171858Elliott Hughes# We make a library per module, because otherwise the .jar files get too
1287ee3a061452c5a7e5c8e661219a1f08a14171858Elliott Hughes# large, to the point that dx(1) can't cope (and the build is
1297ee3a061452c5a7e5c8e661219a1f08a14171858Elliott Hughes# ridiculously slow).
1307ee3a061452c5a7e5c8e661219a1f08a14171858Elliott Hughes#
13151ee38b9c39b0c36bce728a797b2c5e637be3d2cBrian Carlstrom# TODO: vogar will make this nonsense obsolete.
13251ee38b9c39b0c36bce728a797b2c5e637be3d2cBrian Carlstrom
13351ee38b9c39b0c36bce728a797b2c5e637be3d2cBrian Carlstrominclude $(CLEAR_VARS)
13451ee38b9c39b0c36bce728a797b2c5e637be3d2cBrian CarlstromLOCAL_SRC_FILES := $(call all-test-java-files-under,dalvik)
13551ee38b9c39b0c36bce728a797b2c5e637be3d2cBrian CarlstromLOCAL_JAVA_RESOURCE_DIRS := $(test_resource_dirs)
13651ee38b9c39b0c36bce728a797b2c5e637be3d2cBrian CarlstromLOCAL_NO_STANDARD_LIBRARIES := true
13751ee38b9c39b0c36bce728a797b2c5e637be3d2cBrian CarlstromLOCAL_JAVA_LIBRARIES := core core-junit core-junitrunner core-tests-support
13851ee38b9c39b0c36bce728a797b2c5e637be3d2cBrian CarlstromLOCAL_DX_FLAGS := --core-library
139d610834e0a53866778efdab2a529e7c2f9a75dc9Elliott HughesLOCAL_JAVACFLAGS := $(local_javac_flags)
14051ee38b9c39b0c36bce728a797b2c5e637be3d2cBrian CarlstromLOCAL_MODULE_TAGS := tests
14151ee38b9c39b0c36bce728a797b2c5e637be3d2cBrian CarlstromLOCAL_MODULE := core-tests-dalvik
14251ee38b9c39b0c36bce728a797b2c5e637be3d2cBrian Carlstrominclude $(BUILD_JAVA_LIBRARY)
1436ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
144d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilsoninclude $(CLEAR_VARS)
145d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_SRC_FILES := $(call all-test-java-files-under,dom)
146d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_JAVA_RESOURCE_DIRS := $(test_resource_dirs)
147d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_NO_STANDARD_LIBRARIES := true
1481708c119626a936797c7c9257af52cd629a28cbbJesse WilsonLOCAL_JAVA_LIBRARIES := core core-junit core-junitrunner core-tests-support
149d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_DX_FLAGS := --core-library
150d610834e0a53866778efdab2a529e7c2f9a75dc9Elliott HughesLOCAL_JAVACFLAGS := $(local_javac_flags)
151d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_MODULE_TAGS := tests
152d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_MODULE := core-tests-dom
1536ac43c29e4f1918d40441178c22bfca7409101beDan Bornsteininclude $(BUILD_JAVA_LIBRARY)
1546ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
155d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilsoninclude $(CLEAR_VARS)
156d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_SRC_FILES := $(call all-test-java-files-under,json)
157d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_JAVA_RESOURCE_DIRS := $(test_resource_dirs)
158d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_NO_STANDARD_LIBRARIES := true
1591708c119626a936797c7c9257af52cd629a28cbbJesse WilsonLOCAL_JAVA_LIBRARIES := core core-junit core-junitrunner core-tests-support
160d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_DX_FLAGS := --core-library
161d610834e0a53866778efdab2a529e7c2f9a75dc9Elliott HughesLOCAL_JAVACFLAGS := $(local_javac_flags)
162d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_MODULE_TAGS := tests
163d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_MODULE := core-tests-json
164d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilsoninclude $(BUILD_JAVA_LIBRARY)
165d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilson
166d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilsoninclude $(CLEAR_VARS)
167d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_SRC_FILES := $(call all-test-java-files-under,luni)
168d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_JAVA_RESOURCE_DIRS := $(test_resource_dirs)
169d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_NO_STANDARD_LIBRARIES := true
170d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilson# This module contains the top-level "tests.AllTests" that ties everything
171d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilson# together, so it has compile-time dependencies on all the other test
172d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilson# libraries.
173d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilson# TODO: we should have a bogus module that just contains tests.AllTests for speed.
174d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_JAVA_LIBRARIES := \
17512cd1f00c2fa1a7f37bf644cecdf7588bdc0b0a9Brian Carlstrom        bouncycastle \
176d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilson        core \
177d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilson        core-junit \
1781708c119626a936797c7c9257af52cd629a28cbbJesse Wilson        core-junitrunner \
179bf1ecf255af211d1657886a56fec2a4415c81517Elliott Hughes        core-tests-support \
18051ee38b9c39b0c36bce728a797b2c5e637be3d2cBrian Carlstrom        core-tests-dalvik \
181d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilson        core-tests-dom \
182d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilson        core-tests-json \
183cec4dd4b1d33f78997603d0f89c0d0e56e64dbcdPeter Hallam        core-tests-xml \
184cec4dd4b1d33f78997603d0f89c0d0e56e64dbcdPeter Hallam        sqlite-jdbc
185d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_DX_FLAGS := --core-library
186d610834e0a53866778efdab2a529e7c2f9a75dc9Elliott HughesLOCAL_JAVACFLAGS := $(local_javac_flags)
187d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_MODULE_TAGS := tests
188b094af3cdc9225356724ff4b4f431fb51f781594Brian CarlstromLOCAL_MODULE := core-tests
18983244e5bec9d489a097251c3df8cd22b36f4f648Guang Zhu
19083244e5bec9d489a097251c3df8cd22b36f4f648Guang ZhuLOCAL_NO_EMMA_INSTRUMENT := true
19183244e5bec9d489a097251c3df8cd22b36f4f648Guang ZhuLOCAL_NO_EMMA_COMPILE := true
19283244e5bec9d489a097251c3df8cd22b36f4f648Guang Zhu
193d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilsoninclude $(BUILD_JAVA_LIBRARY)
194d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilson
195d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilsoninclude $(CLEAR_VARS)
1967ee3a061452c5a7e5c8e661219a1f08a14171858Elliott HughesLOCAL_SRC_FILES := $(call all-test-java-files-under,support)
197d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_JAVA_RESOURCE_DIRS := $(test_resource_dirs)
198d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_NO_STANDARD_LIBRARIES := true
19912cd1f00c2fa1a7f37bf644cecdf7588bdc0b0a9Brian CarlstromLOCAL_JAVA_LIBRARIES := bouncycastle core core-junit core-junitrunner
200d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_DX_FLAGS := --core-library
201d610834e0a53866778efdab2a529e7c2f9a75dc9Elliott HughesLOCAL_JAVACFLAGS := $(local_javac_flags)
202d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_MODULE_TAGS := tests
203d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_MODULE := core-tests-support
204d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilsoninclude $(BUILD_JAVA_LIBRARY)
205d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilson
206d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilsoninclude $(CLEAR_VARS)
207d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_SRC_FILES := $(call all-test-java-files-under,xml)
208d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_JAVA_RESOURCE_DIRS := $(test_resource_dirs)
209d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_NO_STANDARD_LIBRARIES := true
2101708c119626a936797c7c9257af52cd629a28cbbJesse WilsonLOCAL_JAVA_LIBRARIES := core core-junit core-junitrunner core-tests-support
211d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_DX_FLAGS := --core-library
212d610834e0a53866778efdab2a529e7c2f9a75dc9Elliott HughesLOCAL_JAVACFLAGS := $(local_javac_flags)
213d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_MODULE_TAGS := tests
214d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse WilsonLOCAL_MODULE := core-tests-xml
215d5d3526b485a6d79ec06598540ce77c6f3698f01Jesse Wilsoninclude $(BUILD_JAVA_LIBRARY)
2166ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
217706d53593cd8841d378dbe298a8d1940db1e71dfJesse Wilson# also build support as a static library for use by frameworks/base HTTPS tests
218706d53593cd8841d378dbe298a8d1940db1e71dfJesse Wilsoninclude $(CLEAR_VARS)
219706d53593cd8841d378dbe298a8d1940db1e71dfJesse WilsonLOCAL_SRC_FILES := $(call all-test-java-files-under,support)
220706d53593cd8841d378dbe298a8d1940db1e71dfJesse WilsonLOCAL_JAVA_RESOURCE_DIRS := $(test_resource_dirs)
221706d53593cd8841d378dbe298a8d1940db1e71dfJesse WilsonLOCAL_NO_STANDARD_LIBRARIES := true
22212cd1f00c2fa1a7f37bf644cecdf7588bdc0b0a9Brian CarlstromLOCAL_JAVA_LIBRARIES := bouncycastle core core-junit core-junitrunner
223706d53593cd8841d378dbe298a8d1940db1e71dfJesse WilsonLOCAL_DX_FLAGS := --core-library
224d610834e0a53866778efdab2a529e7c2f9a75dc9Elliott HughesLOCAL_JAVACFLAGS := $(local_javac_flags)
225706d53593cd8841d378dbe298a8d1940db1e71dfJesse WilsonLOCAL_MODULE_TAGS := tests
226706d53593cd8841d378dbe298a8d1940db1e71dfJesse WilsonLOCAL_MODULE := core-tests-supportlib
227706d53593cd8841d378dbe298a8d1940db1e71dfJesse Wilsoninclude $(BUILD_STATIC_JAVA_LIBRARY)
228706d53593cd8841d378dbe298a8d1940db1e71dfJesse Wilson
2296ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# This one's tricky. One of our tests needs to have a
2306ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# resource with a "#" in its name, but Perforce doesn't
2316ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# allow us to submit such a file. So we create it here
2326ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# on-the-fly.
2336ac43c29e4f1918d40441178c22bfca7409101beDan BornsteinTMP_RESOURCE_DIR := $(OUT_DIR)/tmp/
2346ac43c29e4f1918d40441178c22bfca7409101beDan BornsteinTMP_RESOURCE_FILE := org/apache/harmony/luni/tests/java/lang/test\#.properties
2356ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
2366ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein$(TMP_RESOURCE_DIR)$(TMP_RESOURCE_FILE):
2376ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein	@mkdir -p $(dir $@)
2386ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein	@echo "Hello, world!" > $@
2396ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
2406ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_EXTRA_JAR_ARGS := $(extra_jar_args) -C $(TMP_RESOURCE_DIR) $(TMP_RESOURCE_FILE)
2416ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein$(LOCAL_INTERMEDIATE_TARGETS): $(TMP_RESOURCE_DIR)$(TMP_RESOURCE_FILE)
2426ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
2436ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# Definitions for building a version of the core-tests.jar
2446ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# that is suitable for execution on the RI. This JAR would
2456ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# be better located in $HOST_OUT_JAVA_LIBRARIES, but it is
2466ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# not possible to refer to that from a shell script (the
2476ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# variable is not exported from envsetup.sh). There is also
2486ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# some trickery involved: we need to include some classes
2496ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# that reside in core.jar, but since we cannot incldue the
2506ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# whole core.jar in the RI classpath, we copy those classses
2516ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# over to our new file.
2526ac43c29e4f1918d40441178c22bfca7409101beDan BornsteinHOST_CORE_JAR := $(HOST_COMMON_OUT_ROOT)/core-tests.jar
2536ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
2546ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein$(HOST_CORE_JAR): PRIVATE_LOCAL_BUILT_MODULE := $(LOCAL_BUILT_MODULE)
2556ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein$(HOST_CORE_JAR): PRIVATE_CORE_INTERMEDIATES := $(core-intermediates)
2566ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein$(HOST_CORE_JAR): $(LOCAL_BUILT_MODULE)
2576ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein	@rm -rf $(dir $<)/hostctsclasses
2586ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein	$(call unzip-jar-files,$(dir $<)classes.jar,$(dir $<)hostctsclasses)
2596ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein	@unzip -qx -o $(PRIVATE_CORE_INTERMEDIATES)/classes.jar dalvik/annotation/* -d $(dir $<)hostctsclasses
2606ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein	@cp $< $@
2616ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein	@jar uf $@ -C $(dir $<)hostctsclasses .
2626ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
2636ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein$(LOCAL_INSTALLED_MODULE): $(HOST_CORE_JAR)
2646ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
2656ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
2666ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein#
2676ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein# Build for the host.
2686ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein#
2696ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
2706ac43c29e4f1918d40441178c22bfca7409101beDan Bornsteinifeq ($(WITH_HOST_DALVIK),true)
2716ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
2726ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein    # Definitions to make the core library.
2736ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
2746ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein    include $(CLEAR_VARS)
2756ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
2766ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein    LOCAL_SRC_FILES := $(core_src_files)
2776ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein    LOCAL_JAVA_RESOURCE_DIRS := $(core_resource_dirs)
2786ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
2796ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein    LOCAL_NO_STANDARD_LIBRARIES := true
28048d0b3ffb83c2d9f08d9f4debb09e9798cf67c6aElliott Hughes    LOCAL_JAVACFLAGS := $(local_javac_flags)
2816ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein    LOCAL_DX_FLAGS := --core-library
2826ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
2836ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein    LOCAL_NO_EMMA_INSTRUMENT := true
2846ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein    LOCAL_NO_EMMA_COMPILE := true
2857898a917ea805abf9f320ed42285ff3adf79968dJesse Wilson    LOCAL_BUILD_HOST_DEX := true
2866ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
287f2678961b60cfe08d8b9aa1210cb75291496f83fJean-Baptiste Queru    LOCAL_MODULE_TAGS := optional
28853fbc0a776feebcc04f6c24b34f2c7ba39e6b5a1Jesse Wilson    LOCAL_MODULE := core-hostdex
2896ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
2906ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein    include $(BUILD_HOST_JAVA_LIBRARY)
2916ac43c29e4f1918d40441178c22bfca7409101beDan Bornstein
29267cc34b75c18ae7d02c90282cb8616b82e1d8fcbElliott Hughesendif
293dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom
294dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom#
295dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom# Local droiddoc for faster libcore testing
296dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom#
297dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom#
298dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom# Run with:
299dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom#     m libcore-docs
300dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom#
301dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom# Main output:
302dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom#     out/target/common/docs/libcore/reference/packages.html
303dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom#
304dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom# All text for proofreading (or running tools over):
305dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom#     out/target/common/docs/libcore-proofread.txt
306dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom#
307dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom# TODO list of missing javadoc, etc:
308dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom#     out/target/common/docs/libcore-docs-todo.html
309dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom#
310dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom# Rerun:
311dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom#     rm -rf out/target/common/docs/libcore-timestamp && m libcore-docs
312dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom#
313dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrominclude $(CLEAR_VARS)
314dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom
315dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom# for shared defintion of libcore_to_document
316dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrominclude $(LOCAL_PATH)/Docs.mk
317dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom
318dc3c15284f838a1330135249b7b8255b616b4670Brian CarlstromLOCAL_SRC_FILES:=$(call find-other-java-files, $(libcore_to_document))
319dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom# rerun doc generation without recompiling the java
320dc3c15284f838a1330135249b7b8255b616b4670Brian CarlstromLOCAL_JAVA_LIBRARIES:=
321d610834e0a53866778efdab2a529e7c2f9a75dc9Elliott HughesLOCAL_JAVACFLAGS := $(local_javac_flags)
322dc3c15284f838a1330135249b7b8255b616b4670Brian CarlstromLOCAL_MODULE_CLASS:=JAVA_LIBRARIES
323dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom
324dc3c15284f838a1330135249b7b8255b616b4670Brian CarlstromLOCAL_MODULE := libcore
325dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom
326dc3c15284f838a1330135249b7b8255b616b4670Brian CarlstromLOCAL_DROIDDOC_OPTIONS:= \
327dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom -offlinemode \
328dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom -title "libcore" \
329dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom -proofread $(OUT_DOCS)/$(LOCAL_MODULE)-proofread.txt \
330dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom -todo ../$(LOCAL_MODULE)-docs-todo.html \
331dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom -hdf android.whichdoc offline
332dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom
333dc3c15284f838a1330135249b7b8255b616b4670Brian CarlstromLOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=build/tools/droiddoc/templates-sdk
334dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrom
335dc3c15284f838a1330135249b7b8255b616b4670Brian Carlstrominclude $(BUILD_DROIDDOC)
336