blob: fc07815ab327d271b0302d4b744dfc098ba2f0ec [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/
22// directories. See the "core-system-modules" definition for the parts.
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/libcore/net/android.mime.types",
Tobias Thierer79eea262019-08-01 14:05:11 +010056 "luni/src/main/java/java/util/logging/logging.properties",
57 "luni/src/main/java/java/security/security.properties",
58 ],
59}
60
61filegroup {
62 name: "core-ojluni-resources",
63 visibility: [
64 "//libcore:__subpackages__",
65 ],
66 path: "ojluni/src/main/resources/",
67 srcs: [
68 "ojluni/src/main/resources/**/*",
69 ],
70}
71
72core_resources = [
73 ":core-luni-resources",
74 ":core-ojluni-resources",
Tobias Thiererb736fce2019-08-01 16:30:40 +010075 ":debian.mime.types",
Colin Crossaf0b54c2017-09-27 17:22:32 -070076]
77
Neil Fuller866ed4a2018-09-06 12:05:46 +010078// The source files that go into core-oj.
79filegroup {
80 name: "core_oj_java_files",
Paul Duffinc241d6a2019-06-25 15:40:29 +010081 visibility: [
82 "//libcore:__subpackages__",
83 ],
Neil Fuller866ed4a2018-09-06 12:05:46 +010084 srcs: [":openjdk_java_files"],
85}
86
Neil Fullere32e2e12019-02-26 11:48:30 +000087// OpenJDK source is not annotated with @hide so we need this separate
Neil Fuller866ed4a2018-09-06 12:05:46 +010088// filegroup for just the parts that contribute to the API.
89filegroup {
90 name: "core_oj_api_files",
91 srcs: [":openjdk_javadoc_files"],
92}
93
94// The source files that go into core-libart.
95filegroup {
96 name: "core_libart_java_files",
Paul Duffinc241d6a2019-06-25 15:40:29 +010097 visibility: [
98 "//libcore:__subpackages__",
99 ],
Neil Fuller866ed4a2018-09-06 12:05:46 +0100100 srcs: [
101 ":non_openjdk_java_files",
102 ":android_icu4j_src_files",
103 ],
104}
105
Neil Fullere32e2e12019-02-26 11:48:30 +0000106// Some parts of libart are not annotated with @hide so we need this separate
Neil Fuller866ed4a2018-09-06 12:05:46 +0100107// filegroup for just the parts that contribute to the API.
108filegroup {
109 name: "core_libart_api_files",
110 srcs: [
111 ":non_openjdk_javadoc_files",
112 ":android_icu4j_src_files",
113 ],
114}
115
Neil Fullere32e2e12019-02-26 11:48:30 +0000116// The set of files for the core library that have been marked up with @hide
117// for the public SDK APIs. Used from frameworks/base/ to indicate the source
118// files for inclusion in the public SDK docs.
119filegroup {
120 name: "core_public_api_files",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100121 visibility: [
122 "//frameworks/base",
123 ],
Neil Fullere32e2e12019-02-26 11:48:30 +0000124 srcs: [
125 ":core_oj_api_files",
126 ":core_libart_api_files",
127 ":conscrypt_public_api_files",
128 ],
129}
130
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100131// The set of files for the core library that have been marked up with @hide and
132// API-related annotations. Note that this includes the intra-core and
133// core-platform APIs as well as the public APIs.
134//
Neil Fullere32e2e12019-02-26 11:48:30 +0000135// Some source files in :core_oj_api_files and :openjdk_mmodule_extra_files are
136// annotated by applying annotations to the .annotated.java stubs files in
137// ojluni/annotated/mmodules and rather than in the original source. See the comments
138// in openjdk_java_files.bp for more details.
Neil Fuller866ed4a2018-09-06 12:05:46 +0100139filegroup {
140 name: "core_api_files",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100141 visibility: [
142 "//libcore:__subpackages__",
143 ],
Neil Fuller866ed4a2018-09-06 12:05:46 +0100144 srcs: [
Neil Fullerd129bc92018-09-26 11:12:58 +0100145 ":apache-xml_api_files",
Neil Fullera77f7102018-09-21 19:04:41 +0100146 ":bouncycastle_java_files",
Neil Fuller603e1a72018-09-25 11:55:41 +0100147 ":conscrypt_java_files",
Neil Fuller866ed4a2018-09-06 12:05:46 +0100148 ":core_oj_api_files",
149 ":core_libart_api_files",
Neil Fuller641d5f92018-09-24 15:40:39 +0100150 ":okhttp_api_files",
Pete Gillinc9935b62018-09-25 14:42:40 +0100151 ":openjdk_mmodule_extra_files",
Neil Fuller866ed4a2018-09-06 12:05:46 +0100152 ],
153}
154
Colin Crossaf0b54c2017-09-27 17:22:32 -0700155java_defaults {
156 name: "libcore_java_defaults",
157 javacflags: [
158 //"-Xlint:all",
159 //"-Xlint:-serial,-deprecation,-unchecked",
160 ],
161 dxflags: ["--core-library"],
Andreas Gampe66b31732018-02-20 09:22:16 -0800162 errorprone: {
163 javacflags: [
Paul Duffinc31f6bb2019-05-15 12:32:44 +0100164 "-Xep:MissingOverride:OFF", // Ignore missing @Override.
165 "-Xep:ConstantOverflow:WARN", // Known constant overflow in SplittableRandom
Andreas Gampe66b31732018-02-20 09:22:16 -0800166 ],
167 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700168}
169
170//
171// Build for the target (device).
172//
173
Tobias Thierercf66bfd2019-05-29 13:18:25 +0100174// Visibility of core-all* build modules; we restrict visibility of core-all deliberately to
175// a small set of build modules that the core library team control. See core-all-system-modules
176// for more details.
177core_all_visibility = [
178 "//external/apache-harmony:__subpackages__",
179 "//external/apache-xml",
180 "//external/bouncycastle",
181 "//external/conscrypt",
182 "//external/icu/android_icu4j",
183 "//external/okhttp",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100184 "//libcore:__subpackages__",
Tobias Thierercf66bfd2019-05-29 13:18:25 +0100185]
186
Tobias Thierer52331642019-05-29 12:11:39 +0000187// A target used to bootstrap compilation for the core library.
188// See core-all-system-modules for more details.
189java_library {
190 name: "core-all",
Tobias Thierercf66bfd2019-05-29 13:18:25 +0100191 visibility: core_all_visibility,
Tobias Thierer52331642019-05-29 12:11:39 +0000192 defaults: ["libcore_java_defaults"],
Colin Crossaf0b54c2017-09-27 17:22:32 -0700193
194 srcs: [
Neil Fuller866ed4a2018-09-06 12:05:46 +0100195 ":core_oj_java_files",
196 ":core_libart_java_files",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700197 ":openjdk_lambda_stub_files",
Pete Gillin54035812019-05-08 15:09:39 +0100198 ":openjdk_generated_annotation_stub_files",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700199 ],
Colin Crossec80f4f2018-08-15 21:17:11 -0700200
Paul Duffin83c25382019-06-07 14:10:49 +0100201 sdk_version: "none",
Colin Crossec80f4f2018-08-15 21:17:11 -0700202 system_modules: "none",
Colin Crossa4d9fc42017-09-29 18:04:37 -0700203 openjdk9: {
204 srcs: ["luni/src/module/java/module-info.java"],
205 javacflags: ["--patch-module=java.base=."],
206 },
Colin Crossec80f4f2018-08-15 21:17:11 -0700207
Tobias Thierer79eea262019-08-01 14:05:11 +0100208 java_resources: core_resources,
Victor Chang7fef4052018-09-25 14:12:03 +0100209 static_libs: ["android_icu4j_resources_lib"],
Tobias Thiererde991232018-03-07 15:10:46 +0000210 java_version: "1.9",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700211
Colin Crossaf0b54c2017-09-27 17:22:32 -0700212 installable: false,
atrost98ec08d2019-08-05 12:23:41 +0100213
214 plugins: ["compat-changeid-annotation-processor"],
215}
216
217platform_compat_config {
218 name: "libcore-platform-compat-config",
219 prefix: "libcore",
220 src: ":core-all",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700221}
222
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100223// A system modules definition for use by core library targets only. It only
224// contains the core-all jar, which contains the classes that end up in core-oj,
225// core-libart as well as the lambda stubs needed to compile Java lambda code.
226// It does not contain other parts of core library like conscrypt, bouncycastle,
227// etc. This system_modules definition is used to bootstrap compilation for
228// other parts of the core library like core-oj, core-libart, conscrypt,
229// bouncycastle, etc.
230//
231// If you want to compile against the entire core library implementation, for
232// example to build core library tests, see "core-system-modules" instead.
Colin Crossa4d9fc42017-09-29 18:04:37 -0700233java_system_modules {
234 name: "core-all-system-modules",
Tobias Thierercf66bfd2019-05-29 13:18:25 +0100235 visibility: core_all_visibility,
Colin Crossa4d9fc42017-09-29 18:04:37 -0700236 libs: ["core-all"],
237}
238
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100239// Contains the parts of core library associated with OpenJDK.
Colin Crossaf0b54c2017-09-27 17:22:32 -0700240java_library {
241 name: "core-oj",
Paul Duffin48ac7b62019-03-28 14:28:06 +0000242 visibility: [
243 "//art/build/apex",
244 "//external/wycheproof",
Paul Duffin94f70232019-05-22 16:22:29 +0100245 "//libcore/benchmarks",
Paul Duffin48ac7b62019-03-28 14:28:06 +0000246 ],
Colin Crossaf0b54c2017-09-27 17:22:32 -0700247 defaults: ["libcore_java_defaults"],
Colin Cross5b75cdd2018-06-27 11:00:13 -0700248 installable: true,
Colin Crossbb180be2017-10-09 14:54:53 -0700249 hostdex: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700250
Neil Fuller866ed4a2018-09-06 12:05:46 +0100251 srcs: [":core_oj_java_files"],
Tobias Thierer79eea262019-08-01 14:05:11 +0100252 java_resources: core_resources,
Colin Crossec80f4f2018-08-15 21:17:11 -0700253
Paul Duffin83c25382019-06-07 14:10:49 +0100254 sdk_version: "none",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700255 libs: ["core-all"],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700256 system_modules: "core-all-system-modules",
257 openjdk9: {
258 javacflags: ["--patch-module=java.base=."],
259 },
Colin Crossec80f4f2018-08-15 21:17:11 -0700260
Pete Gillin7a7a6d22017-12-19 14:56:03 +0000261 jacoco: {
Pete Gillin27ca0582018-01-10 17:04:17 +0000262 exclude_filter: [
Pete Gillin3f59bad2018-01-30 11:20:29 +0000263 "java.lang.Class",
264 "java.lang.Long",
265 "java.lang.Number",
266 "java.lang.Object",
267 "java.lang.String",
268 "java.lang.invoke.MethodHandle",
269 "java.lang.ref.Reference",
270 "java.lang.reflect.Proxy",
Pete Gillinb1868ada2018-01-17 11:03:10 +0000271 "java.util.AbstractMap",
Pete Gillin3f59bad2018-01-30 11:20:29 +0000272 "java.util.HashMap",
273 "java.util.HashMap$Node",
Pete Gillinb1868ada2018-01-17 11:03:10 +0000274 "java.util.Map",
Pete Gillin7a7a6d22017-12-19 14:56:03 +0000275 ],
276 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700277
278 notice: "ojluni/NOTICE",
279
Colin Crossaf0b54c2017-09-27 17:22:32 -0700280}
281
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100282// Contains parts of core library not associated with OpenJDK. Contains not
283// just java.*, javax.* code but also android.icu.*, android.system.* and
284// various internal libcore.* packages.
Colin Crossaf0b54c2017-09-27 17:22:32 -0700285java_library {
286 name: "core-libart",
Paul Duffin48ac7b62019-03-28 14:28:06 +0000287 visibility: [
288 "//art/build/apex",
289 "//external/robolectric-shadows",
290 "//external/wycheproof",
Paul Duffin94f70232019-05-22 16:22:29 +0100291 "//libcore/benchmarks",
Colin Crossf0ef6252019-05-31 08:26:47 -0700292 "//frameworks/layoutlib",
Paul Duffin48ac7b62019-03-28 14:28:06 +0000293 ],
Colin Crossaf0b54c2017-09-27 17:22:32 -0700294 defaults: ["libcore_java_defaults"],
Colin Cross5b75cdd2018-06-27 11:00:13 -0700295 installable: true,
Colin Crossbb180be2017-10-09 14:54:53 -0700296 hostdex: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700297
Neil Fuller866ed4a2018-09-06 12:05:46 +0100298 srcs: [":core_libart_java_files"],
Victor Chang7fef4052018-09-25 14:12:03 +0100299 static_libs: ["android_icu4j_resources_lib"],
Tobias Thiererde991232018-03-07 15:10:46 +0000300 java_version: "1.9",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700301
Paul Duffin83c25382019-06-07 14:10:49 +0100302 sdk_version: "none",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700303 libs: ["core-all"],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700304 system_modules: "core-all-system-modules",
305 openjdk9: {
306 javacflags: ["--patch-module=java.base=."],
307 },
Colin Crossec80f4f2018-08-15 21:17:11 -0700308
Pete Gillin80ebe872018-02-13 15:21:20 +0000309 jacoco: {
310 exclude_filter: [
311 "java.lang.DexCache",
312 "dalvik.system.ClassExt",
313 ],
314 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700315
Andreas Gampe9a1ba892019-04-24 12:35:40 -0700316 target: {
317 hostdex: {
318 required: [
Neil Fuller53c5f032019-06-05 13:47:39 +0100319 // Files used to simulate the /system, runtime APEX and tzdata
320 // APEX dir structure on host.
321 "icu_tzdata.dat_host_tzdata_apex",
Andreas Gampe9a1ba892019-04-24 12:35:40 -0700322 "tzdata_host",
Neil Fuller53c5f032019-06-05 13:47:39 +0100323 "tzdata_host_tzdata_apex",
Neil Fuller53c5f032019-06-05 13:47:39 +0100324 "tzlookup.xml_host_tzdata_apex",
Andreas Gampe9a1ba892019-04-24 12:35:40 -0700325 "tz_version_host",
Neil Fuller53c5f032019-06-05 13:47:39 +0100326 "tz_version_host_tzdata_apex",
Andreas Gampe9a1ba892019-04-24 12:35:40 -0700327 ],
328 },
329 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700330}
331
Paul Duffin7bb8d232018-10-23 11:48:38 +0100332// Provided solely to contribute information about which hidden parts of the
333// core-oj API are used by apps.
Paul Duffinc6bf27b2019-05-15 14:41:00 +0100334//
335// The build system determines that this library provides hiddenapi information
336// for the core-oj bootjar because its name is of the form <x>-hiddenapi, where
337// <x> is the name of a boot jar. That triggers the generation of a flags.csv
338// file which encapsulates information extracted from the UnsupportedAppUsage
339// annotations in the dex. The information from that file is then encoded into
340// the core-oj file.
341//
342// Usually, e.g. for core-libart, the UnsupportedAppUsage annotations are
343// added to the source that is compiled directly into the bootjar and the build
344// system extracts the information about UnsupportedAppUsage directly from
345// there.
346//
347// This approach of having separate annotated source and a separate build
348// target was taken for ojluni to avoid having to maintain local patches in the
349// ojluni source for UnsupportedAppUsage annotations as that would make it more
350// difficult to pull down changes from upstream.
351//
Paul Duffin7bb8d232018-10-23 11:48:38 +0100352java_library {
353 name: "core-oj-hiddenapi",
Paul Duffin48ac7b62019-03-28 14:28:06 +0000354 // Do not allow this to be accessed from outside this directory.
355 visibility: ["//visibility:private"],
Paul Duffin7bb8d232018-10-23 11:48:38 +0100356 defaults: ["libcore_java_defaults"],
357 compile_dex: true,
358
359 srcs: [":openjdk_hiddenapi_javadoc_files"],
360
Paul Duffin83c25382019-06-07 14:10:49 +0100361 sdk_version: "none",
Paul Duffin7bb8d232018-10-23 11:48:38 +0100362 libs: ["core-all"],
363 system_modules: "core-all-system-modules",
364 openjdk9: {
365 javacflags: ["--patch-module=java.base=."],
366 },
367}
368
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100369//
370// Guaranteed unstripped versions of core-oj and core-libart.
371//
Colin Cross3c6c2e22017-10-18 13:24:52 -0700372// The build system may or may not strip the core-oj and core-libart jars,
373// but these will not be stripped. See b/24535627.
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100374//
375
Colin Cross3c6c2e22017-10-18 13:24:52 -0700376java_library {
377 name: "core-oj-testdex",
Colin Cross5b75cdd2018-06-27 11:00:13 -0700378 installable: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700379 static_libs: ["core-oj"],
Paul Duffin83c25382019-06-07 14:10:49 +0100380 sdk_version: "none",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700381 libs: ["core-all"],
382 system_modules: "core-all-system-modules",
383 dxflags: ["--core-library"],
Colin Cross485ed362017-12-05 17:24:22 -0800384 dex_preopt: {
385 enabled: false,
386 },
Tobias Thiererde991232018-03-07 15:10:46 +0000387 java_version: "1.9",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700388 notice: "ojluni/NOTICE",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700389}
390
391java_library {
392 name: "core-libart-testdex",
Colin Cross5b75cdd2018-06-27 11:00:13 -0700393 installable: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700394 static_libs: ["core-libart"],
Paul Duffin83c25382019-06-07 14:10:49 +0100395 sdk_version: "none",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700396 libs: ["core-all"],
397 system_modules: "core-all-system-modules",
398 dxflags: ["--core-library"],
Colin Cross485ed362017-12-05 17:24:22 -0800399 dex_preopt: {
400 enabled: false,
401 },
Colin Cross3c6c2e22017-10-18 13:24:52 -0700402 notice: "ojluni/NOTICE",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700403}
404
Tobias Thierere0f8b312018-10-23 23:12:30 +0100405java_defaults {
406 name: "core_lambda_stubs_defaults",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700407 defaults: ["libcore_java_defaults"],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100408 hostdex: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700409
Paul Duffin83c25382019-06-07 14:10:49 +0100410 sdk_version: "none",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700411 libs: ["core-all"],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700412 system_modules: "core-all-system-modules",
413 openjdk9: {
414 javacflags: ["--patch-module=java.base=."],
415 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700416
417 notice: "ojluni/NOTICE",
418
419 installable: false,
420 include_srcs: true,
421}
Colin Crossa4d9fc42017-09-29 18:04:37 -0700422
Tobias Thierere0f8b312018-10-23 23:12:30 +0100423// Creates a jar that exists to satisfy javac when compiling source code that
424// contains lambdas. This contains all classes / methods required by javac
425// when generating invoke-dynamic lambda implementation code, even those that
426// are also in the public SDK API from API level 26 onwards.
427java_library {
428 name: "core-lambda-stubs",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100429 visibility: ["//visibility:public"],
Tobias Thierere0f8b312018-10-23 23:12:30 +0100430 defaults: ["core_lambda_stubs_defaults"],
431 srcs: [
432 ":openjdk_lambda_stub_files",
433 ":openjdk_lambda_duplicate_stub_files",
434 ],
435}
436
437// An alternative to core-lambda-stubs that omits openjdk_lambda_duplicate_stub_files
438// because those classes are also part of the core library public SDK API
439// (since API level 26).
440java_library {
441 name: "core-lambda-stubs-for-system-modules",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100442 visibility: [
443 "//libcore/mmodules/core_platform_api",
444 ],
Tobias Thierere0f8b312018-10-23 23:12:30 +0100445 defaults: ["core_lambda_stubs_defaults"],
446 srcs: [
447 ":openjdk_lambda_stub_files",
448 ],
449}
450
Pete Gillin54035812019-05-08 15:09:39 +0100451// Creates a jar that exists to satisfy javac when compiling source code that
452// contains @Generated annotations, which are produced by some code generation
453// tools (notably dagger) but aren't part of the Android API.
454// See http://b/123891440.
455java_library {
456 name: "core-generated-annotation-stubs",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100457 visibility: [
458 "//libcore/mmodules/core_platform_api",
459 ],
Pete Gillin54035812019-05-08 15:09:39 +0100460 defaults: ["libcore_java_defaults"],
461 srcs: [
462 ":openjdk_generated_annotation_stub_files",
463 ],
464 hostdex: true,
Paul Duffin83c25382019-06-07 14:10:49 +0100465 sdk_version: "none",
Pete Gillin54035812019-05-08 15:09:39 +0100466 libs: ["core-all"],
467 system_modules: "core-all-system-modules",
468 openjdk9: {
469 javacflags: ["--patch-module=java.base=."],
470 },
471 notice: "ojluni/NOTICE",
472 installable: false,
473 include_srcs: true,
474}
475
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100476// A system modules definition containing the implementations for the various
477// parts that make up the core library.
478//
479// This system module is intended for use by tests that may need access to
480// core library internals. It should not be generally used; most of the
481// platform build should build against API stubs instead. See
482// "core-platform-api-stubs-system-modules", which is the default used by the
483// Android build.
484//
485// This module also includes lambda stubs for compiling source containing
486// Java lambdas.
Colin Crossa4d9fc42017-09-29 18:04:37 -0700487java_system_modules {
488 name: "core-system-modules",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100489 visibility: ["//visibility:public"],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700490 libs: [
491 "core-oj",
492 "core-libart",
Neil Fullerb669ccb2018-10-04 23:10:27 +0100493 "bouncycastle",
494 "conscrypt",
495 "okhttp",
Neil Fuller05723a52018-10-19 10:55:05 +0100496 "apache-xml",
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100497 // This one is not on device but it's needed when javac compiles code
498 // containing lambdas.
Tobias Thierere0f8b312018-10-23 23:12:30 +0100499 "core-lambda-stubs-for-system-modules",
Colin Crossa4d9fc42017-09-29 18:04:37 -0700500 ],
501}
Colin Cross3c6c2e22017-10-18 13:24:52 -0700502
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100503// Builds libcore test rules
Colin Cross3c6c2e22017-10-18 13:24:52 -0700504java_library_static {
505 name: "core-test-rules",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100506 visibility: [
507 "//frameworks/base/location/tests/locationtests",
508 ],
Colin Cross3c6c2e22017-10-18 13:24:52 -0700509 hostdex: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700510 srcs: [
511 "dalvik/test-rules/src/main/**/*.java",
512 "test-rules/src/main/**/*.java",
513 ],
514 static_libs: ["junit"],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100515
Paul Duffin83c25382019-06-07 14:10:49 +0100516 sdk_version: "none",
Neil Fuller4207c7f2018-10-10 14:01:40 +0100517 libs: ["core-all"],
518 system_modules: "core-all-system-modules",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700519}
520
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100521// Builds the core-tests-support library used by various tests.
Colin Cross3c6c2e22017-10-18 13:24:52 -0700522java_library_static {
523 name: "core-tests-support",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100524 visibility: [
525 "//cts/apps/CtsVerifier",
526 "//cts/tests/tests/keystore",
527 "//cts/tests/tests/net",
528 "//cts/tests/tests/net/api23Test",
529 "//external/apache-harmony",
530 "//frameworks/base/core/tests/coretests",
531 "//libcore/benchmarks",
532 "//packages/apps/KeyChain/tests",
533 "//system/timezone/distro/core",
534 ],
Colin Cross3c6c2e22017-10-18 13:24:52 -0700535 hostdex: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700536 srcs: ["support/src/test/java/**/*.java"],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100537
Paul Duffin53c491f2019-06-12 13:48:14 +0100538 sdk_version: "core_platform",
Neil Fuller4380ab22018-10-18 19:38:53 +0100539 libs: ["junit"],
Colin Cross3c6c2e22017-10-18 13:24:52 -0700540 static_libs: [
Neil Fullerde8b0862018-10-12 21:53:31 +0100541 "bouncycastle-unbundled",
542 "bouncycastle-bcpkix-unbundled",
543 "bouncycastle-ocsp-unbundled",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700544 ],
545}
546
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100547// Builds the jsr166-tests library.
Colin Crossec80f4f2018-08-15 21:17:11 -0700548java_test {
Colin Cross3c6c2e22017-10-18 13:24:52 -0700549 name: "jsr166-tests",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100550 visibility: [
551 "//cts/tests/libcore/jsr166",
552 ],
Colin Cross3c6c2e22017-10-18 13:24:52 -0700553 srcs: ["jsr166-tests/src/test/java/**/*.java"],
Paul Duffin83c25382019-06-07 14:10:49 +0100554 sdk_version: "none",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700555 libs: [
Neil Fuller4207c7f2018-10-10 14:01:40 +0100556 "core-all",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700557 "junit",
558 ],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100559 system_modules: "core-all-system-modules",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700560}
Nan Zhang65f27a32018-01-05 10:41:46 -0800561
Pete Gillinec902b82019-06-26 17:23:00 +0100562// A filegroup that provides access to a source file for a toolchain test that
563// checks Java 9 language features are handled properly by JarJar.
564filegroup {
565 name: "core-java-9-language-features-source",
566 srcs: ["luni/src/main/java/libcore/internal/Java9LanguageFeatures.java"],
567 visibility: ["//libcore/luni/src/test/java9language"],
568}
569
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100570// Builds the core-tests library.
Colin Crossec80f4f2018-08-15 21:17:11 -0700571java_test {
572 name: "core-tests",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100573 visibility: [
574 "//cts/tests/libcore/luni",
575 ],
Colin Crossec80f4f2018-08-15 21:17:11 -0700576 defaults: ["libcore_java_defaults"],
577 hostdex: true,
578 srcs: [
579 "dalvik/src/test/java/**/*.java",
580 "dalvik/test-rules/src/test/java/**/*.java",
581 "dom/src/test/java/**/*.java",
582 "harmony-tests/src/test/java/**/*.java",
583 "json/src/test/java/**/*.java",
584 "luni/src/test/java/**/*.java",
Paul Duffin4ba14532019-03-21 10:32:41 +0000585 "test-rules/src/test/java/**/*.java",
Colin Crossec80f4f2018-08-15 21:17:11 -0700586 "xml/src/test/java/**/*.java",
587 ],
588 exclude_srcs: [
589 "luni/src/test/java/libcore/java/util/zip/Zip64Test.java",
590 "luni/src/test/java/libcore/java/util/zip/Zip64FileTest.java",
591 ],
592
593 java_resource_dirs: [
594 "*/src/test/java",
595 "*/src/test/resources",
596 ],
597 exclude_java_resource_dirs: [
598 "ojluni/src/test/java",
599 "ojluni/src/test/resources",
600 ],
601
602 java_resources: [
Paul Duffin16a057f2019-05-13 12:20:55 +0100603 ":annotations-test",
Colin Crossec80f4f2018-08-15 21:17:11 -0700604 ":filesystemstest",
605 ":parameter-metadata-test",
606 ],
607
Paul Duffin83c25382019-06-07 14:10:49 +0100608 sdk_version: "none",
Neil Fuller4207c7f2018-10-10 14:01:40 +0100609 libs: [
610 "core-all",
611 "okhttp",
612 "bouncycastle",
613 ],
614 system_modules: "core-all-system-modules",
615
Colin Crossec80f4f2018-08-15 21:17:11 -0700616 static_libs: [
617 "archive-patcher",
Pete Gillin05a43202019-06-27 14:41:21 +0100618 "core-java-9-language-tests",
Colin Crossec80f4f2018-08-15 21:17:11 -0700619 "core-test-rules",
620 "core-tests-support",
621 "junit-params",
622 "mockftpserver",
623 "mockito-target",
624 "mockwebserver",
625 "nist-pkix-tests",
626 "slf4j-jdk14",
627 "sqlite-jdbc",
628 "tzdata-testing",
Paul Duffina4df2372018-12-10 15:48:01 +0000629 "truth-prebuilt",
Colin Crossec80f4f2018-08-15 21:17:11 -0700630 ],
631
632 errorprone: {
633 javacflags: [
634 "-Xep:TryFailThrowable:ERROR",
635 "-Xep:ComparisonOutOfRange:ERROR",
636 ],
637 },
Simran Basi3be01e02018-08-21 17:53:49 -0700638
639 test_config: "AndroidTest-core-tests.xml",
Colin Crossec80f4f2018-08-15 21:17:11 -0700640}
641
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100642// Builds the core-ojtests library that contains test code from OpenJDK.
Colin Crossec80f4f2018-08-15 21:17:11 -0700643java_test {
644 name: "core-ojtests",
645 defaults: ["libcore_java_defaults"],
646 hostdex: true,
647
648 srcs: [
649 "ojluni/src/test/java/**/*.java",
650 ],
651 java_resource_dirs: [
652 "ojluni/src/test/java",
653 "ojluni/src/test/resources",
654 ],
Neil Fullerb669ccb2018-10-04 23:10:27 +0100655
Paul Duffin83c25382019-06-07 14:10:49 +0100656 sdk_version: "none",
Neil Fuller4207c7f2018-10-10 14:01:40 +0100657 libs: [
658 "core-all",
659 "okhttp",
660 "bouncycastle",
661 ],
662 system_modules: "core-all-system-modules",
663
Colin Crossec80f4f2018-08-15 21:17:11 -0700664 static_libs: ["testng"],
665
666 // ojluni/src/test/java/util/stream/{bootlib,boottest}
667 // contains tests that are in packages from java.base;
668 // By default, OpenJDK 9's javac will only compile such
669 // code if it's declared to also be in java.base at
670 // compile time.
671 //
672 // For now, we use --patch-module to put all sources
673 // and dependencies from this make target into java.base;
674 // other source directories in this make target are in
675 // packages not from java.base; if this becomes a problem
676 // in future, this could be addressed eg. by splitting
677 // boot{lib,test} out into a separate make target,
678 // deleting those tests or moving them to a different
679 // package.
680 patch_module: "java.base",
681}
682
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100683// Builds the core-ojtests-public library. Excludes any private API tests.
684// Like core-ojtests but smaller.
Colin Crossec80f4f2018-08-15 21:17:11 -0700685java_test {
686 name: "core-ojtests-public",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100687 visibility: [
688 "//cts/tests/libcore/ojluni",
689 ],
Colin Crossec80f4f2018-08-15 21:17:11 -0700690 defaults: ["libcore_java_defaults"],
691 srcs: [
692 "ojluni/src/test/java/**/*.java",
693 ],
694 // Filter out the following:
695 // 1.) DeserializeMethodTest and SerializedLambdaTest, because they depends on stub classes
696 // and won't actually run, and
697 // 2.) util/stream/boot*. Those directories contain classes in the package java.util.stream;
698 // excluding them means we don't need patch_module: "java.base"
699 exclude_srcs: [
700 "**/DeserializeMethodTest.java",
701 "**/SerializedLambdaTest.java",
702 "ojluni/src/test/java/util/stream/boot*/**/*",
703 ],
704 java_resource_dirs: [
705 "ojluni/src/test/java",
706 "ojluni/src/test/resources",
707 // Include source code as part of JAR
708 "ojluni/src/test/dist",
709 ],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100710
Paul Duffin83c25382019-06-07 14:10:49 +0100711 sdk_version: "none",
Neil Fuller4207c7f2018-10-10 14:01:40 +0100712 libs: [
713 "core-all",
714 "bouncycastle",
715 "okhttp",
716 "testng",
717 ],
718 system_modules: "core-all-system-modules",
Colin Crossec80f4f2018-08-15 21:17:11 -0700719}
720
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100721// Exports annotated stubs source files in ojluni/annotations/sdk to make them
722// available to metalava. Used for nullability annotations in OpenJDK source.
Pete Gillin7db7faa2018-07-31 13:29:35 +0100723droiddoc_exported_dir {
Pete Gillin0728b742018-09-17 15:41:45 +0100724 name: "ojluni-annotated-sdk-stubs",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100725 visibility: [
726 "//frameworks/base",
727 ],
Pete Gillin0728b742018-09-17 15:41:45 +0100728 path: "ojluni/annotations/sdk",
Pete Gillin7db7faa2018-07-31 13:29:35 +0100729}
Paul Duffin48ac7b62019-03-28 14:28:06 +0000730
Pete Gillin600c7cf2018-08-16 19:28:38 +0100731droiddoc_exported_dir {
732 name: "ojluni-annotated-nullability-stubs",
733 path: "ojluni/annotations/sdk/nullability",
734}
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100735
736// Exports annotated stubs source files in ojluni/annotations/mmodules to make
Paul Duffinc241d6a2019-06-25 15:40:29 +0100737// them available to metalava. Used for core platform API and intra-core API
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100738// annotations in OpenJDK source.
Pete Gillinc9935b62018-09-25 14:42:40 +0100739droiddoc_exported_dir {
740 name: "ojluni-annotated-mmodule-stubs",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100741 visibility: [
742 "//libcore/mmodules/core_platform_api",
743 "//libcore/mmodules/intracoreapi",
744 ],
Pete Gillinc9935b62018-09-25 14:42:40 +0100745 path: "ojluni/annotations/mmodule",
746}
Pete Gillin7db7faa2018-07-31 13:29:35 +0100747
Neil Fuller6f16b462018-09-04 15:40:39 +0100748// A file containing the list of tags that are "known" to us from the OpenJdk
749// source code and so should not cause an error or warning.
Nan Zhangd55722b2018-02-27 15:08:20 -0800750filegroup {
751 name: "known-oj-tags",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100752 visibility: [
753 "//frameworks/base",
754 ],
Nan Zhangd55722b2018-02-27 15:08:20 -0800755 srcs: [
756 "known_oj_tags.txt",
757 ],
758}
Nan Zhang602fc0e2018-03-22 16:14:22 -0700759
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100760// Generates stubs for the parts of the public SDK API provided by the core
761// library.
Paul Duffin0ca3cbe2019-02-14 15:47:58 +0000762//
763// Only for use by core.current.stubs target below.
Nan Zhangf0207602018-09-10 18:57:38 -0700764droidstubs {
765 name: "core-current-stubs-gen",
Neil Fuller866ed4a2018-09-06 12:05:46 +0100766 srcs: [":core_api_files"],
Tobias Thiererde991232018-03-07 15:10:46 +0000767 java_version: "1.9",
Nan Zhang602fc0e2018-03-22 16:14:22 -0700768 installable: false,
Paul Duffin419b2422019-06-25 15:42:05 +0100769 sdk_version: "none",
Paul Duffinc31f6bb2019-05-15 12:32:44 +0100770 args: " --exclude-annotations " +
771 "--hide-annotation libcore.api.Hide",
Neil Fullerbe9258e2018-09-24 17:11:27 +0100772 merge_inclusion_annotations_dirs: ["ojluni-annotated-mmodule-stubs"],
Nan Zhang602fc0e2018-03-22 16:14:22 -0700773}
774
Paul Duffin0ca3cbe2019-02-14 15:47:58 +0000775// A stubs target containing the parts of the public SDK API provided by the
776// core library.
777//
778// Don't use this directly, use "sdk_version: core_current".
779java_library {
780 name: "core.current.stubs",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100781 visibility: ["//visibility:public"],
Paul Duffin0ca3cbe2019-02-14 15:47:58 +0000782 srcs: [":core-current-stubs-gen"],
783 errorprone: {
784 javacflags: [
785 "-Xep:MissingOverride:OFF",
786 ],
787 },
788 openjdk9: {
789 javacflags: ["--patch-module=java.base=."],
790 },
Paul Duffin83c25382019-06-07 14:10:49 +0100791 sdk_version: "none",
Paul Duffin0ca3cbe2019-02-14 15:47:58 +0000792 system_modules: "none",
Paul Duffin65641182019-04-08 10:24:23 +0100793
794 dist: {
795 targets: [
796 "sdk",
797 "win_sdk",
798 ],
799 },
Paul Duffin0ca3cbe2019-02-14 15:47:58 +0000800}
801
Neil Fuller61dabbf2018-10-21 22:53:18 +0100802// Used when compiling higher-level code against core.current.stubs.
803java_system_modules {
804 name: "core-current-stubs-system-modules",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100805 visibility: ["//visibility:public"],
Neil Fuller61dabbf2018-10-21 22:53:18 +0100806 libs: [
807 "core.current.stubs",
808 // This one is not on device but it's needed when javac compiles code
809 // containing lambdas.
810 "core-lambda-stubs-for-system-modules",
811 // This one is not on device but it's needed when javac compiles code
812 // containing @Generated annotations produced by some code generation
813 // tools.
814 // See http://b/123891440.
815 "core-generated-annotation-stubs",
816 ],
817}
818
Pete Gillin600c7cf2018-08-16 19:28:38 +0100819// Target for validating nullability annotations for correctness and
820// completeness. To check that there are no nullability errors:
821// make core-current-stubs-nullability-validation
822// To check that there are only the expected nullability warnings:
823// make core-current-stubs-nullability-validation-check-nullability-warnings
824// To update the the list of known expected nullability warnings:
825// make core-current-stubs-nullability-validation-update-nullability-warnings
826droidstubs {
827 name: "core-current-stubs-nullability-validation",
828 srcs: [":core_api_files"],
829 installable: false,
Paul Duffin419b2422019-06-25 15:42:05 +0100830 sdk_version: "none",
Pete Gillin600c7cf2018-08-16 19:28:38 +0100831 annotations_enabled: true,
832 args: "--hide-annotation libcore.api.Hide " +
833 "--validate-nullability-from-merged-stubs ",
834 merge_inclusion_annotations_dirs: ["ojluni-annotated-mmodule-stubs"],
835 merge_annotations_dirs: [
836 "metalava-manual",
837 // N.B. Stubs in this filegroup will be validated:
838 "ojluni-annotated-nullability-stubs",
839 ],
Pete Gillinc5f179b2018-11-14 18:42:19 +0000840 // The list of classes which have nullability annotations included in the source.
841 // (This is in addition to those which have annotations in the merged stubs.)
842 validate_nullability_from_list: "nullability_annotated_classes.txt",
Pete Gillin600c7cf2018-08-16 19:28:38 +0100843 // The expected set of warnings about missing annotations:
844 check_nullability_warnings: "nullability_warnings.txt",
845}
846
Neil Fullere784ef22018-11-16 15:54:30 +0000847// A host library containing time zone related classes. Used for
848// host-side tools and tests that have to deal with Android
849// time zone data.
850java_library_host {
851 name: "timezone-host",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100852 visibility: [
853 "//system/timezone/distro/core",
854 ],
Neil Fullere784ef22018-11-16 15:54:30 +0000855 srcs: [":timezone_host_files"],
856}
Andrei Onea24892e22019-04-16 16:48:37 +0100857
858// The source files that contain the UnsupportedAppUsage annotation and its dependencies.
859filegroup {
860 name: "unsupportedappusage_annotation_files",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100861 visibility: [
862 "//frameworks/base",
863 ],
Andrei Onea24892e22019-04-16 16:48:37 +0100864 srcs: [
865 "dalvik/src/main/java/dalvik/annotation/compat/UnsupportedAppUsage.java",
866 "dalvik/src/main/java/dalvik/system/VersionCodes.java",
867 "luni/src/main/java/libcore/api/CorePlatformApi.java",
868 "luni/src/main/java/libcore/api/IntraCoreApi.java",
869 ],
Neil Fuller86345d72019-04-25 09:15:32 +0100870}