blob: 168e82e5804ce411022583b950bffd52b2522dd1 [file] [log] [blame]
Elliott Hughes7ee3a062010-02-18 17:20:15 -08001# -*- mode: makefile -*-
Dan Bornstein6ac43c22009-10-24 15:33:49 -07002# Copyright (C) 2007 The Android Open Source Project
3#
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
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
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.
15
16#
17# Definitions for building the Java library and associated tests.
18#
19
20#
21# Common definitions for host and target.
22#
23
Jesse Wilsond5d35262010-05-12 23:56:14 -070024# libcore is divided into modules.
25#
26# The structure of each module is:
27#
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.
37#
38# All subdirectories are optional (hence the "2> /dev/null"s below).
Dan Bornstein6ac43c22009-10-24 15:33:49 -070039
Colin Cross97622642017-09-21 23:32:23 +000040include $(LOCAL_PATH)/openjdk_java_files.mk
41include $(LOCAL_PATH)/non_openjdk_java_files.mk
42
Jesse Wilson32cfe952010-05-04 16:36:03 -070043define all-test-java-files-under
Przemyslaw Szczepaniakebe4f192015-07-09 13:19:15 +010044$(foreach dir,$(1),$(patsubst ./%,%,$(shell cd $(LOCAL_PATH) && (find $(dir)/src/test/java -name "*.java" 2> /dev/null) | grep -v -f java_tests_blacklist)))
Dan Bornstein6ac43c22009-10-24 15:33:49 -070045endef
46
Dan Bornstein6ac43c22009-10-24 15:33:49 -070047define all-core-resource-dirs
48$(shell cd $(LOCAL_PATH) && ls -d */src/$(1)/{java,resources} 2> /dev/null)
49endef
50
Jesse Wilsond5d35262010-05-12 23:56:14 -070051# The Java files and their associated resources.
Narayan Kamath29c564f2015-07-30 12:05:42 +010052core_resource_dirs := \
53 luni/src/main/java \
54 ojluni/src/main/resources/
Joachim Sauerac12c752017-01-30 18:47:15 +000055test_resource_dirs := $(filter-out ojluni/%,$(call all-core-resource-dirs,test))
Paul Duffinfe0ee8e2016-08-12 11:32:44 +010056test_src_files := $(call all-test-java-files-under,dalvik dalvik/test-rules dom harmony-tests json luni xml)
Igor Murashkin4c65c012016-03-24 20:52:10 +000057ojtest_src_files := $(call all-test-java-files-under,ojluni)
Joachim Sauerac12c752017-01-30 18:47:15 +000058ojtest_resource_dirs := $(filter ojluni/%,$(call all-core-resource-dirs,test))
Dan Bornstein6ac43c22009-10-24 15:33:49 -070059
Jesse Wilson7898a912010-09-13 15:42:41 -070060ifeq ($(EMMA_INSTRUMENT),true)
Ying Wangff053c32012-08-21 17:20:51 -070061ifneq ($(EMMA_INSTRUMENT_STATIC),true)
Piotr Jastrzebski51b1b692015-02-16 15:01:09 +000062 nojcore_src_files += $(call all-java-files-under, ../external/emma/core ../external/emma/pregenerated)
Jesse Wilson7898a912010-09-13 15:42:41 -070063 core_resource_dirs += ../external/emma/core/res ../external/emma/pregenerated/res
64endif
Ying Wangff053c32012-08-21 17:20:51 -070065endif
Jesse Wilson7898a912010-09-13 15:42:41 -070066
Elliott Hughes48d0b3f2010-12-14 09:48:52 -080067local_javac_flags=-encoding UTF-8
68#local_javac_flags+=-Xlint:all -Xlint:-serial,-deprecation,-unchecked
69local_javac_flags+=-Xmaxwarns 9999999
Dan Bornstein6ac43c22009-10-24 15:33:49 -070070
Narayan Kamath85952e22017-06-14 17:23:34 +010071# For user / userdebug builds, strip the local variable table and the local variable
72# type table. This has no bearing on stack traces, but will leave less information
73# available via JDWP.
74#
75# TODO: Should this be conditioned on a PRODUCT_ flag or should we just turn this
76# on for all builds. Also, name of the flag TBD.
77ifneq (,$(PRODUCT_MINIMIZE_JAVA_DEBUG_INFO))
78ifneq (,$(filter userdebug user,$(TARGET_BUILD_VARIANT)))
79local_javac_flags+= -g:source,lines
80local_jack_flags+= -D jack.dex.debug.vars=false -D jack.dex.debug.vars.synthetic=false
81endif
82endif
Narayan Kamath1a0f1842015-09-07 12:59:53 +010083
Dan Bornstein6ac43c22009-10-24 15:33:49 -070084#
Narayan Kamathf37f7812015-04-01 09:34:24 +010085# ICU4J related rules.
86#
Neil Fuller72802992015-10-05 15:39:53 +010087# We compile android_icu4j along with core-libart because we're implementing parts of core-libart
88# in terms of android_icu4j.
89android_icu4j_root := ../external/icu/android_icu4j/
Paul Duffina98463d2016-02-25 16:02:42 +000090android_icu4j_src_files := $(call all-java-files-under,$(android_icu4j_root)/src/main/java)
Neil Fuller72802992015-10-05 15:39:53 +010091android_icu4j_resource_dirs := $(android_icu4j_root)/resources
Narayan Kamathf37f7812015-04-01 09:34:24 +010092
93#
Dan Bornstein6ac43c22009-10-24 15:33:49 -070094# Build for the target (device).
95#
96
Colin Cross97622642017-09-21 23:32:23 +000097include $(CLEAR_VARS)
98LOCAL_SRC_FILES := $(openjdk_java_files) $(non_openjdk_java_files) $(android_icu4j_src_files) $(openjdk_lambda_stub_files)
99LOCAL_JAVA_RESOURCE_DIRS := $(core_resource_dirs) $(android_icu4j_resource_dirs)
100LOCAL_NO_STANDARD_LIBRARIES := true
101LOCAL_JAVACFLAGS := $(local_javac_flags)
102LOCAL_JACK_FLAGS := $(local_jack_flags)
103LOCAL_DX_FLAGS := --core-library
104LOCAL_MODULE_TAGS := optional
105LOCAL_MODULE := core-all
106LOCAL_REQUIRED_MODULES := tzdata tzlookup.xml
107LOCAL_CORE_LIBRARY := true
108LOCAL_UNINSTALLABLE_MODULE := true
109include $(BUILD_JAVA_LIBRARY)
110
111include $(CLEAR_VARS)
112LOCAL_SRC_FILES := $(openjdk_java_files)
113LOCAL_JAVA_RESOURCE_DIRS := $(core_resource_dirs)
114LOCAL_NO_STANDARD_LIBRARIES := true
115LOCAL_JAVACFLAGS := $(local_javac_flags)
116LOCAL_JACK_FLAGS := $(local_jack_flags)
117LOCAL_DX_FLAGS := --core-library
118LOCAL_MODULE_TAGS := optional
119LOCAL_MODULE := core-oj
120LOCAL_JAVA_LIBRARIES := core-all
121LOCAL_NOTICE_FILE := $(LOCAL_PATH)/ojluni/NOTICE
122LOCAL_REQUIRED_MODULES := tzdata tzlookup.xml
123LOCAL_CORE_LIBRARY := true
124include $(BUILD_JAVA_LIBRARY)
125
126# Definitions to make the core library.
127include $(CLEAR_VARS)
128LOCAL_SRC_FILES := $(non_openjdk_java_files) $(android_icu4j_src_files)
129LOCAL_JAVA_RESOURCE_DIRS := $(android_icu4j_resource_dirs)
130LOCAL_NO_STANDARD_LIBRARIES := true
131LOCAL_JAVACFLAGS := $(local_javac_flags)
132LOCAL_JACK_FLAGS := $(local_jack_flags)
133LOCAL_DX_FLAGS := --core-library
134LOCAL_MODULE_TAGS := optional
135LOCAL_MODULE := core-libart
136LOCAL_JAVA_LIBRARIES := core-all
137LOCAL_CORE_LIBRARY := true
138LOCAL_REQUIRED_MODULES := tzdata tzlookup.xml
139include $(BUILD_JAVA_LIBRARY)
140
141# A library that exists to satisfy javac when
142# compiling source code that contains lambdas.
143include $(CLEAR_VARS)
144LOCAL_SRC_FILES := $(openjdk_lambda_stub_files) $(openjdk_lambda_duplicate_stub_files)
145LOCAL_NO_STANDARD_LIBRARIES := true
146LOCAL_JAVACFLAGS := $(local_javac_flags)
147LOCAL_JACK_FLAGS := $(local_jack_flags)
148LOCAL_DX_FLAGS := --core-library
149LOCAL_MODULE_TAGS := optional
150LOCAL_MODULE := core-lambda-stubs
Colin Crossb218d662017-09-21 17:25:56 -0700151# Deliberately include the sources alongside the .class files to simplify
152# distribution
153LOCAL_JAVA_RESOURCE_FILES := \
154 $(patsubst ojluni/src/lambda/java/%, \
155 $(LOCAL_PATH)/ojluni/src/lambda/java:%,$(LOCAL_SRC_FILES))
Colin Cross97622642017-09-21 23:32:23 +0000156LOCAL_JAVA_LIBRARIES := core-all
157LOCAL_NOTICE_FILE := $(LOCAL_PATH)/ojluni/NOTICE
158LOCAL_CORE_LIBRARY := true
159LOCAL_UNINSTALLABLE_MODULE := true
160include $(BUILD_JAVA_LIBRARY)
161
Kenny Root38375a42013-04-23 15:50:31 -0700162ifeq ($(LIBCORE_SKIP_TESTS),)
Nicolas Geoffray2b422602017-03-01 10:49:31 +0000163# A guaranteed unstripped version of core-oj and core-libart.
164# The build system may or may not strip the core-oj and core-libart jars,
165# but these will not be stripped. See b/24535627.
Andreas Gampe78590262015-09-30 11:55:03 -0700166include $(CLEAR_VARS)
Colin Cross97622642017-09-21 23:32:23 +0000167LOCAL_SRC_FILES := $(openjdk_java_files)
Andreas Gampe78590262015-09-30 11:55:03 -0700168LOCAL_JAVA_RESOURCE_DIRS := $(core_resource_dirs)
169LOCAL_NO_STANDARD_LIBRARIES := true
170LOCAL_JAVACFLAGS := $(local_javac_flags)
Narayan Kamath85952e22017-06-14 17:23:34 +0100171LOCAL_JACK_FLAGS := $(local_jack_flags)
Colin Cross96a55292016-12-21 16:42:56 -0800172LOCAL_DX_FLAGS := --core-library
Andreas Gampe78590262015-09-30 11:55:03 -0700173LOCAL_MODULE_TAGS := optional
174LOCAL_DEX_PREOPT := false
175LOCAL_MODULE := core-oj-testdex
Andreas Gampe78590262015-09-30 11:55:03 -0700176LOCAL_JAVA_LIBRARIES := core-all
177LOCAL_NOTICE_FILE := $(LOCAL_PATH)/ojluni/NOTICE
Neil Fuller085fbff2017-03-30 18:18:11 +0100178LOCAL_REQUIRED_MODULES := tzdata tzlookup.xml
Andreas Gampe78590262015-09-30 11:55:03 -0700179LOCAL_CORE_LIBRARY := true
Andreas Gampe78590262015-09-30 11:55:03 -0700180include $(BUILD_JAVA_LIBRARY)
181
Paul Duffinfe0ee8e2016-08-12 11:32:44 +0100182# Build libcore test rules for target
183include $(CLEAR_VARS)
184LOCAL_SRC_FILES := $(call all-java-files-under, dalvik/test-rules/src/main test-rules/src/main)
185LOCAL_NO_STANDARD_LIBRARIES := true
186LOCAL_MODULE := core-test-rules
Paul Duffinc347df82016-11-29 12:17:05 +0000187LOCAL_JAVA_LIBRARIES := core-all
188LOCAL_STATIC_JAVA_LIBRARIES := junit
Paul Duffinfe0ee8e2016-08-12 11:32:44 +0100189include $(BUILD_STATIC_JAVA_LIBRARY)
190
191# Build libcore test rules for host
192include $(CLEAR_VARS)
193LOCAL_SRC_FILES := $(call all-java-files-under, dalvik/test-rules/src/main test-rules/src/main)
194LOCAL_NO_STANDARD_LIBRARIES := true
195LOCAL_MODULE := core-test-rules-hostdex
Paul Duffin1eac8b32016-11-25 14:40:21 +0000196LOCAL_JAVA_LIBRARIES := core-oj-hostdex core-libart-hostdex
197LOCAL_STATIC_JAVA_LIBRARIES := junit-hostdex
Colin Cross5c173d72017-01-19 14:20:20 -0800198include $(BUILD_HOST_DALVIK_STATIC_JAVA_LIBRARY)
Paul Duffinfe0ee8e2016-08-12 11:32:44 +0100199
Andreas Gampe78590262015-09-30 11:55:03 -0700200include $(CLEAR_VARS)
Colin Cross97622642017-09-21 23:32:23 +0000201LOCAL_SRC_FILES := $(non_openjdk_java_files) $(android_icu4j_src_files)
Andreas Gampe78590262015-09-30 11:55:03 -0700202LOCAL_JAVA_RESOURCE_DIRS := $(android_icu4j_resource_dirs)
203LOCAL_NO_STANDARD_LIBRARIES := true
204LOCAL_JAVACFLAGS := $(local_javac_flags)
Narayan Kamath85952e22017-06-14 17:23:34 +0100205LOCAL_JACK_FLAGS := $(local_jack_flags)
Colin Cross96a55292016-12-21 16:42:56 -0800206LOCAL_DX_FLAGS := --core-library
Andreas Gampe78590262015-09-30 11:55:03 -0700207LOCAL_MODULE_TAGS := optional
208LOCAL_DEX_PREOPT := false
209LOCAL_MODULE := core-libart-testdex
Andreas Gampe78590262015-09-30 11:55:03 -0700210LOCAL_JAVA_LIBRARIES := core-all
211LOCAL_CORE_LIBRARY := true
Neil Fuller085fbff2017-03-30 18:18:11 +0100212LOCAL_REQUIRED_MODULES := tzdata tzlookup.xml
Andreas Gampe78590262015-09-30 11:55:03 -0700213include $(BUILD_JAVA_LIBRARY)
214endif
215
216ifeq ($(LIBCORE_SKIP_TESTS),)
Shubham Ajmeracfcde6a2017-02-09 13:24:00 +0000217# Build a library just containing files from luni/src/test/filesystems for use in tests.
218include $(CLEAR_VARS)
219LOCAL_SRC_FILES := $(call all-java-files-under, luni/src/test/filesystems/src)
220LOCAL_JAVA_RESOURCE_DIRS := luni/src/test/filesystems/resources
221LOCAL_NO_STANDARD_LIBRARIES := true
222LOCAL_MODULE := filesystemstest
223LOCAL_JAVA_LIBRARIES := core-oj core-libart
224LOCAL_DEX_PREOPT := false
225include $(BUILD_JAVA_LIBRARY)
Dan Willemsen6a6398f2017-03-20 10:47:51 -0700226my_filesystemstest_jar := $(intermediates)/filesystemstest.jar
227$(my_filesystemstest_jar): $(LOCAL_BUILT_MODULE)
228 $(call copy-file-to-target)
Shubham Ajmeracfcde6a2017-02-09 13:24:00 +0000229endif
230
231ifeq ($(LIBCORE_SKIP_TESTS),)
Kenny Root38375a42013-04-23 15:50:31 -0700232# Make the core-tests library.
233include $(CLEAR_VARS)
Narayan Kamath51525b52013-11-15 18:02:54 +0000234LOCAL_SRC_FILES := $(test_src_files)
Brian Carlstrom51ee38b2010-07-23 15:57:52 -0700235LOCAL_JAVA_RESOURCE_DIRS := $(test_resource_dirs)
Shubham Ajmeracfcde6a2017-02-09 13:24:00 +0000236# Include individual dex.jar files (jars containing resources and a classes.dex) so that they
237# be loaded by tests using ClassLoaders but are not in the main classes.dex.
Dan Willemsen6a6398f2017-03-20 10:47:51 -0700238LOCAL_JAVA_RESOURCE_FILES := $(my_filesystemstest_jar)
Brian Carlstrom51ee38b2010-07-23 15:57:52 -0700239LOCAL_NO_STANDARD_LIBRARIES := true
Adam Vartaniance696362017-03-03 14:07:19 +0000240LOCAL_JAVA_LIBRARIES := core-oj core-libart okhttp bouncycastle
Paul Duffinfe0ee8e2016-08-12 11:32:44 +0100241LOCAL_STATIC_JAVA_LIBRARIES := \
Neil Fullerf04b9af2017-05-24 11:48:12 +0100242 archive-patcher \
Paul Duffinfe0ee8e2016-08-12 11:32:44 +0100243 core-test-rules \
244 core-tests-support \
Neil Fullerf04b9af2017-05-24 11:48:12 +0100245 junit-params \
Tobias Thierer62db9f92016-11-28 12:24:32 +0000246 mockftpserver \
Adam Vartaniance696362017-03-03 14:07:19 +0000247 mockito-target \
Paul Duffinfe0ee8e2016-08-12 11:32:44 +0100248 mockwebserver \
249 nist-pkix-tests \
Tobias Thierer62db9f92016-11-28 12:24:32 +0000250 slf4j-jdk14 \
Neil Fuller8e0c3492016-12-09 18:32:10 +0000251 sqlite-jdbc \
Neil Fullerf04b9af2017-05-24 11:48:12 +0100252 tzdata-testing
Elliott Hughesd6108342011-02-22 10:13:54 -0800253LOCAL_JAVACFLAGS := $(local_javac_flags)
Narayan Kamath85952e22017-06-14 17:23:34 +0100254LOCAL_JACK_FLAGS := $(local_jack_flags)
Sergio Giro2cdb68f2016-10-28 20:13:36 +0100255LOCAL_ERROR_PRONE_FLAGS := -Xep:TryFailThrowable:ERROR -Xep:ComparisonOutOfRange:ERROR
Brian Carlstromb094af32010-05-28 17:37:37 -0700256LOCAL_MODULE := core-tests
Jesse Wilson706d5352010-06-08 17:20:09 -0700257include $(BUILD_STATIC_JAVA_LIBRARY)
Elliott Hughesc5cd6e82012-10-18 18:13:10 -0700258endif
Jesse Wilson706d5352010-06-08 17:20:09 -0700259
Tsu Chiang Chuang808558f2013-08-21 11:46:49 -0700260ifeq ($(LIBCORE_SKIP_TESTS),)
Kenny Rootb397b192013-08-29 14:24:47 -0700261# Make the core-tests-support library.
262include $(CLEAR_VARS)
263LOCAL_SRC_FILES := $(call all-test-java-files-under,support)
264LOCAL_JAVA_RESOURCE_DIRS := $(test_resource_dirs)
265LOCAL_NO_STANDARD_LIBRARIES := true
Paul Duffinc347df82016-11-29 12:17:05 +0000266LOCAL_JAVA_LIBRARIES := core-oj core-libart junit bouncycastle
Kenny Root0435fdb2016-03-30 12:52:38 -0700267LOCAL_STATIC_JAVA_LIBRARIES := bouncycastle-bcpkix bouncycastle-ocsp
Kenny Rootb397b192013-08-29 14:24:47 -0700268LOCAL_JAVACFLAGS := $(local_javac_flags)
Narayan Kamath85952e22017-06-14 17:23:34 +0100269LOCAL_JACK_FLAGS := $(local_jack_flags)
Kenny Rootb397b192013-08-29 14:24:47 -0700270LOCAL_MODULE := core-tests-support
Kenny Rootb397b192013-08-29 14:24:47 -0700271include $(BUILD_STATIC_JAVA_LIBRARY)
272endif
273
274ifeq ($(LIBCORE_SKIP_TESTS),)
Tsu Chiang Chuang808558f2013-08-21 11:46:49 -0700275# Make the jsr166-tests library.
276include $(CLEAR_VARS)
277LOCAL_SRC_FILES := $(call all-test-java-files-under, jsr166-tests)
278LOCAL_JAVA_RESOURCE_DIRS := $(test_resource_dirs)
279LOCAL_NO_STANDARD_LIBRARIES := true
Paul Duffinc347df82016-11-29 12:17:05 +0000280LOCAL_JAVA_LIBRARIES := core-oj core-libart junit
Tsu Chiang Chuang808558f2013-08-21 11:46:49 -0700281LOCAL_JAVACFLAGS := $(local_javac_flags)
Narayan Kamath85952e22017-06-14 17:23:34 +0100282LOCAL_JACK_FLAGS := $(local_jack_flags)
Tsu Chiang Chuang808558f2013-08-21 11:46:49 -0700283LOCAL_MODULE := jsr166-tests
Tsu Chiang Chuang808558f2013-08-21 11:46:49 -0700284include $(BUILD_STATIC_JAVA_LIBRARY)
285endif
286
Igor Murashkinc8b2c562016-04-27 15:43:33 -0700287# Make the core-ojtests library.
288ifeq ($(LIBCORE_SKIP_TESTS),)
289 include $(CLEAR_VARS)
Joachim Sauerac12c752017-01-30 18:47:15 +0000290 LOCAL_JAVA_RESOURCE_DIRS := $(ojtest_resource_dirs)
Igor Murashkinc8b2c562016-04-27 15:43:33 -0700291 LOCAL_NO_STANDARD_LIBRARIES := true
Narayan Kamathd097a9b2016-09-22 17:07:15 +0100292 LOCAL_JAVA_LIBRARIES := core-oj core-libart okhttp bouncycastle
Igor Murashkinc8b2c562016-04-27 15:43:33 -0700293 LOCAL_STATIC_JAVA_LIBRARIES := testng
294 LOCAL_JAVACFLAGS := $(local_javac_flags)
Narayan Kamath85952e22017-06-14 17:23:34 +0100295 LOCAL_JACK_FLAGS := $(local_jack_flags)
Colin Cross96a55292016-12-21 16:42:56 -0800296 LOCAL_DX_FLAGS := --core-library
Igor Murashkinc8b2c562016-04-27 15:43:33 -0700297 LOCAL_MODULE_TAGS := optional
Igor Murashkinc8b2c562016-04-27 15:43:33 -0700298 LOCAL_MODULE := core-ojtests
Igor Murashkinc8b2c562016-04-27 15:43:33 -0700299 # jack bug workaround: int[] java.util.stream.StatefulTestOp.-getjava-util-stream-StreamShapeSwitchesValues() is a private synthetic method in an interface which causes a hard verifier error
300 LOCAL_DEX_PREOPT := false # disable AOT preverification which breaks the build. it will still throw VerifyError at runtime.
301 include $(BUILD_JAVA_LIBRARY)
302endif
303
304# Make the core-ojtests-public library. Excludes any private API tests.
305ifeq ($(LIBCORE_SKIP_TESTS),)
306 include $(CLEAR_VARS)
307 # Filter out SerializedLambdaTest because it depends on stub classes and won't actually run.
Joachim Sauer8aeb9192017-01-06 17:05:35 +0000308 LOCAL_SRC_FILES := $(filter-out %/DeserializeMethodTest.java %/SerializedLambdaTest.java ojluni/src/test/java/util/stream/boot%,$(ojtest_src_files)) # Do not include anything from the boot* directories. Those directories need a custom bootclasspath to run.
Igor Murashkinc8b2c562016-04-27 15:43:33 -0700309 # Include source code as part of JAR
Joachim Sauerac12c752017-01-30 18:47:15 +0000310 LOCAL_JAVA_RESOURCE_DIRS := ojluni/src/test/dist $(ojtest_resource_dirs)
Igor Murashkinc8b2c562016-04-27 15:43:33 -0700311 LOCAL_NO_STANDARD_LIBRARIES := true
Tobias Thiererd5e8f8c2016-12-22 12:25:26 +0000312 LOCAL_JAVA_LIBRARIES := \
313 bouncycastle \
314 core-libart \
315 core-oj \
316 okhttp \
317 testng
Igor Murashkinc8b2c562016-04-27 15:43:33 -0700318 LOCAL_JAVACFLAGS := $(local_javac_flags)
Narayan Kamath85952e22017-06-14 17:23:34 +0100319 LOCAL_JACK_FLAGS := $(local_jack_flags)
Colin Cross96a55292016-12-21 16:42:56 -0800320 LOCAL_DX_FLAGS := --core-library
Igor Murashkinc8b2c562016-04-27 15:43:33 -0700321 LOCAL_MODULE_TAGS := optional
Igor Murashkinc8b2c562016-04-27 15:43:33 -0700322 LOCAL_MODULE := core-ojtests-public
Igor Murashkinc8b2c562016-04-27 15:43:33 -0700323 # jack bug workaround: int[] java.util.stream.StatefulTestOp.-getjava-util-stream-StreamShapeSwitchesValues() is a private synthetic method in an interface which causes a hard verifier error
324 LOCAL_DEX_PREOPT := false # disable AOT preverification which breaks the build. it will still throw VerifyError at runtime.
325 include $(BUILD_JAVA_LIBRARY)
326endif
327
Dan Bornstein6ac43c22009-10-24 15:33:49 -0700328#
329# Build for the host.
330#
331
Elliott Hughese983a0b2015-01-16 10:47:17 -0800332ifeq ($(HOST_OS),linux)
333
Ian Rogers3deabd22014-05-23 15:12:42 -0700334include $(CLEAR_VARS)
Colin Cross97622642017-09-21 23:32:23 +0000335LOCAL_SRC_FILES := $(non_openjdk_java_files) $(openjdk_java_files) $(android_icu4j_src_files) $(openjdk_lambda_stub_files)
Przemyslaw Szczepaniake3b37c22015-09-28 16:24:00 +0100336LOCAL_JAVA_RESOURCE_DIRS := $(core_resource_dirs)
Ian Rogers3deabd22014-05-23 15:12:42 -0700337LOCAL_NO_STANDARD_LIBRARIES := true
338LOCAL_JAVACFLAGS := $(local_javac_flags)
Colin Cross96a55292016-12-21 16:42:56 -0800339LOCAL_DX_FLAGS := --core-library
Ian Rogers3deabd22014-05-23 15:12:42 -0700340LOCAL_MODULE_TAGS := optional
Piotr Jastrzebski51b1b692015-02-16 15:01:09 +0000341LOCAL_MODULE := core-all-hostdex
Neil Fuller085fbff2017-03-30 18:18:11 +0100342LOCAL_REQUIRED_MODULES := tzdata-host tzlookup.xml-host
Piotr Jastrzebski5c3c9df2015-04-20 10:56:00 +0100343LOCAL_CORE_LIBRARY := true
Narayan Kamath0ebbfbd2015-07-30 15:01:19 +0100344LOCAL_UNINSTALLABLE_MODULE := true
Ian Rogers3deabd22014-05-23 15:12:42 -0700345include $(BUILD_HOST_DALVIK_JAVA_LIBRARY)
Dan Bornstein6ac43c22009-10-24 15:33:49 -0700346
Narayan Kamathf41eec82015-11-20 12:39:23 +0000347include $(CLEAR_VARS)
Colin Cross97622642017-09-21 23:32:23 +0000348LOCAL_SRC_FILES := $(openjdk_java_files)
Piotr Jastrzebski51b1b692015-02-16 15:01:09 +0000349LOCAL_JAVA_RESOURCE_DIRS := $(core_resource_dirs)
Narayan Kamathf41eec82015-11-20 12:39:23 +0000350LOCAL_NO_STANDARD_LIBRARIES := true
351LOCAL_JAVACFLAGS := $(local_javac_flags)
Colin Cross96a55292016-12-21 16:42:56 -0800352LOCAL_DX_FLAGS := --core-library
Narayan Kamathf41eec82015-11-20 12:39:23 +0000353LOCAL_MODULE_TAGS := optional
354LOCAL_MODULE := core-oj-hostdex
Narayan Kamath558a2d12015-12-22 14:37:40 +0000355LOCAL_NOTICE_FILE := $(LOCAL_PATH)/ojluni/NOTICE
Piotr Jastrzebski51b1b692015-02-16 15:01:09 +0000356LOCAL_JAVA_LIBRARIES := core-all-hostdex
Neil Fuller085fbff2017-03-30 18:18:11 +0100357LOCAL_REQUIRED_MODULES := tzdata-host tzlookup.xml-host
Narayan Kamathf41eec82015-11-20 12:39:23 +0000358LOCAL_CORE_LIBRARY := true
Narayan Kamathf41eec82015-11-20 12:39:23 +0000359include $(BUILD_HOST_DALVIK_JAVA_LIBRARY)
360
Kenny Rootba07db52013-08-29 13:40:35 -0700361# Definitions to make the core library.
362include $(CLEAR_VARS)
Colin Cross97622642017-09-21 23:32:23 +0000363LOCAL_SRC_FILES := $(non_openjdk_java_files) $(android_icu4j_src_files)
Narayan Kamatha61daf42015-11-24 13:31:36 +0000364LOCAL_JAVA_RESOURCE_DIRS := $(android_icu4j_resource_dirs)
Brian Carlstromdc3c1522011-01-05 17:48:05 -0800365LOCAL_NO_STANDARD_LIBRARIES := true
Elliott Hughese983a0b2015-01-16 10:47:17 -0800366LOCAL_JAVACFLAGS := $(local_javac_flags)
Colin Cross96a55292016-12-21 16:42:56 -0800367LOCAL_DX_FLAGS := --core-library
Brian Carlstromdc3c1522011-01-05 17:48:05 -0800368LOCAL_MODULE_TAGS := optional
369LOCAL_MODULE := core-libart-hostdex
Piotr Jastrzebski51b1b692015-02-16 15:01:09 +0000370LOCAL_JAVA_LIBRARIES := core-oj-hostdex
Neil Fuller085fbff2017-03-30 18:18:11 +0100371LOCAL_REQUIRED_MODULES := tzdata-host tzlookup.xml-host
Brian Carlstromdc3c1522011-01-05 17:48:05 -0800372include $(BUILD_HOST_DALVIK_JAVA_LIBRARY)
373
Neil Fuller3375f982016-02-15 14:39:05 +0000374# A library that exists to satisfy javac when
375# compiling source code that contains lambdas.
376include $(CLEAR_VARS)
Colin Cross97622642017-09-21 23:32:23 +0000377LOCAL_SRC_FILES := $(openjdk_lambda_stub_files) $(openjdk_lambda_duplicate_stub_files)
Neil Fuller3375f982016-02-15 14:39:05 +0000378LOCAL_NO_STANDARD_LIBRARIES := true
379LOCAL_JAVACFLAGS := $(local_javac_flags)
Colin Cross96a55292016-12-21 16:42:56 -0800380LOCAL_DX_FLAGS := --core-library
Neil Fuller3375f982016-02-15 14:39:05 +0000381LOCAL_MODULE_TAGS := optional
Neil Fuller3375f982016-02-15 14:39:05 +0000382LOCAL_MODULE := core-lambda-stubs-hostdex
Neil Fuller3375f982016-02-15 14:39:05 +0000383LOCAL_JAVA_LIBRARIES := core-all-hostdex
384LOCAL_CORE_LIBRARY := true
385include $(BUILD_HOST_DALVIK_JAVA_LIBRARY)
386
Paul Duffinfe0ee8e2016-08-12 11:32:44 +0100387# Make the core-tests-hostdex library.
Brian Carlstromdc3c1522011-01-05 17:48:05 -0800388ifeq ($(LIBCORE_SKIP_TESTS),)
389 include $(CLEAR_VARS)
390 LOCAL_SRC_FILES := $(test_src_files)
391 LOCAL_JAVA_RESOURCE_DIRS := $(test_resource_dirs)
392 LOCAL_NO_STANDARD_LIBRARIES := true
Tobias Thiererd5e8f8c2016-12-22 12:25:26 +0000393 LOCAL_JAVA_LIBRARIES := \
394 bouncycastle-hostdex \
395 core-libart-hostdex \
396 core-oj-hostdex \
397 core-tests-support-hostdex \
398 junit-hostdex \
399 mockito-api-hostdex \
400 okhttp-hostdex
401 LOCAL_STATIC_JAVA_LIBRARIES := \
Neil Fullerf04b9af2017-05-24 11:48:12 +0100402 archive-patcher-hostdex \
Tobias Thiererd5e8f8c2016-12-22 12:25:26 +0000403 core-test-rules-hostdex \
Neil Fullerf04b9af2017-05-24 11:48:12 +0100404 junit-params-hostdex \
Tobias Thierer62db9f92016-11-28 12:24:32 +0000405 mockftpserver-hostdex \
Tobias Thiererd5e8f8c2016-12-22 12:25:26 +0000406 mockwebserver-host \
407 nist-pkix-tests-host \
Tobias Thierer62db9f92016-11-28 12:24:32 +0000408 slf4j-jdk14-hostdex \
Tobias Thiererd5e8f8c2016-12-22 12:25:26 +0000409 sqlite-jdbc-host \
Neil Fullerf04b9af2017-05-24 11:48:12 +0100410 tzdata-testing-hostdex
Brian Carlstromdc3c1522011-01-05 17:48:05 -0800411 LOCAL_JAVACFLAGS := $(local_javac_flags)
412 LOCAL_MODULE_TAGS := optional
413 LOCAL_MODULE := core-tests-hostdex
Brian Carlstromdc3c1522011-01-05 17:48:05 -0800414 include $(BUILD_HOST_DALVIK_JAVA_LIBRARY)
415endif
Elliott Hughesd6108342011-02-22 10:13:54 -0800416
Brian Carlstromdc3c1522011-01-05 17:48:05 -0800417# Make the core-tests-support library.
418ifeq ($(LIBCORE_SKIP_TESTS),)
419 include $(CLEAR_VARS)
420 LOCAL_SRC_FILES := $(call all-test-java-files-under,support)
421 LOCAL_JAVA_RESOURCE_DIRS := $(test_resource_dirs)
422 LOCAL_NO_STANDARD_LIBRARIES := true
Tobias Thiererd5e8f8c2016-12-22 12:25:26 +0000423 LOCAL_JAVA_LIBRARIES := \
424 bouncycastle-hostdex \
425 core-libart-hostdex \
426 core-oj-hostdex \
427 junit-hostdex
428 LOCAL_STATIC_JAVA_LIBRARIES := \
429 bouncycastle-bcpkix-hostdex \
430 bouncycastle-ocsp-hostdex
Brian Carlstromdc3c1522011-01-05 17:48:05 -0800431 LOCAL_JAVACFLAGS := $(local_javac_flags)
432 LOCAL_MODULE_TAGS := optional
433 LOCAL_MODULE := core-tests-support-hostdex
Brian Carlstromdc3c1522011-01-05 17:48:05 -0800434 include $(BUILD_HOST_DALVIK_JAVA_LIBRARY)
435endif
436
Igor Murashkin60370002016-04-04 11:53:53 -0700437# Make the core-ojtests-hostdex library.
Igor Murashkin4c65c012016-03-24 20:52:10 +0000438ifeq ($(LIBCORE_SKIP_TESTS),)
439 include $(CLEAR_VARS)
440 LOCAL_SRC_FILES := $(ojtest_src_files)
441 LOCAL_NO_STANDARD_LIBRARIES := true
Tobias Thiererd5e8f8c2016-12-22 12:25:26 +0000442 LOCAL_JAVA_LIBRARIES := \
443 bouncycastle-hostdex \
444 core-libart-hostdex \
445 core-oj-hostdex \
446 okhttp-hostdex
Igor Murashkin4c65c012016-03-24 20:52:10 +0000447 LOCAL_STATIC_JAVA_LIBRARIES := testng-hostdex
448 LOCAL_JAVACFLAGS := $(local_javac_flags)
Colin Crossabbd52b2017-02-24 15:39:22 -0800449 LOCAL_DX_FLAGS := --core-library
Igor Murashkin4c65c012016-03-24 20:52:10 +0000450 LOCAL_MODULE_TAGS := optional
Igor Murashkin4c65c012016-03-24 20:52:10 +0000451 LOCAL_MODULE := core-ojtests-hostdex
Igor Murashkin4c65c012016-03-24 20:52:10 +0000452 include $(BUILD_HOST_DALVIK_JAVA_LIBRARY)
453endif
454
Brian Carlstromdc3c1522011-01-05 17:48:05 -0800455endif # HOST_OS == linux
456
457#
Elliott Hughes92fc63e2013-02-07 17:05:57 -0800458# Local droiddoc for faster libcore testing
Brian Carlstromdc3c1522011-01-05 17:48:05 -0800459#
460#
Elliott Hughes92fc63e2013-02-07 17:05:57 -0800461# Run with:
Brian Carlstromdc3c1522011-01-05 17:48:05 -0800462# mm -j32 libcore-docs
463#
Elliott Hughes92fc63e2013-02-07 17:05:57 -0800464# Main output:
Brian Carlstromdc3c1522011-01-05 17:48:05 -0800465# ../out/target/common/docs/libcore/reference/packages.html
466#
Elliott Hughes92fc63e2013-02-07 17:05:57 -0800467# All text for proofreading (or running tools over):
Brian Carlstromdc3c1522011-01-05 17:48:05 -0800468# ../out/target/common/docs/libcore-proofread.txt
469#
Elliott Hughes92fc63e2013-02-07 17:05:57 -0800470# TODO list of missing javadoc, etc:
Brian Carlstromdc3c1522011-01-05 17:48:05 -0800471# ../out/target/common/docs/libcore-docs-todo.html
472#
473# Rerun:
474# rm -rf ../out/target/common/docs/libcore-timestamp && mm -j32 libcore-docs
475#
476include $(CLEAR_VARS)
Ying Wang21ac42d2013-12-04 15:54:36 -0800477
Brian Carlstromdc3c1522011-01-05 17:48:05 -0800478# for shared defintion of libcore_to_document
479include $(LOCAL_PATH)/Docs.mk
480
Neil Fuller42597382015-10-07 11:00:01 +0100481# The libcore_to_document paths are relative to $(TOPDIR). We are in libcore so we must prepend
482# ../ to make LOCAL_SRC_FILES relative to $(LOCAL_PATH).
483LOCAL_SRC_FILES := $(addprefix ../, $(libcore_to_document))
Brian Carlstromdc3c1522011-01-05 17:48:05 -0800484# rerun doc generation without recompiling the java
Brian Carlstromdc3c1522011-01-05 17:48:05 -0800485LOCAL_JAVACFLAGS := $(local_javac_flags)
486LOCAL_MODULE_CLASS:=JAVA_LIBRARIES
487
488LOCAL_MODULE := libcore
Dan Bornstein6ac43c22009-10-24 15:33:49 -0700489
Elliott Hughesb9863272012-11-08 14:28:29 -0800490LOCAL_DROIDDOC_OPTIONS := \
Dan Bornstein6ac43c22009-10-24 15:33:49 -0700491 -offlinemode \
492 -title "libcore" \
493 -proofread $(OUT_DOCS)/$(LOCAL_MODULE)-proofread.txt \
494 -todo ../$(LOCAL_MODULE)-docs-todo.html \
Neil Fuller7881b2c2016-10-14 16:26:46 +0100495 -knowntags ./libcore/known_oj_tags.txt \
Dan Bornstein6ac43c22009-10-24 15:33:49 -0700496 -hdf android.whichdoc offline
497
Scott Main75543092017-03-08 12:50:03 -0800498LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=external/doclava/res/assets/templates-sdk
Dan Bornstein6ac43c22009-10-24 15:33:49 -0700499
500include $(BUILD_DROIDDOC)
Colin Cross97622642017-09-21 23:32:23 +0000501
502openjdk_java_files :=
503non_openjdk_java_files :=