blob: 3022660276953fb91f2e6aa3ccd5ad3a87cde4ab [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
Paul Duffina38da2d2019-10-01 17:49:50 +0100128// The set of files for the core library that contribute to one or more API
129// surfaces. This includes files that are in the public API as well as those
130// that are not but which have been marked up with @hide plus one or more of
131// the API defining annotations.
Neil Fuller866ed4a2018-09-06 12:05:46 +0100132filegroup {
133 name: "core_api_files",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100134 visibility: [
135 "//libcore:__subpackages__",
136 ],
Neil Fuller866ed4a2018-09-06 12:05:46 +0100137 srcs: [
Paul Duffina38da2d2019-10-01 17:49:50 +0100138 ":art_module_api_files",
Victor Changcad47af2019-08-06 16:33:38 +0100139 ":android_icu4j_src_files",
Paul Duffina38da2d2019-10-01 17:49:50 +0100140 ":conscrypt_java_files",
141 ],
142}
143
144// The set of files for the ART module that contribute to one or more API
145// surfaces. This includes files that are in the public API as well as those
146// that are not but which have been marked up with @hide plus one or more of
147// the API defining annotations.
148//
149// Some source files in :core_oj_api_files and :openjdk_mmodule_extra_files are
150// annotated by applying annotations to the .annotated.java stubs files in
151// ojluni/annotated/mmodules and rather than in the original source. See the comments
152// in openjdk_java_files.bp for more details.
153filegroup {
154 name: "art_module_api_files",
155 visibility: [
156 "//libcore:__subpackages__",
157 ],
158 srcs: [
Neil Fullerd129bc92018-09-26 11:12:58 +0100159 ":apache-xml_api_files",
Neil Fullera77f7102018-09-21 19:04:41 +0100160 ":bouncycastle_java_files",
Neil Fuller866ed4a2018-09-06 12:05:46 +0100161 ":core_oj_api_files",
162 ":core_libart_api_files",
Neil Fuller641d5f92018-09-24 15:40:39 +0100163 ":okhttp_api_files",
Pete Gillinc9935b62018-09-25 14:42:40 +0100164 ":openjdk_mmodule_extra_files",
Neil Fuller866ed4a2018-09-06 12:05:46 +0100165 ],
166}
167
Colin Crossaf0b54c2017-09-27 17:22:32 -0700168java_defaults {
169 name: "libcore_java_defaults",
170 javacflags: [
171 //"-Xlint:all",
172 //"-Xlint:-serial,-deprecation,-unchecked",
173 ],
174 dxflags: ["--core-library"],
Andreas Gampe66b31732018-02-20 09:22:16 -0800175 errorprone: {
176 javacflags: [
Paul Duffinc31f6bb2019-05-15 12:32:44 +0100177 "-Xep:MissingOverride:OFF", // Ignore missing @Override.
178 "-Xep:ConstantOverflow:WARN", // Known constant overflow in SplittableRandom
Andreas Gampe66b31732018-02-20 09:22:16 -0800179 ],
180 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700181}
182
183//
184// Build for the target (device).
185//
186
Tobias Thierer52331642019-05-29 12:11:39 +0000187// A target used to bootstrap compilation for the core library.
Paul Duffina8173c52019-09-24 13:04:42 +0100188//
Tobias Thierer52331642019-05-29 12:11:39 +0000189// See core-all-system-modules for more details.
190java_library {
191 name: "core-all",
Tobias Thierer52331642019-05-29 12:11:39 +0000192 defaults: ["libcore_java_defaults"],
Colin Crossaf0b54c2017-09-27 17:22:32 -0700193
194 srcs: [
Victor Changcad47af2019-08-06 16:33:38 +0100195 ":android_icu4j_src_files",
Neil Fuller866ed4a2018-09-06 12:05:46 +0100196 ":core_oj_java_files",
197 ":core_libart_java_files",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700198 ":openjdk_lambda_stub_files",
Pete Gillin54035812019-05-08 15:09:39 +0100199 ":openjdk_generated_annotation_stub_files",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700200 ],
Colin Crossec80f4f2018-08-15 21:17:11 -0700201
Paul Duffin83c25382019-06-07 14:10:49 +0100202 sdk_version: "none",
Colin Crossec80f4f2018-08-15 21:17:11 -0700203 system_modules: "none",
Colin Crossa4d9fc42017-09-29 18:04:37 -0700204 openjdk9: {
205 srcs: ["luni/src/module/java/module-info.java"],
206 javacflags: ["--patch-module=java.base=."],
207 },
Colin Crossec80f4f2018-08-15 21:17:11 -0700208
Tobias Thierer79eea262019-08-01 14:05:11 +0100209 java_resources: core_resources,
Victor Chang7fef4052018-09-25 14:12:03 +0100210 static_libs: ["android_icu4j_resources_lib"],
Tobias Thiererde991232018-03-07 15:10:46 +0000211 java_version: "1.9",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700212
Colin Crossaf0b54c2017-09-27 17:22:32 -0700213 installable: false,
atrost98ec08d2019-08-05 12:23:41 +0100214
215 plugins: ["compat-changeid-annotation-processor"],
216}
217
218platform_compat_config {
219 name: "libcore-platform-compat-config",
atrost98ec08d2019-08-05 12:23:41 +0100220 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
Paul Duffin00b174e2019-09-26 16:22:17 +0100228// other parts of the core library like core-oj, core-libart, conscrypt,
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100229// bouncycastle, etc.
Colin Crossa4d9fc42017-09-29 18:04:37 -0700230java_system_modules {
231 name: "core-all-system-modules",
Paul Duffina8173c52019-09-24 13:04:42 +0100232
233 // Visibility is deliberately restricted to a small set of build modules that
234 // the core library team control.
235 visibility: [
236 "//external/apache-harmony:__subpackages__",
237 "//external/apache-xml",
Paul Duffina8173c52019-09-24 13:04:42 +0100238 "//external/icu/android_icu4j",
239 "//external/okhttp",
240 "//libcore:__subpackages__",
241 ],
242
Colin Crossa4d9fc42017-09-29 18:04:37 -0700243 libs: ["core-all"],
244}
245
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100246// Contains the parts of core library associated with OpenJDK.
Colin Crossaf0b54c2017-09-27 17:22:32 -0700247java_library {
248 name: "core-oj",
Paul Duffin48ac7b62019-03-28 14:28:06 +0000249 visibility: [
250 "//art/build/apex",
251 "//external/wycheproof",
Paul Duffin94f70232019-05-22 16:22:29 +0100252 "//libcore/benchmarks",
Paul Duffin48ac7b62019-03-28 14:28:06 +0000253 ],
Colin Crossaf0b54c2017-09-27 17:22:32 -0700254 defaults: ["libcore_java_defaults"],
Colin Cross5b75cdd2018-06-27 11:00:13 -0700255 installable: true,
Colin Crossbb180be2017-10-09 14:54:53 -0700256 hostdex: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700257
Neil Fuller866ed4a2018-09-06 12:05:46 +0100258 srcs: [":core_oj_java_files"],
Tobias Thierer79eea262019-08-01 14:05:11 +0100259 java_resources: core_resources,
Colin Crossec80f4f2018-08-15 21:17:11 -0700260
Paul Duffin83c25382019-06-07 14:10:49 +0100261 sdk_version: "none",
Colin Crossa4d9fc42017-09-29 18:04:37 -0700262 system_modules: "core-all-system-modules",
263 openjdk9: {
264 javacflags: ["--patch-module=java.base=."],
265 },
Colin Crossec80f4f2018-08-15 21:17:11 -0700266
Pete Gillin7a7a6d22017-12-19 14:56:03 +0000267 jacoco: {
Pete Gillin27ca0582018-01-10 17:04:17 +0000268 exclude_filter: [
Pete Gillin3f59bad2018-01-30 11:20:29 +0000269 "java.lang.Class",
270 "java.lang.Long",
271 "java.lang.Number",
272 "java.lang.Object",
273 "java.lang.String",
274 "java.lang.invoke.MethodHandle",
275 "java.lang.ref.Reference",
276 "java.lang.reflect.Proxy",
Pete Gillinb1868ada2018-01-17 11:03:10 +0000277 "java.util.AbstractMap",
Pete Gillin3f59bad2018-01-30 11:20:29 +0000278 "java.util.HashMap",
279 "java.util.HashMap$Node",
Pete Gillinb1868ada2018-01-17 11:03:10 +0000280 "java.util.Map",
Pete Gillin7a7a6d22017-12-19 14:56:03 +0000281 ],
282 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700283
284 notice: "ojluni/NOTICE",
285
Colin Crossaf0b54c2017-09-27 17:22:32 -0700286}
287
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100288// Contains parts of core library not associated with OpenJDK. Contains not
Victor Changcad47af2019-08-06 16:33:38 +0100289// just java.*, javax.* code but also android.system.* and various internal
290// libcore.* packages.
Colin Crossaf0b54c2017-09-27 17:22:32 -0700291java_library {
292 name: "core-libart",
Paul Duffin48ac7b62019-03-28 14:28:06 +0000293 visibility: [
294 "//art/build/apex",
295 "//external/robolectric-shadows",
296 "//external/wycheproof",
Paul Duffin94f70232019-05-22 16:22:29 +0100297 "//libcore/benchmarks",
Colin Crossf0ef6252019-05-31 08:26:47 -0700298 "//frameworks/layoutlib",
Paul Duffin48ac7b62019-03-28 14:28:06 +0000299 ],
Colin Crossaf0b54c2017-09-27 17:22:32 -0700300 defaults: ["libcore_java_defaults"],
Colin Cross5b75cdd2018-06-27 11:00:13 -0700301 installable: true,
Colin Crossbb180be2017-10-09 14:54:53 -0700302 hostdex: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700303
Neil Fuller866ed4a2018-09-06 12:05:46 +0100304 srcs: [":core_libart_java_files"],
Tobias Thiererde991232018-03-07 15:10:46 +0000305 java_version: "1.9",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700306
Paul Duffin83c25382019-06-07 14:10:49 +0100307 sdk_version: "none",
Colin Crossa4d9fc42017-09-29 18:04:37 -0700308 system_modules: "core-all-system-modules",
309 openjdk9: {
310 javacflags: ["--patch-module=java.base=."],
311 },
Colin Crossec80f4f2018-08-15 21:17:11 -0700312
Pete Gillin80ebe872018-02-13 15:21:20 +0000313 jacoco: {
314 exclude_filter: [
315 "java.lang.DexCache",
316 "dalvik.system.ClassExt",
317 ],
318 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700319
Andreas Gampe9a1ba892019-04-24 12:35:40 -0700320 target: {
321 hostdex: {
322 required: [
Neil Fuller53c5f032019-06-05 13:47:39 +0100323 // Files used to simulate the /system, runtime APEX and tzdata
324 // APEX dir structure on host.
325 "icu_tzdata.dat_host_tzdata_apex",
Andreas Gampe9a1ba892019-04-24 12:35:40 -0700326 "tzdata_host",
Neil Fuller53c5f032019-06-05 13:47:39 +0100327 "tzdata_host_tzdata_apex",
Neil Fuller53c5f032019-06-05 13:47:39 +0100328 "tzlookup.xml_host_tzdata_apex",
Andreas Gampe9a1ba892019-04-24 12:35:40 -0700329 "tz_version_host",
Neil Fuller53c5f032019-06-05 13:47:39 +0100330 "tz_version_host_tzdata_apex",
Andreas Gampe9a1ba892019-04-24 12:35:40 -0700331 ],
332 },
333 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700334}
335
Paul Duffin7bb8d232018-10-23 11:48:38 +0100336// Provided solely to contribute information about which hidden parts of the
337// core-oj API are used by apps.
Paul Duffinc6bf27b2019-05-15 14:41:00 +0100338//
339// The build system determines that this library provides hiddenapi information
340// for the core-oj bootjar because its name is of the form <x>-hiddenapi, where
341// <x> is the name of a boot jar. That triggers the generation of a flags.csv
342// file which encapsulates information extracted from the UnsupportedAppUsage
343// annotations in the dex. The information from that file is then encoded into
344// the core-oj file.
345//
346// Usually, e.g. for core-libart, the UnsupportedAppUsage annotations are
347// added to the source that is compiled directly into the bootjar and the build
348// system extracts the information about UnsupportedAppUsage directly from
349// there.
350//
351// This approach of having separate annotated source and a separate build
352// target was taken for ojluni to avoid having to maintain local patches in the
353// ojluni source for UnsupportedAppUsage annotations as that would make it more
354// difficult to pull down changes from upstream.
355//
Paul Duffin7bb8d232018-10-23 11:48:38 +0100356java_library {
357 name: "core-oj-hiddenapi",
Paul Duffin48ac7b62019-03-28 14:28:06 +0000358 // Do not allow this to be accessed from outside this directory.
359 visibility: ["//visibility:private"],
Paul Duffin7bb8d232018-10-23 11:48:38 +0100360 defaults: ["libcore_java_defaults"],
361 compile_dex: true,
362
363 srcs: [":openjdk_hiddenapi_javadoc_files"],
364
Paul Duffin83c25382019-06-07 14:10:49 +0100365 sdk_version: "none",
Paul Duffin7bb8d232018-10-23 11:48:38 +0100366 system_modules: "core-all-system-modules",
367 openjdk9: {
368 javacflags: ["--patch-module=java.base=."],
369 },
370}
371
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100372//
Paul Duffin00b174e2019-09-26 16:22:17 +0100373// Guaranteed unstripped versions of core-oj and core-libart.
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100374//
Colin Cross3c6c2e22017-10-18 13:24:52 -0700375// The build system may or may not strip the core-oj and core-libart jars,
376// but these will not be stripped. See b/24535627.
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100377//
378
Colin Cross3c6c2e22017-10-18 13:24:52 -0700379java_library {
380 name: "core-oj-testdex",
Colin Cross5b75cdd2018-06-27 11:00:13 -0700381 installable: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700382 static_libs: ["core-oj"],
Paul Duffin83c25382019-06-07 14:10:49 +0100383 sdk_version: "none",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700384 system_modules: "core-all-system-modules",
385 dxflags: ["--core-library"],
Colin Cross485ed362017-12-05 17:24:22 -0800386 dex_preopt: {
387 enabled: false,
388 },
Tobias Thiererde991232018-03-07 15:10:46 +0000389 java_version: "1.9",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700390 notice: "ojluni/NOTICE",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700391}
392
393java_library {
394 name: "core-libart-testdex",
Colin Cross5b75cdd2018-06-27 11:00:13 -0700395 installable: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700396 static_libs: ["core-libart"],
Paul Duffin83c25382019-06-07 14:10:49 +0100397 sdk_version: "none",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700398 system_modules: "core-all-system-modules",
399 dxflags: ["--core-library"],
Colin Cross485ed362017-12-05 17:24:22 -0800400 dex_preopt: {
401 enabled: false,
402 },
Colin Cross3c6c2e22017-10-18 13:24:52 -0700403 notice: "ojluni/NOTICE",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700404}
405
Tobias Thierere0f8b312018-10-23 23:12:30 +0100406java_defaults {
407 name: "core_lambda_stubs_defaults",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700408 defaults: ["libcore_java_defaults"],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100409 hostdex: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700410
Paul Duffin83c25382019-06-07 14:10:49 +0100411 sdk_version: "none",
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 system_modules: "core-all-system-modules",
467 openjdk9: {
468 javacflags: ["--patch-module=java.base=."],
469 },
470 notice: "ojluni/NOTICE",
471 installable: false,
472 include_srcs: true,
473}
474
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100475// Builds libcore test rules
Colin Cross3c6c2e22017-10-18 13:24:52 -0700476java_library_static {
477 name: "core-test-rules",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100478 visibility: [
Paul Duffin01f6c022019-09-24 14:44:15 +0100479 "//external/conscrypt",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100480 "//frameworks/base/location/tests/locationtests",
481 ],
Colin Cross3c6c2e22017-10-18 13:24:52 -0700482 hostdex: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700483 srcs: [
484 "dalvik/test-rules/src/main/**/*.java",
485 "test-rules/src/main/**/*.java",
486 ],
487 static_libs: ["junit"],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100488
Paul Duffin83c25382019-06-07 14:10:49 +0100489 sdk_version: "none",
Neil Fuller4207c7f2018-10-10 14:01:40 +0100490 system_modules: "core-all-system-modules",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700491}
492
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100493// Builds the core-tests-support library used by various tests.
Colin Cross3c6c2e22017-10-18 13:24:52 -0700494java_library_static {
495 name: "core-tests-support",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100496 visibility: [
497 "//cts/apps/CtsVerifier",
498 "//cts/tests/tests/keystore",
499 "//cts/tests/tests/net",
500 "//cts/tests/tests/net/api23Test",
501 "//external/apache-harmony",
502 "//frameworks/base/core/tests/coretests",
503 "//libcore/benchmarks",
504 "//packages/apps/KeyChain/tests",
505 "//system/timezone/distro/core",
506 ],
Colin Cross3c6c2e22017-10-18 13:24:52 -0700507 hostdex: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700508 srcs: ["support/src/test/java/**/*.java"],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100509
Paul Duffin53c491f2019-06-12 13:48:14 +0100510 sdk_version: "core_platform",
Neil Fuller4380ab22018-10-18 19:38:53 +0100511 libs: ["junit"],
Colin Cross3c6c2e22017-10-18 13:24:52 -0700512 static_libs: [
Neil Fullerde8b0862018-10-12 21:53:31 +0100513 "bouncycastle-unbundled",
514 "bouncycastle-bcpkix-unbundled",
515 "bouncycastle-ocsp-unbundled",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700516 ],
517}
518
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100519// Builds the jsr166-tests library.
Colin Crossec80f4f2018-08-15 21:17:11 -0700520java_test {
Colin Cross3c6c2e22017-10-18 13:24:52 -0700521 name: "jsr166-tests",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100522 visibility: [
523 "//cts/tests/libcore/jsr166",
524 ],
Colin Cross3c6c2e22017-10-18 13:24:52 -0700525 srcs: ["jsr166-tests/src/test/java/**/*.java"],
Paul Duffin83c25382019-06-07 14:10:49 +0100526 sdk_version: "none",
Paul Duffin0e0f8c42019-09-20 14:49:55 +0100527 system_modules: "core-all-system-modules",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700528 libs: [
529 "junit",
530 ],
531}
Nan Zhang65f27a32018-01-05 10:41:46 -0800532
Pete Gillinec902b82019-06-26 17:23:00 +0100533// A filegroup that provides access to a source file for a toolchain test that
534// checks Java 9 language features are handled properly by JarJar.
535filegroup {
536 name: "core-java-9-language-features-source",
537 srcs: ["luni/src/main/java/libcore/internal/Java9LanguageFeatures.java"],
538 visibility: ["//libcore/luni/src/test/java9language"],
539}
540
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100541// Builds the core-tests library.
Colin Crossec80f4f2018-08-15 21:17:11 -0700542java_test {
543 name: "core-tests",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100544 visibility: [
545 "//cts/tests/libcore/luni",
546 ],
Colin Crossec80f4f2018-08-15 21:17:11 -0700547 defaults: ["libcore_java_defaults"],
548 hostdex: true,
549 srcs: [
550 "dalvik/src/test/java/**/*.java",
551 "dalvik/test-rules/src/test/java/**/*.java",
552 "dom/src/test/java/**/*.java",
553 "harmony-tests/src/test/java/**/*.java",
554 "json/src/test/java/**/*.java",
555 "luni/src/test/java/**/*.java",
Paul Duffin4ba14532019-03-21 10:32:41 +0000556 "test-rules/src/test/java/**/*.java",
Colin Crossec80f4f2018-08-15 21:17:11 -0700557 "xml/src/test/java/**/*.java",
558 ],
559 exclude_srcs: [
560 "luni/src/test/java/libcore/java/util/zip/Zip64Test.java",
561 "luni/src/test/java/libcore/java/util/zip/Zip64FileTest.java",
562 ],
563
564 java_resource_dirs: [
565 "*/src/test/java",
566 "*/src/test/resources",
567 ],
568 exclude_java_resource_dirs: [
569 "ojluni/src/test/java",
570 "ojluni/src/test/resources",
571 ],
572
573 java_resources: [
Paul Duffin16a057f2019-05-13 12:20:55 +0100574 ":annotations-test",
Colin Crossec80f4f2018-08-15 21:17:11 -0700575 ":filesystemstest",
576 ":parameter-metadata-test",
577 ],
578
Paul Duffin83c25382019-06-07 14:10:49 +0100579 sdk_version: "none",
Paul Duffin0e0f8c42019-09-20 14:49:55 +0100580 system_modules: "core-all-system-modules",
Neil Fuller4207c7f2018-10-10 14:01:40 +0100581 libs: [
Neil Fuller4207c7f2018-10-10 14:01:40 +0100582 "okhttp",
583 "bouncycastle",
584 ],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100585
Colin Crossec80f4f2018-08-15 21:17:11 -0700586 static_libs: [
587 "archive-patcher",
Pete Gillin05a43202019-06-27 14:41:21 +0100588 "core-java-9-language-tests",
Colin Crossec80f4f2018-08-15 21:17:11 -0700589 "core-test-rules",
590 "core-tests-support",
591 "junit-params",
592 "mockftpserver",
593 "mockito-target",
594 "mockwebserver",
595 "nist-pkix-tests",
596 "slf4j-jdk14",
597 "sqlite-jdbc",
598 "tzdata-testing",
Paul Duffina4df2372018-12-10 15:48:01 +0000599 "truth-prebuilt",
Colin Crossec80f4f2018-08-15 21:17:11 -0700600 ],
601
602 errorprone: {
603 javacflags: [
604 "-Xep:TryFailThrowable:ERROR",
605 "-Xep:ComparisonOutOfRange:ERROR",
606 ],
607 },
Simran Basi3be01e02018-08-21 17:53:49 -0700608
609 test_config: "AndroidTest-core-tests.xml",
Colin Crossec80f4f2018-08-15 21:17:11 -0700610}
611
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100612// Builds the core-ojtests library that contains test code from OpenJDK.
Colin Crossec80f4f2018-08-15 21:17:11 -0700613java_test {
614 name: "core-ojtests",
615 defaults: ["libcore_java_defaults"],
616 hostdex: true,
617
618 srcs: [
619 "ojluni/src/test/java/**/*.java",
620 ],
621 java_resource_dirs: [
622 "ojluni/src/test/java",
623 "ojluni/src/test/resources",
624 ],
Neil Fullerb669ccb2018-10-04 23:10:27 +0100625
Paul Duffin83c25382019-06-07 14:10:49 +0100626 sdk_version: "none",
Paul Duffin0e0f8c42019-09-20 14:49:55 +0100627 system_modules: "core-all-system-modules",
Neil Fuller4207c7f2018-10-10 14:01:40 +0100628 libs: [
Neil Fuller4207c7f2018-10-10 14:01:40 +0100629 "okhttp",
630 "bouncycastle",
631 ],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100632
Colin Crossec80f4f2018-08-15 21:17:11 -0700633 static_libs: ["testng"],
634
635 // ojluni/src/test/java/util/stream/{bootlib,boottest}
636 // contains tests that are in packages from java.base;
637 // By default, OpenJDK 9's javac will only compile such
638 // code if it's declared to also be in java.base at
639 // compile time.
640 //
641 // For now, we use --patch-module to put all sources
642 // and dependencies from this make target into java.base;
643 // other source directories in this make target are in
644 // packages not from java.base; if this becomes a problem
645 // in future, this could be addressed eg. by splitting
646 // boot{lib,test} out into a separate make target,
647 // deleting those tests or moving them to a different
648 // package.
649 patch_module: "java.base",
650}
651
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100652// Builds the core-ojtests-public library. Excludes any private API tests.
653// Like core-ojtests but smaller.
Colin Crossec80f4f2018-08-15 21:17:11 -0700654java_test {
655 name: "core-ojtests-public",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100656 visibility: [
657 "//cts/tests/libcore/ojluni",
658 ],
Colin Crossec80f4f2018-08-15 21:17:11 -0700659 defaults: ["libcore_java_defaults"],
660 srcs: [
661 "ojluni/src/test/java/**/*.java",
662 ],
663 // Filter out the following:
664 // 1.) DeserializeMethodTest and SerializedLambdaTest, because they depends on stub classes
665 // and won't actually run, and
666 // 2.) util/stream/boot*. Those directories contain classes in the package java.util.stream;
667 // excluding them means we don't need patch_module: "java.base"
668 exclude_srcs: [
669 "**/DeserializeMethodTest.java",
670 "**/SerializedLambdaTest.java",
671 "ojluni/src/test/java/util/stream/boot*/**/*",
672 ],
673 java_resource_dirs: [
674 "ojluni/src/test/java",
675 "ojluni/src/test/resources",
676 // Include source code as part of JAR
677 "ojluni/src/test/dist",
678 ],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100679
Paul Duffin83c25382019-06-07 14:10:49 +0100680 sdk_version: "none",
Paul Duffin0e0f8c42019-09-20 14:49:55 +0100681 system_modules: "core-all-system-modules",
Neil Fuller4207c7f2018-10-10 14:01:40 +0100682 libs: [
Neil Fuller4207c7f2018-10-10 14:01:40 +0100683 "bouncycastle",
684 "okhttp",
685 "testng",
686 ],
Colin Crossec80f4f2018-08-15 21:17:11 -0700687}
688
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100689// Exports annotated stubs source files in ojluni/annotations/sdk to make them
690// available to metalava. Used for nullability annotations in OpenJDK source.
Pete Gillin7db7faa2018-07-31 13:29:35 +0100691droiddoc_exported_dir {
Pete Gillin0728b742018-09-17 15:41:45 +0100692 name: "ojluni-annotated-sdk-stubs",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100693 visibility: [
694 "//frameworks/base",
695 ],
Pete Gillin0728b742018-09-17 15:41:45 +0100696 path: "ojluni/annotations/sdk",
Pete Gillin7db7faa2018-07-31 13:29:35 +0100697}
Paul Duffin48ac7b62019-03-28 14:28:06 +0000698
Pete Gillin600c7cf2018-08-16 19:28:38 +0100699droiddoc_exported_dir {
700 name: "ojluni-annotated-nullability-stubs",
701 path: "ojluni/annotations/sdk/nullability",
702}
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100703
704// Exports annotated stubs source files in ojluni/annotations/mmodules to make
Paul Duffinc241d6a2019-06-25 15:40:29 +0100705// them available to metalava. Used for core platform API and intra-core API
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100706// annotations in OpenJDK source.
Pete Gillinc9935b62018-09-25 14:42:40 +0100707droiddoc_exported_dir {
708 name: "ojluni-annotated-mmodule-stubs",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100709 visibility: [
710 "//libcore/mmodules/core_platform_api",
711 "//libcore/mmodules/intracoreapi",
712 ],
Pete Gillinc9935b62018-09-25 14:42:40 +0100713 path: "ojluni/annotations/mmodule",
714}
Pete Gillin7db7faa2018-07-31 13:29:35 +0100715
Neil Fuller6f16b462018-09-04 15:40:39 +0100716// A file containing the list of tags that are "known" to us from the OpenJdk
717// source code and so should not cause an error or warning.
Nan Zhangd55722b2018-02-27 15:08:20 -0800718filegroup {
719 name: "known-oj-tags",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100720 visibility: [
721 "//frameworks/base",
722 ],
Nan Zhangd55722b2018-02-27 15:08:20 -0800723 srcs: [
724 "known_oj_tags.txt",
725 ],
726}
Nan Zhang602fc0e2018-03-22 16:14:22 -0700727
Paul Duffina8bb6062019-09-25 15:50:13 +0100728// Generates stubs for the parts of the public SDK API provided by the ART module.
Paul Duffin0ca3cbe2019-02-14 15:47:58 +0000729//
Paul Duffina8bb6062019-09-25 15:50:13 +0100730// Only for use by art.module.public.api.stubs target below.
Nan Zhangf0207602018-09-10 18:57:38 -0700731droidstubs {
Paul Duffina8bb6062019-09-25 15:50:13 +0100732 name: "art-module-public-api-stubs-gen",
Paul Duffin53690cb2019-09-19 15:11:28 +0100733 srcs: [
Paul Duffina8bb6062019-09-25 15:50:13 +0100734 ":core_oj_api_files",
735 ":core_libart_api_files",
Paul Duffin53690cb2019-09-19 15:11:28 +0100736 ],
Tobias Thiererde991232018-03-07 15:10:46 +0000737 java_version: "1.9",
Nan Zhang602fc0e2018-03-22 16:14:22 -0700738 installable: false,
Paul Duffin419b2422019-06-25 15:42:05 +0100739 sdk_version: "none",
Nan Zhang602fc0e2018-03-22 16:14:22 -0700740}
741
Paul Duffina8bb6062019-09-25 15:50:13 +0100742// A stubs target containing the parts of the public SDK API provided by the ART module.
743java_library {
744 name: "art.module.public.api.stubs",
Paul Duffin00b174e2019-09-26 16:22:17 +0100745 visibility: [
Paul Duffinba71f832019-09-27 14:54:23 +0100746 "//external/conscrypt",
Paul Duffin00b174e2019-09-26 16:22:17 +0100747 "//external/icu/android_icu4j",
748 ],
Paul Duffina8bb6062019-09-25 15:50:13 +0100749 srcs: [":art-module-public-api-stubs-gen"],
750 errorprone: {
751 javacflags: [
752 "-Xep:MissingOverride:OFF",
753 ],
754 },
755 openjdk9: {
756 javacflags: ["--patch-module=java.base=."],
757 },
758 sdk_version: "none",
759 system_modules: "none",
760}
761
762// Used when compiling higher-level code against art.module.public.api.stubs.
Paul Duffinf545bc72019-10-02 14:07:04 +0100763//
764// This is only intended for use within core libraries and must not be used
765// from outside.
Paul Duffina8bb6062019-09-25 15:50:13 +0100766java_system_modules {
767 name: "art-module-public-api-stubs-system-modules",
768 visibility: [
Paul Duffinba71f832019-09-27 14:54:23 +0100769 "//external/conscrypt",
Paul Duffin00b174e2019-09-26 16:22:17 +0100770 "//external/icu/android_icu4j",
Paul Duffina8bb6062019-09-25 15:50:13 +0100771 "//external/wycheproof",
772 ],
773 libs: [
774 "art.module.public.api.stubs",
775 // This one is not on device but it's needed when javac compiles code
776 // containing lambdas.
777 "core-lambda-stubs-for-system-modules",
778 // This one is not on device but it's needed when javac compiles code
779 // containing @Generated annotations produced by some code generation
780 // tools.
781 // See http://b/123891440.
782 "core-generated-annotation-stubs",
Paul Duffinf545bc72019-10-02 14:07:04 +0100783
784 // Ensure that core libraries that depend on the public API can access
785 // the UnsupportedAppUsage, CorePlatformApi and IntraCoreApi
786 // annotations.
787 "libcore-unsupportedappusage-annotation",
Paul Duffina8bb6062019-09-25 15:50:13 +0100788 ],
789}
790
Paul Duffin0ca3cbe2019-02-14 15:47:58 +0000791// A stubs target containing the parts of the public SDK API provided by the
792// core library.
793//
794// Don't use this directly, use "sdk_version: core_current".
795java_library {
796 name: "core.current.stubs",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100797 visibility: ["//visibility:public"],
Paul Duffina8bb6062019-09-25 15:50:13 +0100798 static_libs: [
799 "art.module.public.api.stubs",
800 "conscrypt.module.public.api.stubs",
801 "i18n.module.public.api.stubs",
802 ],
Paul Duffin83c25382019-06-07 14:10:49 +0100803 sdk_version: "none",
Paul Duffin0ca3cbe2019-02-14 15:47:58 +0000804 system_modules: "none",
Paul Duffin65641182019-04-08 10:24:23 +0100805
806 dist: {
807 targets: [
808 "sdk",
809 "win_sdk",
810 ],
811 },
Paul Duffin0ca3cbe2019-02-14 15:47:58 +0000812}
813
Neil Fuller61dabbf2018-10-21 22:53:18 +0100814// Used when compiling higher-level code against core.current.stubs.
815java_system_modules {
816 name: "core-current-stubs-system-modules",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100817 visibility: ["//visibility:public"],
Neil Fuller61dabbf2018-10-21 22:53:18 +0100818 libs: [
819 "core.current.stubs",
820 // This one is not on device but it's needed when javac compiles code
821 // containing lambdas.
822 "core-lambda-stubs-for-system-modules",
823 // This one is not on device but it's needed when javac compiles code
824 // containing @Generated annotations produced by some code generation
825 // tools.
826 // See http://b/123891440.
827 "core-generated-annotation-stubs",
828 ],
829}
830
Pete Gillin600c7cf2018-08-16 19:28:38 +0100831// Target for validating nullability annotations for correctness and
832// completeness. To check that there are no nullability errors:
Paul Duffinbfbfb672019-10-03 17:53:32 +0100833// m art-module-public-api-stubs-nullability-validation
Pete Gillin600c7cf2018-08-16 19:28:38 +0100834// To check that there are only the expected nullability warnings:
Paul Duffinbfbfb672019-10-03 17:53:32 +0100835// m art-module-public-api-stubs-nullability-validation-check-nullability-warnings
Pete Gillin600c7cf2018-08-16 19:28:38 +0100836// To update the the list of known expected nullability warnings:
Paul Duffinbfbfb672019-10-03 17:53:32 +0100837// m art-module-public-api-stubs-nullability-validation-update-nullability-warnings
Pete Gillin600c7cf2018-08-16 19:28:38 +0100838droidstubs {
Paul Duffinbfbfb672019-10-03 17:53:32 +0100839 name: "art-module-public-api-stubs-nullability-validation",
840 srcs: [":art_module_api_files"],
Pete Gillin600c7cf2018-08-16 19:28:38 +0100841 installable: false,
Paul Duffin419b2422019-06-25 15:42:05 +0100842 sdk_version: "none",
Pete Gillin600c7cf2018-08-16 19:28:38 +0100843 annotations_enabled: true,
844 args: "--hide-annotation libcore.api.Hide " +
845 "--validate-nullability-from-merged-stubs ",
846 merge_inclusion_annotations_dirs: ["ojluni-annotated-mmodule-stubs"],
847 merge_annotations_dirs: [
848 "metalava-manual",
849 // N.B. Stubs in this filegroup will be validated:
850 "ojluni-annotated-nullability-stubs",
851 ],
Pete Gillinc5f179b2018-11-14 18:42:19 +0000852 // The list of classes which have nullability annotations included in the source.
853 // (This is in addition to those which have annotations in the merged stubs.)
854 validate_nullability_from_list: "nullability_annotated_classes.txt",
Pete Gillin600c7cf2018-08-16 19:28:38 +0100855 // The expected set of warnings about missing annotations:
856 check_nullability_warnings: "nullability_warnings.txt",
857}
858
Neil Fullere784ef22018-11-16 15:54:30 +0000859// A host library containing time zone related classes. Used for
860// host-side tools and tests that have to deal with Android
861// time zone data.
862java_library_host {
863 name: "timezone-host",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100864 visibility: [
865 "//system/timezone/distro/core",
866 ],
Neil Fullere784ef22018-11-16 15:54:30 +0000867 srcs: [":timezone_host_files"],
868}
Andrei Onea24892e22019-04-16 16:48:37 +0100869
Victor Changb28d3f82019-08-09 16:24:46 +0100870// A library that contains annotations not retented in runtime and inline-able constants
871// that should not introduce any runtime dependency for compiling core libraries, e.g. core-icu4j,
872java_library {
873 name: "libcore-unsupportedappusage-annotation",
874 srcs: [
875 ":unsupportedappusage_annotation_files",
876 ],
877
878 installable: false,
Paul Duffinf545bc72019-10-02 14:07:04 +0100879 sdk_version: "none",
880 system_modules: "none",
881 libs: [
882 "art.module.public.api.stubs",
883 ],
Victor Changb28d3f82019-08-09 16:24:46 +0100884}
885
Andrei Onea24892e22019-04-16 16:48:37 +0100886// The source files that contain the UnsupportedAppUsage annotation and its dependencies.
887filegroup {
888 name: "unsupportedappusage_annotation_files",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100889 visibility: [
890 "//frameworks/base",
891 ],
Andrei Onea24892e22019-04-16 16:48:37 +0100892 srcs: [
893 "dalvik/src/main/java/dalvik/annotation/compat/UnsupportedAppUsage.java",
894 "dalvik/src/main/java/dalvik/system/VersionCodes.java",
895 "luni/src/main/java/libcore/api/CorePlatformApi.java",
896 "luni/src/main/java/libcore/api/IntraCoreApi.java",
897 ],
Neil Fuller86345d72019-04-25 09:15:32 +0100898}