blob: 0931bcf56b4041a89e77f30b11bffe13f6ad3921 [file] [log] [blame]
Colin Crossaf0b54c2017-09-27 17:22:32 -07001// Copyright (C) 2007 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//
Neil Fuller77e3f3b2018-10-19 10:22:32 +010016// Definitions for building the Android core library and associated tests.
Colin Crossaf0b54c2017-09-27 17:22:32 -070017//
18
Neil Fuller77e3f3b2018-10-19 10:22:32 +010019// The Android core library provides low-level APIs for use by the rest of the
20// Android software stack. It is made up of various parts, some of which can be
21// found in libcore/ and other parts that can be found in various external/
Paul Duffinfb46f732019-09-25 16:04:21 +010022// directories.
23//
Neil Fullercf756882018-08-28 18:42:22 +010024// libcore has some sub-directories that follow a common structure:
25// e.g. dalvik, dom, harmony-tests, json, jsr166-tests, luni, libart, ojluni,
26// support, xml, xmlpull.
Colin Crossaf0b54c2017-09-27 17:22:32 -070027//
Neil Fullercf756882018-08-28 18:42:22 +010028// The structure of these is generally:
Colin Crossaf0b54c2017-09-27 17:22:32 -070029//
30// src/
31// main/ # To be shipped on every device.
32// java/ # Java source for library code.
Neil Fullercf756882018-08-28 18:42:22 +010033// native/ # C/C++ source for library code.
Colin Crossaf0b54c2017-09-27 17:22:32 -070034// resources/ # Support files.
35// test/ # Built only on demand, for testing.
36// java/ # Java source for tests.
Neil Fullercf756882018-08-28 18:42:22 +010037// native/ # C/C++ source for tests (rare).
Colin Crossaf0b54c2017-09-27 17:22:32 -070038// resources/ # Support files.
39//
Neil Fullercf756882018-08-28 18:42:22 +010040// All subdirectories are optional.
Colin Crossaf0b54c2017-09-27 17:22:32 -070041
42build = [
43 "openjdk_java_files.bp",
44 "non_openjdk_java_files.bp",
45]
46
47// The Java files and their associated resources.
Tobias Thierer79eea262019-08-01 14:05:11 +010048filegroup {
49 name: "core-luni-resources",
50 visibility: [
51 "//libcore:__subpackages__",
52 ],
53 path: "luni/src/main/java/",
54 srcs: [
Tobias Thierer79eea262019-08-01 14:05:11 +010055 "luni/src/main/java/java/util/logging/logging.properties",
56 "luni/src/main/java/java/security/security.properties",
57 ],
58}
59
60filegroup {
61 name: "core-ojluni-resources",
62 visibility: [
63 "//libcore:__subpackages__",
64 ],
65 path: "ojluni/src/main/resources/",
66 srcs: [
67 "ojluni/src/main/resources/**/*",
68 ],
69}
70
71core_resources = [
72 ":core-luni-resources",
73 ":core-ojluni-resources",
Colin Crossaf0b54c2017-09-27 17:22:32 -070074]
75
Neil Fuller866ed4a2018-09-06 12:05:46 +010076// The source files that go into core-oj.
77filegroup {
78 name: "core_oj_java_files",
Paul Duffinc241d6a2019-06-25 15:40:29 +010079 visibility: [
80 "//libcore:__subpackages__",
81 ],
Neil Fuller866ed4a2018-09-06 12:05:46 +010082 srcs: [":openjdk_java_files"],
83}
84
Neil Fullere32e2e12019-02-26 11:48:30 +000085// OpenJDK source is not annotated with @hide so we need this separate
Neil Fuller866ed4a2018-09-06 12:05:46 +010086// filegroup for just the parts that contribute to the API.
87filegroup {
88 name: "core_oj_api_files",
89 srcs: [":openjdk_javadoc_files"],
90}
91
92// The source files that go into core-libart.
93filegroup {
94 name: "core_libart_java_files",
Paul Duffinc241d6a2019-06-25 15:40:29 +010095 visibility: [
96 "//libcore:__subpackages__",
97 ],
Neil Fuller866ed4a2018-09-06 12:05:46 +010098 srcs: [
99 ":non_openjdk_java_files",
Neil Fuller866ed4a2018-09-06 12:05:46 +0100100 ],
101}
102
Neil Fullere32e2e12019-02-26 11:48:30 +0000103// Some parts of libart are not annotated with @hide so we need this separate
Neil Fuller866ed4a2018-09-06 12:05:46 +0100104// filegroup for just the parts that contribute to the API.
105filegroup {
106 name: "core_libart_api_files",
107 srcs: [
108 ":non_openjdk_javadoc_files",
Neil Fuller866ed4a2018-09-06 12:05:46 +0100109 ],
110}
111
Neil Fullere32e2e12019-02-26 11:48:30 +0000112// The set of files for the core library that have been marked up with @hide
113// for the public SDK APIs. Used from frameworks/base/ to indicate the source
114// files for inclusion in the public SDK docs.
115filegroup {
116 name: "core_public_api_files",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100117 visibility: [
118 "//frameworks/base",
119 ],
Neil Fullere32e2e12019-02-26 11:48:30 +0000120 srcs: [
Victor Changcad47af2019-08-06 16:33:38 +0100121 ":android_icu4j_src_files",
Neil Fullere32e2e12019-02-26 11:48:30 +0000122 ":core_oj_api_files",
123 ":core_libart_api_files",
124 ":conscrypt_public_api_files",
125 ],
126}
127
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100128// The set of files for the core library that have been marked up with @hide and
129// API-related annotations. Note that this includes the intra-core and
130// core-platform APIs as well as the public APIs.
131//
Neil Fullere32e2e12019-02-26 11:48:30 +0000132// Some source files in :core_oj_api_files and :openjdk_mmodule_extra_files are
133// annotated by applying annotations to the .annotated.java stubs files in
134// ojluni/annotated/mmodules and rather than in the original source. See the comments
135// in openjdk_java_files.bp for more details.
Neil Fuller866ed4a2018-09-06 12:05:46 +0100136filegroup {
137 name: "core_api_files",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100138 visibility: [
139 "//libcore:__subpackages__",
140 ],
Neil Fuller866ed4a2018-09-06 12:05:46 +0100141 srcs: [
Victor Changcad47af2019-08-06 16:33:38 +0100142 ":android_icu4j_src_files",
Neil Fullerd129bc92018-09-26 11:12:58 +0100143 ":apache-xml_api_files",
Neil Fullera77f7102018-09-21 19:04:41 +0100144 ":bouncycastle_java_files",
Neil Fuller603e1a72018-09-25 11:55:41 +0100145 ":conscrypt_java_files",
Neil Fuller866ed4a2018-09-06 12:05:46 +0100146 ":core_oj_api_files",
147 ":core_libart_api_files",
Neil Fuller641d5f92018-09-24 15:40:39 +0100148 ":okhttp_api_files",
Pete Gillinc9935b62018-09-25 14:42:40 +0100149 ":openjdk_mmodule_extra_files",
Neil Fuller866ed4a2018-09-06 12:05:46 +0100150 ],
151}
152
Colin Crossaf0b54c2017-09-27 17:22:32 -0700153java_defaults {
154 name: "libcore_java_defaults",
155 javacflags: [
156 //"-Xlint:all",
157 //"-Xlint:-serial,-deprecation,-unchecked",
158 ],
159 dxflags: ["--core-library"],
Andreas Gampe66b31732018-02-20 09:22:16 -0800160 errorprone: {
161 javacflags: [
Paul Duffinc31f6bb2019-05-15 12:32:44 +0100162 "-Xep:MissingOverride:OFF", // Ignore missing @Override.
163 "-Xep:ConstantOverflow:WARN", // Known constant overflow in SplittableRandom
Andreas Gampe66b31732018-02-20 09:22:16 -0800164 ],
165 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700166}
167
168//
169// Build for the target (device).
170//
171
Tobias Thierercf66bfd2019-05-29 13:18:25 +0100172// Visibility of core-all* build modules; we restrict visibility of core-all deliberately to
173// a small set of build modules that the core library team control. See core-all-system-modules
174// for more details.
175core_all_visibility = [
176 "//external/apache-harmony:__subpackages__",
177 "//external/apache-xml",
178 "//external/bouncycastle",
179 "//external/conscrypt",
180 "//external/icu/android_icu4j",
181 "//external/okhttp",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100182 "//libcore:__subpackages__",
Tobias Thierercf66bfd2019-05-29 13:18:25 +0100183]
184
Tobias Thierer52331642019-05-29 12:11:39 +0000185// A target used to bootstrap compilation for the core library.
186// See core-all-system-modules for more details.
187java_library {
188 name: "core-all",
Tobias Thierercf66bfd2019-05-29 13:18:25 +0100189 visibility: core_all_visibility,
Tobias Thierer52331642019-05-29 12:11:39 +0000190 defaults: ["libcore_java_defaults"],
Colin Crossaf0b54c2017-09-27 17:22:32 -0700191
192 srcs: [
Victor Changcad47af2019-08-06 16:33:38 +0100193 ":android_icu4j_src_files",
Neil Fuller866ed4a2018-09-06 12:05:46 +0100194 ":core_oj_java_files",
195 ":core_libart_java_files",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700196 ":openjdk_lambda_stub_files",
Pete Gillin54035812019-05-08 15:09:39 +0100197 ":openjdk_generated_annotation_stub_files",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700198 ],
Colin Crossec80f4f2018-08-15 21:17:11 -0700199
Paul Duffin83c25382019-06-07 14:10:49 +0100200 sdk_version: "none",
Colin Crossec80f4f2018-08-15 21:17:11 -0700201 system_modules: "none",
Colin Crossa4d9fc42017-09-29 18:04:37 -0700202 openjdk9: {
203 srcs: ["luni/src/module/java/module-info.java"],
204 javacflags: ["--patch-module=java.base=."],
205 },
Colin Crossec80f4f2018-08-15 21:17:11 -0700206
Tobias Thierer79eea262019-08-01 14:05:11 +0100207 java_resources: core_resources,
Victor Chang7fef4052018-09-25 14:12:03 +0100208 static_libs: ["android_icu4j_resources_lib"],
Tobias Thiererde991232018-03-07 15:10:46 +0000209 java_version: "1.9",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700210
Colin Crossaf0b54c2017-09-27 17:22:32 -0700211 installable: false,
atrost98ec08d2019-08-05 12:23:41 +0100212
213 plugins: ["compat-changeid-annotation-processor"],
214}
215
216platform_compat_config {
217 name: "libcore-platform-compat-config",
atrost98ec08d2019-08-05 12:23:41 +0100218 src: ":core-all",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700219}
220
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100221// A system modules definition for use by core library targets only. It only
222// contains the core-all jar, which contains the classes that end up in core-oj,
223// core-libart as well as the lambda stubs needed to compile Java lambda code.
224// It does not contain other parts of core library like conscrypt, bouncycastle,
225// etc. This system_modules definition is used to bootstrap compilation for
Paul Duffin00b174e2019-09-26 16:22:17 +0100226// other parts of the core library like core-oj, core-libart, conscrypt,
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100227// bouncycastle, etc.
Colin Crossa4d9fc42017-09-29 18:04:37 -0700228java_system_modules {
229 name: "core-all-system-modules",
Tobias Thierercf66bfd2019-05-29 13:18:25 +0100230 visibility: core_all_visibility,
Colin Crossa4d9fc42017-09-29 18:04:37 -0700231 libs: ["core-all"],
232}
233
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100234// Contains the parts of core library associated with OpenJDK.
Colin Crossaf0b54c2017-09-27 17:22:32 -0700235java_library {
236 name: "core-oj",
Paul Duffin48ac7b62019-03-28 14:28:06 +0000237 visibility: [
238 "//art/build/apex",
239 "//external/wycheproof",
Paul Duffin94f70232019-05-22 16:22:29 +0100240 "//libcore/benchmarks",
Paul Duffin48ac7b62019-03-28 14:28:06 +0000241 ],
Colin Crossaf0b54c2017-09-27 17:22:32 -0700242 defaults: ["libcore_java_defaults"],
Colin Cross5b75cdd2018-06-27 11:00:13 -0700243 installable: true,
Colin Crossbb180be2017-10-09 14:54:53 -0700244 hostdex: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700245
Neil Fuller866ed4a2018-09-06 12:05:46 +0100246 srcs: [":core_oj_java_files"],
Tobias Thierer79eea262019-08-01 14:05:11 +0100247 java_resources: core_resources,
Colin Crossec80f4f2018-08-15 21:17:11 -0700248
Paul Duffin83c25382019-06-07 14:10:49 +0100249 sdk_version: "none",
Colin Crossa4d9fc42017-09-29 18:04:37 -0700250 system_modules: "core-all-system-modules",
251 openjdk9: {
252 javacflags: ["--patch-module=java.base=."],
253 },
Colin Crossec80f4f2018-08-15 21:17:11 -0700254
Pete Gillin7a7a6d22017-12-19 14:56:03 +0000255 jacoco: {
Pete Gillin27ca0582018-01-10 17:04:17 +0000256 exclude_filter: [
Pete Gillin3f59bad2018-01-30 11:20:29 +0000257 "java.lang.Class",
258 "java.lang.Long",
259 "java.lang.Number",
260 "java.lang.Object",
261 "java.lang.String",
262 "java.lang.invoke.MethodHandle",
263 "java.lang.ref.Reference",
264 "java.lang.reflect.Proxy",
Pete Gillinb1868ada2018-01-17 11:03:10 +0000265 "java.util.AbstractMap",
Pete Gillin3f59bad2018-01-30 11:20:29 +0000266 "java.util.HashMap",
267 "java.util.HashMap$Node",
Pete Gillinb1868ada2018-01-17 11:03:10 +0000268 "java.util.Map",
Pete Gillin7a7a6d22017-12-19 14:56:03 +0000269 ],
270 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700271
272 notice: "ojluni/NOTICE",
273
Colin Crossaf0b54c2017-09-27 17:22:32 -0700274}
275
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100276// Contains parts of core library not associated with OpenJDK. Contains not
Victor Changcad47af2019-08-06 16:33:38 +0100277// just java.*, javax.* code but also android.system.* and various internal
278// libcore.* packages.
Colin Crossaf0b54c2017-09-27 17:22:32 -0700279java_library {
280 name: "core-libart",
Paul Duffin48ac7b62019-03-28 14:28:06 +0000281 visibility: [
282 "//art/build/apex",
283 "//external/robolectric-shadows",
284 "//external/wycheproof",
Paul Duffin94f70232019-05-22 16:22:29 +0100285 "//libcore/benchmarks",
Colin Crossf0ef6252019-05-31 08:26:47 -0700286 "//frameworks/layoutlib",
Paul Duffin48ac7b62019-03-28 14:28:06 +0000287 ],
Colin Crossaf0b54c2017-09-27 17:22:32 -0700288 defaults: ["libcore_java_defaults"],
Colin Cross5b75cdd2018-06-27 11:00:13 -0700289 installable: true,
Colin Crossbb180be2017-10-09 14:54:53 -0700290 hostdex: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700291
Neil Fuller866ed4a2018-09-06 12:05:46 +0100292 srcs: [":core_libart_java_files"],
Tobias Thiererde991232018-03-07 15:10:46 +0000293 java_version: "1.9",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700294
Paul Duffin83c25382019-06-07 14:10:49 +0100295 sdk_version: "none",
Colin Crossa4d9fc42017-09-29 18:04:37 -0700296 system_modules: "core-all-system-modules",
297 openjdk9: {
298 javacflags: ["--patch-module=java.base=."],
299 },
Colin Crossec80f4f2018-08-15 21:17:11 -0700300
Pete Gillin80ebe872018-02-13 15:21:20 +0000301 jacoco: {
302 exclude_filter: [
303 "java.lang.DexCache",
304 "dalvik.system.ClassExt",
305 ],
306 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700307
Andreas Gampe9a1ba892019-04-24 12:35:40 -0700308 target: {
309 hostdex: {
310 required: [
Neil Fuller53c5f032019-06-05 13:47:39 +0100311 // Files used to simulate the /system, runtime APEX and tzdata
312 // APEX dir structure on host.
313 "icu_tzdata.dat_host_tzdata_apex",
Andreas Gampe9a1ba892019-04-24 12:35:40 -0700314 "tzdata_host",
Neil Fuller53c5f032019-06-05 13:47:39 +0100315 "tzdata_host_tzdata_apex",
Neil Fuller53c5f032019-06-05 13:47:39 +0100316 "tzlookup.xml_host_tzdata_apex",
Andreas Gampe9a1ba892019-04-24 12:35:40 -0700317 "tz_version_host",
Neil Fuller53c5f032019-06-05 13:47:39 +0100318 "tz_version_host_tzdata_apex",
Andreas Gampe9a1ba892019-04-24 12:35:40 -0700319 ],
320 },
321 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700322}
323
Paul Duffin7bb8d232018-10-23 11:48:38 +0100324// Provided solely to contribute information about which hidden parts of the
325// core-oj API are used by apps.
Paul Duffinc6bf27b2019-05-15 14:41:00 +0100326//
327// The build system determines that this library provides hiddenapi information
328// for the core-oj bootjar because its name is of the form <x>-hiddenapi, where
329// <x> is the name of a boot jar. That triggers the generation of a flags.csv
330// file which encapsulates information extracted from the UnsupportedAppUsage
331// annotations in the dex. The information from that file is then encoded into
332// the core-oj file.
333//
334// Usually, e.g. for core-libart, the UnsupportedAppUsage annotations are
335// added to the source that is compiled directly into the bootjar and the build
336// system extracts the information about UnsupportedAppUsage directly from
337// there.
338//
339// This approach of having separate annotated source and a separate build
340// target was taken for ojluni to avoid having to maintain local patches in the
341// ojluni source for UnsupportedAppUsage annotations as that would make it more
342// difficult to pull down changes from upstream.
343//
Paul Duffin7bb8d232018-10-23 11:48:38 +0100344java_library {
345 name: "core-oj-hiddenapi",
Paul Duffin48ac7b62019-03-28 14:28:06 +0000346 // Do not allow this to be accessed from outside this directory.
347 visibility: ["//visibility:private"],
Paul Duffin7bb8d232018-10-23 11:48:38 +0100348 defaults: ["libcore_java_defaults"],
349 compile_dex: true,
350
351 srcs: [":openjdk_hiddenapi_javadoc_files"],
352
Paul Duffin83c25382019-06-07 14:10:49 +0100353 sdk_version: "none",
Paul Duffin7bb8d232018-10-23 11:48:38 +0100354 system_modules: "core-all-system-modules",
355 openjdk9: {
356 javacflags: ["--patch-module=java.base=."],
357 },
358}
359
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100360//
Paul Duffin00b174e2019-09-26 16:22:17 +0100361// Guaranteed unstripped versions of core-oj and core-libart.
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100362//
Colin Cross3c6c2e22017-10-18 13:24:52 -0700363// The build system may or may not strip the core-oj and core-libart jars,
364// but these will not be stripped. See b/24535627.
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100365//
366
Colin Cross3c6c2e22017-10-18 13:24:52 -0700367java_library {
368 name: "core-oj-testdex",
Colin Cross5b75cdd2018-06-27 11:00:13 -0700369 installable: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700370 static_libs: ["core-oj"],
Paul Duffin83c25382019-06-07 14:10:49 +0100371 sdk_version: "none",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700372 system_modules: "core-all-system-modules",
373 dxflags: ["--core-library"],
Colin Cross485ed362017-12-05 17:24:22 -0800374 dex_preopt: {
375 enabled: false,
376 },
Tobias Thiererde991232018-03-07 15:10:46 +0000377 java_version: "1.9",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700378 notice: "ojluni/NOTICE",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700379}
380
381java_library {
382 name: "core-libart-testdex",
Colin Cross5b75cdd2018-06-27 11:00:13 -0700383 installable: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700384 static_libs: ["core-libart"],
Paul Duffin83c25382019-06-07 14:10:49 +0100385 sdk_version: "none",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700386 system_modules: "core-all-system-modules",
387 dxflags: ["--core-library"],
Colin Cross485ed362017-12-05 17:24:22 -0800388 dex_preopt: {
389 enabled: false,
390 },
Colin Cross3c6c2e22017-10-18 13:24:52 -0700391 notice: "ojluni/NOTICE",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700392}
393
Tobias Thierere0f8b312018-10-23 23:12:30 +0100394java_defaults {
395 name: "core_lambda_stubs_defaults",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700396 defaults: ["libcore_java_defaults"],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100397 hostdex: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700398
Paul Duffin83c25382019-06-07 14:10:49 +0100399 sdk_version: "none",
Colin Crossa4d9fc42017-09-29 18:04:37 -0700400 system_modules: "core-all-system-modules",
401 openjdk9: {
402 javacflags: ["--patch-module=java.base=."],
403 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700404
405 notice: "ojluni/NOTICE",
406
407 installable: false,
408 include_srcs: true,
409}
Colin Crossa4d9fc42017-09-29 18:04:37 -0700410
Tobias Thierere0f8b312018-10-23 23:12:30 +0100411// Creates a jar that exists to satisfy javac when compiling source code that
412// contains lambdas. This contains all classes / methods required by javac
413// when generating invoke-dynamic lambda implementation code, even those that
414// are also in the public SDK API from API level 26 onwards.
415java_library {
416 name: "core-lambda-stubs",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100417 visibility: ["//visibility:public"],
Tobias Thierere0f8b312018-10-23 23:12:30 +0100418 defaults: ["core_lambda_stubs_defaults"],
419 srcs: [
420 ":openjdk_lambda_stub_files",
421 ":openjdk_lambda_duplicate_stub_files",
422 ],
423}
424
425// An alternative to core-lambda-stubs that omits openjdk_lambda_duplicate_stub_files
426// because those classes are also part of the core library public SDK API
427// (since API level 26).
428java_library {
429 name: "core-lambda-stubs-for-system-modules",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100430 visibility: [
431 "//libcore/mmodules/core_platform_api",
432 ],
Tobias Thierere0f8b312018-10-23 23:12:30 +0100433 defaults: ["core_lambda_stubs_defaults"],
434 srcs: [
435 ":openjdk_lambda_stub_files",
436 ],
437}
438
Pete Gillin54035812019-05-08 15:09:39 +0100439// Creates a jar that exists to satisfy javac when compiling source code that
440// contains @Generated annotations, which are produced by some code generation
441// tools (notably dagger) but aren't part of the Android API.
442// See http://b/123891440.
443java_library {
444 name: "core-generated-annotation-stubs",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100445 visibility: [
446 "//libcore/mmodules/core_platform_api",
447 ],
Pete Gillin54035812019-05-08 15:09:39 +0100448 defaults: ["libcore_java_defaults"],
449 srcs: [
450 ":openjdk_generated_annotation_stub_files",
451 ],
452 hostdex: true,
Paul Duffin83c25382019-06-07 14:10:49 +0100453 sdk_version: "none",
Pete Gillin54035812019-05-08 15:09:39 +0100454 system_modules: "core-all-system-modules",
455 openjdk9: {
456 javacflags: ["--patch-module=java.base=."],
457 },
458 notice: "ojluni/NOTICE",
459 installable: false,
460 include_srcs: true,
461}
462
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100463// Builds libcore test rules
Colin Cross3c6c2e22017-10-18 13:24:52 -0700464java_library_static {
465 name: "core-test-rules",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100466 visibility: [
Paul Duffin01f6c022019-09-24 14:44:15 +0100467 "//external/conscrypt",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100468 "//frameworks/base/location/tests/locationtests",
469 ],
Colin Cross3c6c2e22017-10-18 13:24:52 -0700470 hostdex: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700471 srcs: [
472 "dalvik/test-rules/src/main/**/*.java",
473 "test-rules/src/main/**/*.java",
474 ],
475 static_libs: ["junit"],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100476
Paul Duffin83c25382019-06-07 14:10:49 +0100477 sdk_version: "none",
Neil Fuller4207c7f2018-10-10 14:01:40 +0100478 system_modules: "core-all-system-modules",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700479}
480
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100481// Builds the core-tests-support library used by various tests.
Colin Cross3c6c2e22017-10-18 13:24:52 -0700482java_library_static {
483 name: "core-tests-support",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100484 visibility: [
485 "//cts/apps/CtsVerifier",
486 "//cts/tests/tests/keystore",
487 "//cts/tests/tests/net",
488 "//cts/tests/tests/net/api23Test",
489 "//external/apache-harmony",
490 "//frameworks/base/core/tests/coretests",
491 "//libcore/benchmarks",
492 "//packages/apps/KeyChain/tests",
493 "//system/timezone/distro/core",
494 ],
Colin Cross3c6c2e22017-10-18 13:24:52 -0700495 hostdex: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700496 srcs: ["support/src/test/java/**/*.java"],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100497
Paul Duffin53c491f2019-06-12 13:48:14 +0100498 sdk_version: "core_platform",
Neil Fuller4380ab22018-10-18 19:38:53 +0100499 libs: ["junit"],
Colin Cross3c6c2e22017-10-18 13:24:52 -0700500 static_libs: [
Neil Fullerde8b0862018-10-12 21:53:31 +0100501 "bouncycastle-unbundled",
502 "bouncycastle-bcpkix-unbundled",
503 "bouncycastle-ocsp-unbundled",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700504 ],
505}
506
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100507// Builds the jsr166-tests library.
Colin Crossec80f4f2018-08-15 21:17:11 -0700508java_test {
Colin Cross3c6c2e22017-10-18 13:24:52 -0700509 name: "jsr166-tests",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100510 visibility: [
511 "//cts/tests/libcore/jsr166",
512 ],
Colin Cross3c6c2e22017-10-18 13:24:52 -0700513 srcs: ["jsr166-tests/src/test/java/**/*.java"],
Paul Duffin83c25382019-06-07 14:10:49 +0100514 sdk_version: "none",
Paul Duffin0e0f8c42019-09-20 14:49:55 +0100515 system_modules: "core-all-system-modules",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700516 libs: [
517 "junit",
518 ],
519}
Nan Zhang65f27a32018-01-05 10:41:46 -0800520
Pete Gillinec902b82019-06-26 17:23:00 +0100521// A filegroup that provides access to a source file for a toolchain test that
522// checks Java 9 language features are handled properly by JarJar.
523filegroup {
524 name: "core-java-9-language-features-source",
525 srcs: ["luni/src/main/java/libcore/internal/Java9LanguageFeatures.java"],
526 visibility: ["//libcore/luni/src/test/java9language"],
527}
528
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100529// Builds the core-tests library.
Colin Crossec80f4f2018-08-15 21:17:11 -0700530java_test {
531 name: "core-tests",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100532 visibility: [
533 "//cts/tests/libcore/luni",
534 ],
Colin Crossec80f4f2018-08-15 21:17:11 -0700535 defaults: ["libcore_java_defaults"],
536 hostdex: true,
537 srcs: [
538 "dalvik/src/test/java/**/*.java",
539 "dalvik/test-rules/src/test/java/**/*.java",
540 "dom/src/test/java/**/*.java",
541 "harmony-tests/src/test/java/**/*.java",
542 "json/src/test/java/**/*.java",
543 "luni/src/test/java/**/*.java",
Paul Duffin4ba14532019-03-21 10:32:41 +0000544 "test-rules/src/test/java/**/*.java",
Colin Crossec80f4f2018-08-15 21:17:11 -0700545 "xml/src/test/java/**/*.java",
546 ],
547 exclude_srcs: [
548 "luni/src/test/java/libcore/java/util/zip/Zip64Test.java",
549 "luni/src/test/java/libcore/java/util/zip/Zip64FileTest.java",
550 ],
551
552 java_resource_dirs: [
553 "*/src/test/java",
554 "*/src/test/resources",
555 ],
556 exclude_java_resource_dirs: [
557 "ojluni/src/test/java",
558 "ojluni/src/test/resources",
559 ],
560
561 java_resources: [
Paul Duffin16a057f2019-05-13 12:20:55 +0100562 ":annotations-test",
Colin Crossec80f4f2018-08-15 21:17:11 -0700563 ":filesystemstest",
564 ":parameter-metadata-test",
565 ],
566
Paul Duffin83c25382019-06-07 14:10:49 +0100567 sdk_version: "none",
Paul Duffin0e0f8c42019-09-20 14:49:55 +0100568 system_modules: "core-all-system-modules",
Neil Fuller4207c7f2018-10-10 14:01:40 +0100569 libs: [
Neil Fuller4207c7f2018-10-10 14:01:40 +0100570 "okhttp",
571 "bouncycastle",
572 ],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100573
Colin Crossec80f4f2018-08-15 21:17:11 -0700574 static_libs: [
575 "archive-patcher",
Pete Gillin05a43202019-06-27 14:41:21 +0100576 "core-java-9-language-tests",
Colin Crossec80f4f2018-08-15 21:17:11 -0700577 "core-test-rules",
578 "core-tests-support",
579 "junit-params",
580 "mockftpserver",
581 "mockito-target",
582 "mockwebserver",
583 "nist-pkix-tests",
584 "slf4j-jdk14",
585 "sqlite-jdbc",
586 "tzdata-testing",
Paul Duffina4df2372018-12-10 15:48:01 +0000587 "truth-prebuilt",
Colin Crossec80f4f2018-08-15 21:17:11 -0700588 ],
589
590 errorprone: {
591 javacflags: [
592 "-Xep:TryFailThrowable:ERROR",
593 "-Xep:ComparisonOutOfRange:ERROR",
594 ],
595 },
Simran Basi3be01e02018-08-21 17:53:49 -0700596
597 test_config: "AndroidTest-core-tests.xml",
Colin Crossec80f4f2018-08-15 21:17:11 -0700598}
599
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100600// Builds the core-ojtests library that contains test code from OpenJDK.
Colin Crossec80f4f2018-08-15 21:17:11 -0700601java_test {
602 name: "core-ojtests",
603 defaults: ["libcore_java_defaults"],
604 hostdex: true,
605
606 srcs: [
607 "ojluni/src/test/java/**/*.java",
608 ],
609 java_resource_dirs: [
610 "ojluni/src/test/java",
611 "ojluni/src/test/resources",
612 ],
Neil Fullerb669ccb2018-10-04 23:10:27 +0100613
Paul Duffin83c25382019-06-07 14:10:49 +0100614 sdk_version: "none",
Paul Duffin0e0f8c42019-09-20 14:49:55 +0100615 system_modules: "core-all-system-modules",
Neil Fuller4207c7f2018-10-10 14:01:40 +0100616 libs: [
Neil Fuller4207c7f2018-10-10 14:01:40 +0100617 "okhttp",
618 "bouncycastle",
619 ],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100620
Colin Crossec80f4f2018-08-15 21:17:11 -0700621 static_libs: ["testng"],
622
623 // ojluni/src/test/java/util/stream/{bootlib,boottest}
624 // contains tests that are in packages from java.base;
625 // By default, OpenJDK 9's javac will only compile such
626 // code if it's declared to also be in java.base at
627 // compile time.
628 //
629 // For now, we use --patch-module to put all sources
630 // and dependencies from this make target into java.base;
631 // other source directories in this make target are in
632 // packages not from java.base; if this becomes a problem
633 // in future, this could be addressed eg. by splitting
634 // boot{lib,test} out into a separate make target,
635 // deleting those tests or moving them to a different
636 // package.
637 patch_module: "java.base",
638}
639
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100640// Builds the core-ojtests-public library. Excludes any private API tests.
641// Like core-ojtests but smaller.
Colin Crossec80f4f2018-08-15 21:17:11 -0700642java_test {
643 name: "core-ojtests-public",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100644 visibility: [
645 "//cts/tests/libcore/ojluni",
646 ],
Colin Crossec80f4f2018-08-15 21:17:11 -0700647 defaults: ["libcore_java_defaults"],
648 srcs: [
649 "ojluni/src/test/java/**/*.java",
650 ],
651 // Filter out the following:
652 // 1.) DeserializeMethodTest and SerializedLambdaTest, because they depends on stub classes
653 // and won't actually run, and
654 // 2.) util/stream/boot*. Those directories contain classes in the package java.util.stream;
655 // excluding them means we don't need patch_module: "java.base"
656 exclude_srcs: [
657 "**/DeserializeMethodTest.java",
658 "**/SerializedLambdaTest.java",
659 "ojluni/src/test/java/util/stream/boot*/**/*",
660 ],
661 java_resource_dirs: [
662 "ojluni/src/test/java",
663 "ojluni/src/test/resources",
664 // Include source code as part of JAR
665 "ojluni/src/test/dist",
666 ],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100667
Paul Duffin83c25382019-06-07 14:10:49 +0100668 sdk_version: "none",
Paul Duffin0e0f8c42019-09-20 14:49:55 +0100669 system_modules: "core-all-system-modules",
Neil Fuller4207c7f2018-10-10 14:01:40 +0100670 libs: [
Neil Fuller4207c7f2018-10-10 14:01:40 +0100671 "bouncycastle",
672 "okhttp",
673 "testng",
674 ],
Colin Crossec80f4f2018-08-15 21:17:11 -0700675}
676
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100677// Exports annotated stubs source files in ojluni/annotations/sdk to make them
678// available to metalava. Used for nullability annotations in OpenJDK source.
Pete Gillin7db7faa2018-07-31 13:29:35 +0100679droiddoc_exported_dir {
Pete Gillin0728b742018-09-17 15:41:45 +0100680 name: "ojluni-annotated-sdk-stubs",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100681 visibility: [
682 "//frameworks/base",
683 ],
Pete Gillin0728b742018-09-17 15:41:45 +0100684 path: "ojluni/annotations/sdk",
Pete Gillin7db7faa2018-07-31 13:29:35 +0100685}
Paul Duffin48ac7b62019-03-28 14:28:06 +0000686
Pete Gillin600c7cf2018-08-16 19:28:38 +0100687droiddoc_exported_dir {
688 name: "ojluni-annotated-nullability-stubs",
689 path: "ojluni/annotations/sdk/nullability",
690}
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100691
692// Exports annotated stubs source files in ojluni/annotations/mmodules to make
Paul Duffinc241d6a2019-06-25 15:40:29 +0100693// them available to metalava. Used for core platform API and intra-core API
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100694// annotations in OpenJDK source.
Pete Gillinc9935b62018-09-25 14:42:40 +0100695droiddoc_exported_dir {
696 name: "ojluni-annotated-mmodule-stubs",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100697 visibility: [
698 "//libcore/mmodules/core_platform_api",
699 "//libcore/mmodules/intracoreapi",
700 ],
Pete Gillinc9935b62018-09-25 14:42:40 +0100701 path: "ojluni/annotations/mmodule",
702}
Pete Gillin7db7faa2018-07-31 13:29:35 +0100703
Neil Fuller6f16b462018-09-04 15:40:39 +0100704// A file containing the list of tags that are "known" to us from the OpenJdk
705// source code and so should not cause an error or warning.
Nan Zhangd55722b2018-02-27 15:08:20 -0800706filegroup {
707 name: "known-oj-tags",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100708 visibility: [
709 "//frameworks/base",
710 ],
Nan Zhangd55722b2018-02-27 15:08:20 -0800711 srcs: [
712 "known_oj_tags.txt",
713 ],
714}
Nan Zhang602fc0e2018-03-22 16:14:22 -0700715
Paul Duffina8bb6062019-09-25 15:50:13 +0100716// Generates stubs for the parts of the public SDK API provided by the ART module.
Paul Duffin0ca3cbe2019-02-14 15:47:58 +0000717//
Paul Duffina8bb6062019-09-25 15:50:13 +0100718// Only for use by art.module.public.api.stubs target below.
Nan Zhangf0207602018-09-10 18:57:38 -0700719droidstubs {
Paul Duffina8bb6062019-09-25 15:50:13 +0100720 name: "art-module-public-api-stubs-gen",
Paul Duffin53690cb2019-09-19 15:11:28 +0100721 srcs: [
Paul Duffina8bb6062019-09-25 15:50:13 +0100722 ":core_oj_api_files",
723 ":core_libart_api_files",
Paul Duffin53690cb2019-09-19 15:11:28 +0100724 ],
Tobias Thiererde991232018-03-07 15:10:46 +0000725 java_version: "1.9",
Nan Zhang602fc0e2018-03-22 16:14:22 -0700726 installable: false,
Paul Duffin419b2422019-06-25 15:42:05 +0100727 sdk_version: "none",
Nan Zhang602fc0e2018-03-22 16:14:22 -0700728}
729
Paul Duffina8bb6062019-09-25 15:50:13 +0100730// A stubs target containing the parts of the public SDK API provided by the ART module.
731java_library {
732 name: "art.module.public.api.stubs",
Paul Duffin00b174e2019-09-26 16:22:17 +0100733 visibility: [
Paul Duffinba71f832019-09-27 14:54:23 +0100734 "//external/conscrypt",
Paul Duffin00b174e2019-09-26 16:22:17 +0100735 "//external/icu/android_icu4j",
736 ],
Paul Duffina8bb6062019-09-25 15:50:13 +0100737 srcs: [":art-module-public-api-stubs-gen"],
738 errorprone: {
739 javacflags: [
740 "-Xep:MissingOverride:OFF",
741 ],
742 },
743 openjdk9: {
744 javacflags: ["--patch-module=java.base=."],
745 },
746 sdk_version: "none",
747 system_modules: "none",
748}
749
750// Used when compiling higher-level code against art.module.public.api.stubs.
751java_system_modules {
752 name: "art-module-public-api-stubs-system-modules",
753 visibility: [
Paul Duffinba71f832019-09-27 14:54:23 +0100754 "//external/conscrypt",
Paul Duffin00b174e2019-09-26 16:22:17 +0100755 "//external/icu/android_icu4j",
Paul Duffina8bb6062019-09-25 15:50:13 +0100756 "//external/wycheproof",
757 ],
758 libs: [
759 "art.module.public.api.stubs",
760 // This one is not on device but it's needed when javac compiles code
761 // containing lambdas.
762 "core-lambda-stubs-for-system-modules",
763 // This one is not on device but it's needed when javac compiles code
764 // containing @Generated annotations produced by some code generation
765 // tools.
766 // See http://b/123891440.
767 "core-generated-annotation-stubs",
768 ],
769}
770
Paul Duffin0ca3cbe2019-02-14 15:47:58 +0000771// A stubs target containing the parts of the public SDK API provided by the
772// core library.
773//
774// Don't use this directly, use "sdk_version: core_current".
775java_library {
776 name: "core.current.stubs",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100777 visibility: ["//visibility:public"],
Paul Duffina8bb6062019-09-25 15:50:13 +0100778 static_libs: [
779 "art.module.public.api.stubs",
780 "conscrypt.module.public.api.stubs",
781 "i18n.module.public.api.stubs",
782 ],
Paul Duffin83c25382019-06-07 14:10:49 +0100783 sdk_version: "none",
Paul Duffin0ca3cbe2019-02-14 15:47:58 +0000784 system_modules: "none",
Paul Duffin65641182019-04-08 10:24:23 +0100785
786 dist: {
787 targets: [
788 "sdk",
789 "win_sdk",
790 ],
791 },
Paul Duffin0ca3cbe2019-02-14 15:47:58 +0000792}
793
Neil Fuller61dabbf2018-10-21 22:53:18 +0100794// Used when compiling higher-level code against core.current.stubs.
795java_system_modules {
796 name: "core-current-stubs-system-modules",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100797 visibility: ["//visibility:public"],
Neil Fuller61dabbf2018-10-21 22:53:18 +0100798 libs: [
799 "core.current.stubs",
800 // This one is not on device but it's needed when javac compiles code
801 // containing lambdas.
802 "core-lambda-stubs-for-system-modules",
803 // This one is not on device but it's needed when javac compiles code
804 // containing @Generated annotations produced by some code generation
805 // tools.
806 // See http://b/123891440.
807 "core-generated-annotation-stubs",
808 ],
809}
810
Pete Gillin600c7cf2018-08-16 19:28:38 +0100811// Target for validating nullability annotations for correctness and
812// completeness. To check that there are no nullability errors:
813// make core-current-stubs-nullability-validation
814// To check that there are only the expected nullability warnings:
815// make core-current-stubs-nullability-validation-check-nullability-warnings
816// To update the the list of known expected nullability warnings:
817// make core-current-stubs-nullability-validation-update-nullability-warnings
818droidstubs {
819 name: "core-current-stubs-nullability-validation",
820 srcs: [":core_api_files"],
821 installable: false,
Paul Duffin419b2422019-06-25 15:42:05 +0100822 sdk_version: "none",
Pete Gillin600c7cf2018-08-16 19:28:38 +0100823 annotations_enabled: true,
824 args: "--hide-annotation libcore.api.Hide " +
825 "--validate-nullability-from-merged-stubs ",
826 merge_inclusion_annotations_dirs: ["ojluni-annotated-mmodule-stubs"],
827 merge_annotations_dirs: [
828 "metalava-manual",
829 // N.B. Stubs in this filegroup will be validated:
830 "ojluni-annotated-nullability-stubs",
831 ],
Pete Gillinc5f179b2018-11-14 18:42:19 +0000832 // The list of classes which have nullability annotations included in the source.
833 // (This is in addition to those which have annotations in the merged stubs.)
834 validate_nullability_from_list: "nullability_annotated_classes.txt",
Pete Gillin600c7cf2018-08-16 19:28:38 +0100835 // The expected set of warnings about missing annotations:
836 check_nullability_warnings: "nullability_warnings.txt",
837}
838
Neil Fullere784ef22018-11-16 15:54:30 +0000839// A host library containing time zone related classes. Used for
840// host-side tools and tests that have to deal with Android
841// time zone data.
842java_library_host {
843 name: "timezone-host",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100844 visibility: [
845 "//system/timezone/distro/core",
846 ],
Neil Fullere784ef22018-11-16 15:54:30 +0000847 srcs: [":timezone_host_files"],
848}
Andrei Onea24892e22019-04-16 16:48:37 +0100849
Victor Changb28d3f82019-08-09 16:24:46 +0100850// A library that contains annotations not retented in runtime and inline-able constants
851// that should not introduce any runtime dependency for compiling core libraries, e.g. core-icu4j,
852java_library {
853 name: "libcore-unsupportedappusage-annotation",
Paul Duffin00b174e2019-09-26 16:22:17 +0100854 visibility: [
855 "//external/icu/android_icu4j",
856 ],
Victor Changb28d3f82019-08-09 16:24:46 +0100857 srcs: [
858 ":unsupportedappusage_annotation_files",
859 ],
860
861 installable: false,
862 sdk_version: "core_current",
863}
864
Andrei Onea24892e22019-04-16 16:48:37 +0100865// The source files that contain the UnsupportedAppUsage annotation and its dependencies.
866filegroup {
867 name: "unsupportedappusage_annotation_files",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100868 visibility: [
869 "//frameworks/base",
870 ],
Andrei Onea24892e22019-04-16 16:48:37 +0100871 srcs: [
872 "dalvik/src/main/java/dalvik/annotation/compat/UnsupportedAppUsage.java",
873 "dalvik/src/main/java/dalvik/system/VersionCodes.java",
874 "luni/src/main/java/libcore/api/CorePlatformApi.java",
875 "luni/src/main/java/libcore/api/IntraCoreApi.java",
876 ],
Neil Fuller86345d72019-04-25 09:15:32 +0100877}