blob: 81fb460059277034c8af8243de4e37089d637438 [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
Jesse Wilson32cfe952010-05-04 16:36:03 -070040define all-test-java-files-under
Przemyslaw Szczepaniakebe4f192015-07-09 13:19:15 +010041$(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 -070042endef
43
Dan Bornstein6ac43c22009-10-24 15:33:49 -070044define all-core-resource-dirs
45$(shell cd $(LOCAL_PATH) && ls -d */src/$(1)/{java,resources} 2> /dev/null)
46endef
47
Jesse Wilsond5d35262010-05-12 23:56:14 -070048# The Java files and their associated resources.
Narayan Kamath29c564f2015-07-30 12:05:42 +010049core_resource_dirs := \
50 luni/src/main/java \
51 ojluni/src/main/resources/
Joachim Sauerac12c752017-01-30 18:47:15 +000052test_resource_dirs := $(filter-out ojluni/%,$(call all-core-resource-dirs,test))
Paul Duffinfe0ee8e2016-08-12 11:32:44 +010053test_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 +000054ojtest_src_files := $(call all-test-java-files-under,ojluni)
Joachim Sauerac12c752017-01-30 18:47:15 +000055ojtest_resource_dirs := $(filter ojluni/%,$(call all-core-resource-dirs,test))
Dan Bornstein6ac43c22009-10-24 15:33:49 -070056
Jesse Wilson7898a912010-09-13 15:42:41 -070057ifeq ($(EMMA_INSTRUMENT),true)
Ying Wangff053c32012-08-21 17:20:51 -070058ifneq ($(EMMA_INSTRUMENT_STATIC),true)
Piotr Jastrzebski51b1b692015-02-16 15:01:09 +000059 nojcore_src_files += $(call all-java-files-under, ../external/emma/core ../external/emma/pregenerated)
Jesse Wilson7898a912010-09-13 15:42:41 -070060 core_resource_dirs += ../external/emma/core/res ../external/emma/pregenerated/res
61endif
Ying Wangff053c32012-08-21 17:20:51 -070062endif
Jesse Wilson7898a912010-09-13 15:42:41 -070063
Elliott Hughes48d0b3f2010-12-14 09:48:52 -080064local_javac_flags=-encoding UTF-8
65#local_javac_flags+=-Xlint:all -Xlint:-serial,-deprecation,-unchecked
66local_javac_flags+=-Xmaxwarns 9999999
Dan Bornstein6ac43c22009-10-24 15:33:49 -070067
Narayan Kamath85952e22017-06-14 17:23:34 +010068# For user / userdebug builds, strip the local variable table and the local variable
69# type table. This has no bearing on stack traces, but will leave less information
70# available via JDWP.
71#
72# TODO: Should this be conditioned on a PRODUCT_ flag or should we just turn this
73# on for all builds. Also, name of the flag TBD.
74ifneq (,$(PRODUCT_MINIMIZE_JAVA_DEBUG_INFO))
75ifneq (,$(filter userdebug user,$(TARGET_BUILD_VARIANT)))
76local_javac_flags+= -g:source,lines
77local_jack_flags+= -D jack.dex.debug.vars=false -D jack.dex.debug.vars.synthetic=false
78endif
79endif
Narayan Kamath1a0f1842015-09-07 12:59:53 +010080
Dan Bornstein6ac43c22009-10-24 15:33:49 -070081#
Narayan Kamathf37f7812015-04-01 09:34:24 +010082# ICU4J related rules.
83#
Neil Fuller72802992015-10-05 15:39:53 +010084# We compile android_icu4j along with core-libart because we're implementing parts of core-libart
85# in terms of android_icu4j.
86android_icu4j_root := ../external/icu/android_icu4j/
Paul Duffina98463d2016-02-25 16:02:42 +000087android_icu4j_src_files := $(call all-java-files-under,$(android_icu4j_root)/src/main/java)
Neil Fuller72802992015-10-05 15:39:53 +010088android_icu4j_resource_dirs := $(android_icu4j_root)/resources
Narayan Kamathf37f7812015-04-01 09:34:24 +010089
90#
Colin Crossfb7218e2017-10-27 17:50:42 +000091# Build jaif-annotated source files for ojluni target .
92#
93ojluni_annotate_dir := $(call intermediates-dir-for,JAVA_LIBRARIES,core-oj,,COMMON)/annotated
94ojluni_annotate_target := $(ojluni_annotate_dir)/timestamp
95ojluni_annotate_jaif := $(LOCAL_PATH)/annotations/ojluni.jaif
96ojluni_annotate_input := $(annotated_ojluni_files)
97ojluni_annotate_output := $(patsubst $(LOCAL_PATH)/ojluni/src/main/java/%, $(ojluni_annotate_dir)/%, $(ojluni_annotate_input))
98
99$(ojluni_annotate_target): PRIVATE_ANNOTATE_TARGET := $(ojluni_annotate_target)
100$(ojluni_annotate_target): PRIVATE_ANNOTATE_DIR := $(ojluni_annotate_dir)
101$(ojluni_annotate_target): PRIVATE_ANNOTATE_JAIF := $(ojluni_annotate_jaif)
102$(ojluni_annotate_target): PRIVATE_ANNOTATE_INPUT := $(ojluni_annotate_input)
103$(ojluni_annotate_target): PRIVATE_ANNOTATE_GENERATE_CMD := $(LOCAL_PATH)/annotations/generate_annotated_java_files.py
104$(ojluni_annotate_target): PRIVATE_ANNOTATE_GENERATE_OUTPUT := $(LOCAL_PATH)/annotated_java_files.bp
105$(ojluni_annotate_target): PRIVATE_INSERT_ANNOTATIONS_TO_SOURCE := external/annotation-tools/annotation-file-utilities/scripts/insert-annotations-to-source
106
107# Diff output of _ojluni_annotate_generate_cmd with what we have, and if generate annotated source.
108$(ojluni_annotate_target): $(ojluni_annotate_input) $(ojluni_annotate_jaif)
109 rm -rf $(PRIVATE_ANNOTATE_DIR)
110 mkdir -p $(PRIVATE_ANNOTATE_DIR)
111 $(PRIVATE_ANNOTATE_GENERATE_CMD) $(PRIVATE_ANNOTATE_JAIF) > $(PRIVATE_ANNOTATE_DIR)/annotated_java_files.bp.tmp
112 diff -u $(PRIVATE_ANNOTATE_GENERATE_OUTPUT) $(PRIVATE_ANNOTATE_DIR)/annotated_java_files.bp.tmp || \
113 (echo -e "********************" >&2; \
114 echo -e "annotated_java_files.bp needs regenerating. Please run:" >&2; \
115 echo -e "libcore/annotations/generate_annotated_java_files.py libcore/annotations/ojluni.jaif > libcore/annotated_java_files.bp" >&2; \
116 echo -e "********************" >&2; exit 1)
117 rm $(PRIVATE_ANNOTATE_DIR)/annotated_java_files.bp.tmp
118 $(PRIVATE_INSERT_ANNOTATIONS_TO_SOURCE) -d $(PRIVATE_ANNOTATE_DIR) $(PRIVATE_ANNOTATE_JAIF) $(PRIVATE_ANNOTATE_INPUT)
119 touch $@
120$(ojluni_annotate_target): .KATI_IMPLICIT_OUTPUTS := $(ojluni_annotate_output)
121
122ojluni_annotate_dir:=
123ojluni_annotate_target:=
124ojluni_annotate_jaif:=
125ojluni_annotate_input:=
126ojluni_annotate_output:=
127
128#
Dan Bornstein6ac43c22009-10-24 15:33:49 -0700129# Build for the target (device).
130#
Kenny Root38375a42013-04-23 15:50:31 -0700131ifeq ($(LIBCORE_SKIP_TESTS),)
Shubham Ajmeracfcde6a2017-02-09 13:24:00 +0000132# Build a library just containing files from luni/src/test/filesystems for use in tests.
133include $(CLEAR_VARS)
134LOCAL_SRC_FILES := $(call all-java-files-under, luni/src/test/filesystems/src)
135LOCAL_JAVA_RESOURCE_DIRS := luni/src/test/filesystems/resources
136LOCAL_NO_STANDARD_LIBRARIES := true
137LOCAL_MODULE := filesystemstest
138LOCAL_JAVA_LIBRARIES := core-oj core-libart
139LOCAL_DEX_PREOPT := false
Andreas Gampe66b31732018-02-20 09:22:16 -0800140LOCAL_ERROR_PRONE_FLAGS := -Xep:MissingOverride:OFF
Shubham Ajmeracfcde6a2017-02-09 13:24:00 +0000141include $(BUILD_JAVA_LIBRARY)
Neil Fuller45400942017-11-24 19:56:15 +0000142
143filesystemstest_jar := $(intermediates)/$(LOCAL_MODULE).jar
144$(filesystemstest_jar): $(LOCAL_BUILT_MODULE)
Dan Willemsen6a6398f2017-03-20 10:47:51 -0700145 $(call copy-file-to-target)
Neil Fuller45400942017-11-24 19:56:15 +0000146
147# Build a library just containing files from luni/src/test/parameter_metadata for use in tests.
148include $(CLEAR_VARS)
149LOCAL_SRC_FILES := $(call all-java-files-under, luni/src/test/parameter_metadata/src)
150LOCAL_NO_STANDARD_LIBRARIES := true
151LOCAL_MODULE := parameter-metadata-test
152LOCAL_JAVA_LIBRARIES := core-oj core-libart
153LOCAL_DEX_PREOPT := false
154LOCAL_JAVACFLAGS := -parameters
Andreas Gampe66b31732018-02-20 09:22:16 -0800155LOCAL_ERROR_PRONE_FLAGS := -Xep:MissingOverride:OFF
Neil Fuller45400942017-11-24 19:56:15 +0000156include $(BUILD_JAVA_LIBRARY)
157
158parameter_metadata_test_jar := $(intermediates)/$(LOCAL_MODULE).jar
159$(parameter_metadata_test_jar): $(LOCAL_BUILT_MODULE)
160 $(call copy-file-to-target)
161
Shubham Ajmeracfcde6a2017-02-09 13:24:00 +0000162endif
163
164ifeq ($(LIBCORE_SKIP_TESTS),)
Kenny Root38375a42013-04-23 15:50:31 -0700165# Make the core-tests library.
166include $(CLEAR_VARS)
Narayan Kamath51525b52013-11-15 18:02:54 +0000167LOCAL_SRC_FILES := $(test_src_files)
Brian Carlstrom51ee38b2010-07-23 15:57:52 -0700168LOCAL_JAVA_RESOURCE_DIRS := $(test_resource_dirs)
Shubham Ajmeracfcde6a2017-02-09 13:24:00 +0000169# Include individual dex.jar files (jars containing resources and a classes.dex) so that they
170# be loaded by tests using ClassLoaders but are not in the main classes.dex.
Neil Fuller45400942017-11-24 19:56:15 +0000171LOCAL_JAVA_RESOURCE_FILES := $(filesystemstest_jar) $(parameter_metadata_test_jar)
Brian Carlstrom51ee38b2010-07-23 15:57:52 -0700172LOCAL_NO_STANDARD_LIBRARIES := true
Adam Vartaniance696362017-03-03 14:07:19 +0000173LOCAL_JAVA_LIBRARIES := core-oj core-libart okhttp bouncycastle
Paul Duffinfe0ee8e2016-08-12 11:32:44 +0100174LOCAL_STATIC_JAVA_LIBRARIES := \
Neil Fullerf04b9af2017-05-24 11:48:12 +0100175 archive-patcher \
Paul Duffinfe0ee8e2016-08-12 11:32:44 +0100176 core-test-rules \
177 core-tests-support \
Neil Fullerf04b9af2017-05-24 11:48:12 +0100178 junit-params \
Tobias Thierer62db9f92016-11-28 12:24:32 +0000179 mockftpserver \
Adam Vartaniance696362017-03-03 14:07:19 +0000180 mockito-target \
Paul Duffinfe0ee8e2016-08-12 11:32:44 +0100181 mockwebserver \
182 nist-pkix-tests \
Tobias Thierer62db9f92016-11-28 12:24:32 +0000183 slf4j-jdk14 \
Neil Fuller8e0c3492016-12-09 18:32:10 +0000184 sqlite-jdbc \
Neil Fullerf04b9af2017-05-24 11:48:12 +0100185 tzdata-testing
Elliott Hughesd6108342011-02-22 10:13:54 -0800186LOCAL_JAVACFLAGS := $(local_javac_flags)
Narayan Kamath85952e22017-06-14 17:23:34 +0100187LOCAL_JACK_FLAGS := $(local_jack_flags)
Andreas Gampe66b31732018-02-20 09:22:16 -0800188LOCAL_ERROR_PRONE_FLAGS := \
189 -Xep:TryFailThrowable:ERROR \
190 -Xep:ComparisonOutOfRange:ERROR \
191 -Xep:MissingOverride:OFF
Brian Carlstromb094af32010-05-28 17:37:37 -0700192LOCAL_MODULE := core-tests
Jesse Wilson706d5352010-06-08 17:20:09 -0700193include $(BUILD_STATIC_JAVA_LIBRARY)
Elliott Hughesc5cd6e82012-10-18 18:13:10 -0700194endif
Jesse Wilson706d5352010-06-08 17:20:09 -0700195
Igor Murashkinc8b2c562016-04-27 15:43:33 -0700196# Make the core-ojtests library.
197ifeq ($(LIBCORE_SKIP_TESTS),)
198 include $(CLEAR_VARS)
Joachim Sauerac12c752017-01-30 18:47:15 +0000199 LOCAL_JAVA_RESOURCE_DIRS := $(ojtest_resource_dirs)
Igor Murashkinc8b2c562016-04-27 15:43:33 -0700200 LOCAL_NO_STANDARD_LIBRARIES := true
Narayan Kamathd097a9b2016-09-22 17:07:15 +0100201 LOCAL_JAVA_LIBRARIES := core-oj core-libart okhttp bouncycastle
Igor Murashkinc8b2c562016-04-27 15:43:33 -0700202 LOCAL_STATIC_JAVA_LIBRARIES := testng
203 LOCAL_JAVACFLAGS := $(local_javac_flags)
Narayan Kamath85952e22017-06-14 17:23:34 +0100204 LOCAL_JACK_FLAGS := $(local_jack_flags)
Colin Cross96a55292016-12-21 16:42:56 -0800205 LOCAL_DX_FLAGS := --core-library
Igor Murashkinc8b2c562016-04-27 15:43:33 -0700206 LOCAL_MODULE_TAGS := optional
Igor Murashkinc8b2c562016-04-27 15:43:33 -0700207 LOCAL_MODULE := core-ojtests
Igor Murashkinc8b2c562016-04-27 15:43:33 -0700208 # 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
209 LOCAL_DEX_PREOPT := false # disable AOT preverification which breaks the build. it will still throw VerifyError at runtime.
Andreas Gampe66b31732018-02-20 09:22:16 -0800210 LOCAL_ERROR_PRONE_FLAGS := -Xep:MissingOverride:OFF
Igor Murashkinc8b2c562016-04-27 15:43:33 -0700211 include $(BUILD_JAVA_LIBRARY)
212endif
213
214# Make the core-ojtests-public library. Excludes any private API tests.
215ifeq ($(LIBCORE_SKIP_TESTS),)
216 include $(CLEAR_VARS)
Tobias Thiererd042dbe2018-01-09 20:23:03 +0000217 # Filter out the following:
218 # 1.) DeserializeMethodTest and SerializedLambdaTest, because they depends on stub classes
219 # and won't actually run, and
220 # 2.) util/stream/boot*. Those directories contain classes in the package java.util.stream;
221 # excluding them means we don't need LOCAL_PATCH_MODULE := java.base
222 LOCAL_SRC_FILES := $(filter-out %/DeserializeMethodTest.java %/SerializedLambdaTest.java ojluni/src/test/java/util/stream/boot%,$(ojtest_src_files))
Igor Murashkinc8b2c562016-04-27 15:43:33 -0700223 # Include source code as part of JAR
Joachim Sauerac12c752017-01-30 18:47:15 +0000224 LOCAL_JAVA_RESOURCE_DIRS := ojluni/src/test/dist $(ojtest_resource_dirs)
Igor Murashkinc8b2c562016-04-27 15:43:33 -0700225 LOCAL_NO_STANDARD_LIBRARIES := true
Tobias Thiererd5e8f8c2016-12-22 12:25:26 +0000226 LOCAL_JAVA_LIBRARIES := \
227 bouncycastle \
228 core-libart \
229 core-oj \
230 okhttp \
231 testng
Igor Murashkinc8b2c562016-04-27 15:43:33 -0700232 LOCAL_JAVACFLAGS := $(local_javac_flags)
Narayan Kamath85952e22017-06-14 17:23:34 +0100233 LOCAL_JACK_FLAGS := $(local_jack_flags)
Colin Cross96a55292016-12-21 16:42:56 -0800234 LOCAL_DX_FLAGS := --core-library
Igor Murashkinc8b2c562016-04-27 15:43:33 -0700235 LOCAL_MODULE_TAGS := optional
Igor Murashkinc8b2c562016-04-27 15:43:33 -0700236 LOCAL_MODULE := core-ojtests-public
Igor Murashkinc8b2c562016-04-27 15:43:33 -0700237 # 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
238 LOCAL_DEX_PREOPT := false # disable AOT preverification which breaks the build. it will still throw VerifyError at runtime.
Andreas Gampe66b31732018-02-20 09:22:16 -0800239 LOCAL_ERROR_PRONE_FLAGS := -Xep:MissingOverride:OFF
Igor Murashkinc8b2c562016-04-27 15:43:33 -0700240 include $(BUILD_JAVA_LIBRARY)
241endif
242
Dan Bornstein6ac43c22009-10-24 15:33:49 -0700243#
244# Build for the host.
245#
246
Elliott Hughese983a0b2015-01-16 10:47:17 -0800247ifeq ($(HOST_OS),linux)
248
Paul Duffinfe0ee8e2016-08-12 11:32:44 +0100249# Make the core-tests-hostdex library.
Ian Rogers3deabd22014-05-23 15:12:42 -0700250ifeq ($(LIBCORE_SKIP_TESTS),)
Brian Carlstromd39b1d62011-03-06 23:15:39 -0800251 include $(CLEAR_VARS)
Narayan Kamath51525b52013-11-15 18:02:54 +0000252 LOCAL_SRC_FILES := $(test_src_files)
Brian Carlstromd39b1d62011-03-06 23:15:39 -0800253 LOCAL_JAVA_RESOURCE_DIRS := $(test_resource_dirs)
Neil Fuller9496b212014-09-04 11:11:56 +0100254 LOCAL_NO_STANDARD_LIBRARIES := true
Tobias Thiererd5e8f8c2016-12-22 12:25:26 +0000255 LOCAL_JAVA_LIBRARIES := \
256 bouncycastle-hostdex \
257 core-libart-hostdex \
258 core-oj-hostdex \
259 core-tests-support-hostdex \
260 junit-hostdex \
261 mockito-api-hostdex \
262 okhttp-hostdex
263 LOCAL_STATIC_JAVA_LIBRARIES := \
Neil Fullerf04b9af2017-05-24 11:48:12 +0100264 archive-patcher-hostdex \
Tobias Thiererd5e8f8c2016-12-22 12:25:26 +0000265 core-test-rules-hostdex \
Neil Fullerf04b9af2017-05-24 11:48:12 +0100266 junit-params-hostdex \
Tobias Thierer62db9f92016-11-28 12:24:32 +0000267 mockftpserver-hostdex \
Tobias Thiererd5e8f8c2016-12-22 12:25:26 +0000268 mockwebserver-host \
269 nist-pkix-tests-host \
Tobias Thierer62db9f92016-11-28 12:24:32 +0000270 slf4j-jdk14-hostdex \
Tobias Thiererd5e8f8c2016-12-22 12:25:26 +0000271 sqlite-jdbc-host \
Neil Fullerf04b9af2017-05-24 11:48:12 +0100272 tzdata-testing-hostdex
Brian Carlstromd39b1d62011-03-06 23:15:39 -0800273 LOCAL_JAVACFLAGS := $(local_javac_flags)
Ying Wange79ac582012-08-23 11:25:27 -0700274 LOCAL_MODULE_TAGS := optional
Brian Carlstromd39b1d62011-03-06 23:15:39 -0800275 LOCAL_MODULE := core-tests-hostdex
Andreas Gampe66b31732018-02-20 09:22:16 -0800276 LOCAL_ERROR_PRONE_FLAGS := -Xep:MissingOverride:OFF
Narayan Kamath70e8ce82013-10-28 14:17:35 +0000277 include $(BUILD_HOST_DALVIK_JAVA_LIBRARY)
Ian Rogers3deabd22014-05-23 15:12:42 -0700278endif
Kenny Rootba07db52013-08-29 13:40:35 -0700279
Igor Murashkin60370002016-04-04 11:53:53 -0700280# Make the core-ojtests-hostdex library.
Igor Murashkin4c65c012016-03-24 20:52:10 +0000281ifeq ($(LIBCORE_SKIP_TESTS),)
282 include $(CLEAR_VARS)
283 LOCAL_SRC_FILES := $(ojtest_src_files)
284 LOCAL_NO_STANDARD_LIBRARIES := true
Tobias Thiererd5e8f8c2016-12-22 12:25:26 +0000285 LOCAL_JAVA_LIBRARIES := \
286 bouncycastle-hostdex \
287 core-libart-hostdex \
288 core-oj-hostdex \
289 okhttp-hostdex
Igor Murashkin4c65c012016-03-24 20:52:10 +0000290 LOCAL_STATIC_JAVA_LIBRARIES := testng-hostdex
291 LOCAL_JAVACFLAGS := $(local_javac_flags)
Colin Crossabbd52b2017-02-24 15:39:22 -0800292 LOCAL_DX_FLAGS := --core-library
Igor Murashkin4c65c012016-03-24 20:52:10 +0000293 LOCAL_MODULE_TAGS := optional
Igor Murashkin4c65c012016-03-24 20:52:10 +0000294 LOCAL_MODULE := core-ojtests-hostdex
Tobias Thiererd042dbe2018-01-09 20:23:03 +0000295 # ojluni/src/test/java/util/stream/{bootlib,boottest}
296 # contains tests that are in packages from java.base;
297 # By default, OpenJDK 9's javac will only compile such
298 # code if it's declared to also be in java.base at
299 # compile time.
300 #
301 # For now, we use --patch-module to put all sources
302 # and dependencies from this make target into java.base;
303 # other source directories in this make target are in
304 # packages not from java.base; if this becomes a proble
305 # in future, this could be addressed eg. by splitting
306 # boot{lib,test} out into a separate make target,
307 # deleting those tests or moving them to a different
308 # package.
309 LOCAL_PATCH_MODULE := java.base
Andreas Gampe66b31732018-02-20 09:22:16 -0800310 LOCAL_ERROR_PRONE_FLAGS := -Xep:MissingOverride:OFF
Igor Murashkin4c65c012016-03-24 20:52:10 +0000311 include $(BUILD_HOST_DALVIK_JAVA_LIBRARY)
312endif
313
Elliott Hughese983a0b2015-01-16 10:47:17 -0800314endif # HOST_OS == linux
315
Brian Carlstromdc3c1522011-01-05 17:48:05 -0800316#
317# Local droiddoc for faster libcore testing
318#
319#
320# Run with:
Elliott Hughes92fc63e2013-02-07 17:05:57 -0800321# mm -j32 libcore-docs
Brian Carlstromdc3c1522011-01-05 17:48:05 -0800322#
323# Main output:
Elliott Hughes92fc63e2013-02-07 17:05:57 -0800324# ../out/target/common/docs/libcore/reference/packages.html
Brian Carlstromdc3c1522011-01-05 17:48:05 -0800325#
326# All text for proofreading (or running tools over):
Elliott Hughes92fc63e2013-02-07 17:05:57 -0800327# ../out/target/common/docs/libcore-proofread.txt
Brian Carlstromdc3c1522011-01-05 17:48:05 -0800328#
329# TODO list of missing javadoc, etc:
Elliott Hughes92fc63e2013-02-07 17:05:57 -0800330# ../out/target/common/docs/libcore-docs-todo.html
Brian Carlstromdc3c1522011-01-05 17:48:05 -0800331#
332# Rerun:
Elliott Hughes92fc63e2013-02-07 17:05:57 -0800333# rm -rf ../out/target/common/docs/libcore-timestamp && mm -j32 libcore-docs
Brian Carlstromdc3c1522011-01-05 17:48:05 -0800334#
335include $(CLEAR_VARS)
336
337# for shared defintion of libcore_to_document
338include $(LOCAL_PATH)/Docs.mk
339
Neil Fuller42597382015-10-07 11:00:01 +0100340# The libcore_to_document paths are relative to $(TOPDIR). We are in libcore so we must prepend
341# ../ to make LOCAL_SRC_FILES relative to $(LOCAL_PATH).
342LOCAL_SRC_FILES := $(addprefix ../, $(libcore_to_document))
Colin Crossfb7218e2017-10-27 17:50:42 +0000343LOCAL_INTERMEDIATE_SOURCES := \
344 $(patsubst $(TARGET_OUT_COMMON_INTERMEDIATES)/%,%,$(libcore_to_document_generated))
345LOCAL_ADDITIONAL_DEPENDENCIES := $(libcore_to_document_generated)
Brian Carlstromdc3c1522011-01-05 17:48:05 -0800346# rerun doc generation without recompiling the java
Elliott Hughesd6108342011-02-22 10:13:54 -0800347LOCAL_JAVACFLAGS := $(local_javac_flags)
Brian Carlstromdc3c1522011-01-05 17:48:05 -0800348LOCAL_MODULE_CLASS:=JAVA_LIBRARIES
349
350LOCAL_MODULE := libcore
351
Elliott Hughesb9863272012-11-08 14:28:29 -0800352LOCAL_DROIDDOC_OPTIONS := \
Brian Carlstromdc3c1522011-01-05 17:48:05 -0800353 -offlinemode \
354 -title "libcore" \
355 -proofread $(OUT_DOCS)/$(LOCAL_MODULE)-proofread.txt \
356 -todo ../$(LOCAL_MODULE)-docs-todo.html \
Neil Fuller7881b2c2016-10-14 16:26:46 +0100357 -knowntags ./libcore/known_oj_tags.txt \
Brian Carlstromdc3c1522011-01-05 17:48:05 -0800358 -hdf android.whichdoc offline
359
Scott Main75543092017-03-08 12:50:03 -0800360LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=external/doclava/res/assets/templates-sdk
Brian Carlstromdc3c1522011-01-05 17:48:05 -0800361
362include $(BUILD_DROIDDOC)
Paul Duffin4321db42018-01-23 11:43:48 +0000363
364# For unbundled build we'll use the prebuilt jar from prebuilts/sdk.
365ifeq (,$(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)))
366
367# Generate the stub source files for core.current.stubs
368# =====================================================
369include $(CLEAR_VARS)
370
371LOCAL_SRC_FILES := $(addprefix ../, $(libcore_to_document))
372LOCAL_GENERATED_SOURCES := $(libcore_to_document_generated)
373
374LOCAL_MODULE_CLASS := JAVA_LIBRARIES
375
376LOCAL_DROIDDOC_OPTIONS:= \
377 -stubs $(TARGET_OUT_COMMON_INTERMEDIATES)/JAVA_LIBRARIES/core.current.stubs_intermediates/src \
378 -nodocs \
379
380LOCAL_UNINSTALLABLE_MODULE := true
Jiyong Parkcd0d0362018-02-14 21:18:49 +0900381LOCAL_NO_STANDARD_LIBRARIES := true
Paul Duffin4321db42018-01-23 11:43:48 +0000382LOCAL_MODULE := core-current-stubs-gen
383
384include $(BUILD_DROIDDOC)
385
386# Remember the target that will trigger the code generation.
387core_current_gen_stamp := $(full_target)
388
389# Build the core.current.stubs library
390# ====================================
391include $(CLEAR_VARS)
392
393LOCAL_MODULE := core.current.stubs
394
395LOCAL_SOURCE_FILES_ALL_GENERATED := true
396
397# Make sure to run droiddoc first to generate the stub source files.
398LOCAL_ADDITIONAL_DEPENDENCIES := $(core_current_gen_stamp)
399core_current_gen_stamp :=
400
Tobias Thierer492c64a2018-02-06 15:12:39 +0000401# Because javac refuses to compile these stubs with --system=none, ( http://b/72206056#comment31 ),
402# just patch them into java.base at compile time.
403LOCAL_PATCH_MODULE := java.base
Paul Duffin4321db42018-01-23 11:43:48 +0000404LOCAL_NO_STANDARD_LIBRARIES := true
Andreas Gampe66b31732018-02-20 09:22:16 -0800405LOCAL_ERROR_PRONE_FLAGS := -Xep:MissingOverride:OFF
Paul Duffin4321db42018-01-23 11:43:48 +0000406include $(BUILD_STATIC_JAVA_LIBRARY)
407
408# Archive a copy of the classes.jar in SDK build.
409$(call dist-for-goals,sdk win_sdk,$(full_classes_jar):core.current.stubs.jar)
410
411endif # not TARGET_BUILD_APPS not TARGET_BUILD_PDK=true