blob: 968072b81086d63429bb61f3d41c56e10b37c8dd [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.
48core_resource_dirs = [
49 "luni/src/main/java",
50 "ojluni/src/main/resources/",
51]
52
Neil Fuller866ed4a2018-09-06 12:05:46 +010053// The source files that go into core-oj.
54filegroup {
55 name: "core_oj_java_files",
56 srcs: [":openjdk_java_files"],
57}
58
59// OpenJDK source is not annotated with @hide so we need a separate
60// filegroup for just the parts that contribute to the API.
61filegroup {
62 name: "core_oj_api_files",
63 srcs: [":openjdk_javadoc_files"],
64}
65
66// The source files that go into core-libart.
67filegroup {
68 name: "core_libart_java_files",
69 srcs: [
70 ":non_openjdk_java_files",
71 ":android_icu4j_src_files",
72 ],
73}
74
75// Some parts of libart are not annotated with @hide so we need a separate
76// filegroup for just the parts that contribute to the API.
77filegroup {
78 name: "core_libart_api_files",
79 srcs: [
80 ":non_openjdk_javadoc_files",
81 ":android_icu4j_src_files",
82 ],
83}
84
Neil Fuller77e3f3b2018-10-19 10:22:32 +010085// The set of files for the core library that have been marked up with @hide and
86// API-related annotations. Note that this includes the intra-core and
87// core-platform APIs as well as the public APIs.
88//
89// Some source files in :openjdk_mmodule_extra_files are annotated by applying
90// annotations to the .annotated.java stubs files in ojluni/annotated/mmodules
91// and rather than in the original source. See the comments in
92// openjdk_java_files.bp for more details.
Neil Fuller866ed4a2018-09-06 12:05:46 +010093filegroup {
94 name: "core_api_files",
95 srcs: [
Neil Fullerd129bc92018-09-26 11:12:58 +010096 ":apache-xml_api_files",
Neil Fullera77f7102018-09-21 19:04:41 +010097 ":bouncycastle_java_files",
Neil Fuller603e1a72018-09-25 11:55:41 +010098 ":conscrypt_java_files",
Neil Fuller866ed4a2018-09-06 12:05:46 +010099 ":core_oj_api_files",
100 ":core_libart_api_files",
Neil Fuller641d5f92018-09-24 15:40:39 +0100101 ":okhttp_api_files",
Pete Gillinc9935b62018-09-25 14:42:40 +0100102 ":openjdk_mmodule_extra_files",
Neil Fuller866ed4a2018-09-06 12:05:46 +0100103 ],
104}
105
Colin Crossaf0b54c2017-09-27 17:22:32 -0700106java_defaults {
107 name: "libcore_java_defaults",
108 javacflags: [
109 //"-Xlint:all",
110 //"-Xlint:-serial,-deprecation,-unchecked",
111 ],
112 dxflags: ["--core-library"],
Andreas Gampe66b31732018-02-20 09:22:16 -0800113 errorprone: {
114 javacflags: [
115 "-Xep:MissingOverride:OFF", // Ignore missing @Override.
Andreas Gampe24a20172018-06-13 11:28:45 -0700116 "-Xep:ConstantOverflow:WARN", // Known constant overflow in SplittableRandom
Andreas Gampe66b31732018-02-20 09:22:16 -0800117 ],
118 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700119}
120
121//
122// Build for the target (device).
123//
124
Victor Chang7fef4052018-09-25 14:12:03 +0100125// Rule generating resource lib for android_icu4j.
126// In the downstream branch master-icu-dev, the resource files are generated.
127// This rule can't be moved external/icu because soong enforces that no_standard_libs:true can only
128// be used in libcore/ or development/
129java_library {
130 name: "android_icu4j_resources_lib",
131 java_resources: [":android_icu4j_resources"],
132 no_standard_libs: true,
133 system_modules: "none",
134}
135
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100136// A target used to bootstrap compilation for the core library.
137// See core-all-system-modules for more details.
Colin Crossaf0b54c2017-09-27 17:22:32 -0700138java_library {
139 name: "core-all",
140 defaults: ["libcore_java_defaults"],
141
142 srcs: [
Neil Fuller866ed4a2018-09-06 12:05:46 +0100143 ":core_oj_java_files",
144 ":core_libart_java_files",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700145 ":openjdk_lambda_stub_files",
146 ],
Colin Crossec80f4f2018-08-15 21:17:11 -0700147
148 no_standard_libs: true,
149 system_modules: "none",
Colin Crossa4d9fc42017-09-29 18:04:37 -0700150 openjdk9: {
151 srcs: ["luni/src/module/java/module-info.java"],
152 javacflags: ["--patch-module=java.base=."],
153 },
Colin Crossec80f4f2018-08-15 21:17:11 -0700154
Colin Crossaf0b54c2017-09-27 17:22:32 -0700155 java_resource_dirs: core_resource_dirs,
Victor Chang7fef4052018-09-25 14:12:03 +0100156 static_libs: ["android_icu4j_resources_lib"],
Tobias Thiererde991232018-03-07 15:10:46 +0000157 java_version: "1.9",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700158
Colin Crossaf0b54c2017-09-27 17:22:32 -0700159 installable: false,
160}
161
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100162// A system modules definition for use by core library targets only. It only
163// contains the core-all jar, which contains the classes that end up in core-oj,
164// core-libart as well as the lambda stubs needed to compile Java lambda code.
165// It does not contain other parts of core library like conscrypt, bouncycastle,
166// etc. This system_modules definition is used to bootstrap compilation for
167// other parts of the core library like core-oj, core-libart, conscrypt,
168// bouncycastle, etc.
169//
170// If you want to compile against the entire core library implementation, for
171// example to build core library tests, see "core-system-modules" instead.
Colin Crossa4d9fc42017-09-29 18:04:37 -0700172java_system_modules {
173 name: "core-all-system-modules",
174 libs: ["core-all"],
175}
176
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100177// Contains the parts of core library associated with OpenJDK.
Colin Crossaf0b54c2017-09-27 17:22:32 -0700178java_library {
179 name: "core-oj",
180 defaults: ["libcore_java_defaults"],
Colin Cross5b75cdd2018-06-27 11:00:13 -0700181 installable: true,
Colin Crossbb180be2017-10-09 14:54:53 -0700182 hostdex: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700183
Neil Fuller866ed4a2018-09-06 12:05:46 +0100184 srcs: [":core_oj_java_files"],
Colin Crossaf0b54c2017-09-27 17:22:32 -0700185 java_resource_dirs: core_resource_dirs,
Colin Crossec80f4f2018-08-15 21:17:11 -0700186
187 no_standard_libs: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700188 libs: ["core-all"],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700189 system_modules: "core-all-system-modules",
190 openjdk9: {
191 javacflags: ["--patch-module=java.base=."],
192 },
Colin Crossec80f4f2018-08-15 21:17:11 -0700193
Pete Gillin7a7a6d22017-12-19 14:56:03 +0000194 jacoco: {
Pete Gillin27ca0582018-01-10 17:04:17 +0000195 exclude_filter: [
Pete Gillin3f59bad2018-01-30 11:20:29 +0000196 "java.lang.Class",
197 "java.lang.Long",
198 "java.lang.Number",
199 "java.lang.Object",
200 "java.lang.String",
201 "java.lang.invoke.MethodHandle",
202 "java.lang.ref.Reference",
203 "java.lang.reflect.Proxy",
Pete Gillinb1868ada2018-01-17 11:03:10 +0000204 "java.util.AbstractMap",
Pete Gillin3f59bad2018-01-30 11:20:29 +0000205 "java.util.HashMap",
206 "java.util.HashMap$Node",
Pete Gillinb1868ada2018-01-17 11:03:10 +0000207 "java.util.Map",
Pete Gillin7a7a6d22017-12-19 14:56:03 +0000208 ],
209 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700210
211 notice: "ojluni/NOTICE",
212
Colin Crossaf0b54c2017-09-27 17:22:32 -0700213}
214
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100215// Contains parts of core library not associated with OpenJDK. Contains not
216// just java.*, javax.* code but also android.icu.*, android.system.* and
217// various internal libcore.* packages.
Colin Crossaf0b54c2017-09-27 17:22:32 -0700218java_library {
219 name: "core-libart",
220 defaults: ["libcore_java_defaults"],
Colin Cross5b75cdd2018-06-27 11:00:13 -0700221 installable: true,
Colin Crossbb180be2017-10-09 14:54:53 -0700222 hostdex: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700223
Neil Fuller866ed4a2018-09-06 12:05:46 +0100224 srcs: [":core_libart_java_files"],
Victor Chang7fef4052018-09-25 14:12:03 +0100225 static_libs: ["android_icu4j_resources_lib"],
Tobias Thiererde991232018-03-07 15:10:46 +0000226 java_version: "1.9",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700227
Colin Crossec80f4f2018-08-15 21:17:11 -0700228 no_standard_libs: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700229 libs: ["core-all"],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700230 system_modules: "core-all-system-modules",
231 openjdk9: {
232 javacflags: ["--patch-module=java.base=."],
233 },
Colin Crossec80f4f2018-08-15 21:17:11 -0700234
Pete Gillin80ebe872018-02-13 15:21:20 +0000235 jacoco: {
236 exclude_filter: [
237 "java.lang.DexCache",
238 "dalvik.system.ClassExt",
239 ],
240 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700241
242 required: [
Neil Fuller3b8c0552018-12-14 22:19:07 +0000243 // Device files put in /system.
Colin Crossaf0b54c2017-09-27 17:22:32 -0700244 "tzdata",
Neil Fuller7a4d3db2018-11-20 19:43:10 +0000245 "tz_version",
Neil Fuller3b8c0552018-12-14 22:19:07 +0000246 // Files used to simulate the /system and runtime APEX dir
247 // structure on host.
248 "tzdata_host",
249 "tzdata_host_runtime_apex",
250 "tzlookup.xml_host_runtime_apex",
251 "tz_version_host",
252 "tz_version_host_runtime_apex",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700253 ],
254}
255
Paul Duffin7bb8d232018-10-23 11:48:38 +0100256// Provided solely to contribute information about which hidden parts of the
257// core-oj API are used by apps.
258java_library {
259 name: "core-oj-hiddenapi",
260 defaults: ["libcore_java_defaults"],
261 compile_dex: true,
262
263 srcs: [":openjdk_hiddenapi_javadoc_files"],
264
265 no_standard_libs: true,
266 libs: ["core-all"],
267 system_modules: "core-all-system-modules",
268 openjdk9: {
269 javacflags: ["--patch-module=java.base=."],
270 },
271}
272
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100273//
274// Guaranteed unstripped versions of core-oj and core-libart.
275//
Colin Cross3c6c2e22017-10-18 13:24:52 -0700276// The build system may or may not strip the core-oj and core-libart jars,
277// but these will not be stripped. See b/24535627.
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100278//
279
Colin Cross3c6c2e22017-10-18 13:24:52 -0700280java_library {
281 name: "core-oj-testdex",
Colin Cross5b75cdd2018-06-27 11:00:13 -0700282 installable: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700283 static_libs: ["core-oj"],
284 no_standard_libs: true,
285 libs: ["core-all"],
286 system_modules: "core-all-system-modules",
287 dxflags: ["--core-library"],
Colin Cross485ed362017-12-05 17:24:22 -0800288 dex_preopt: {
289 enabled: false,
290 },
Tobias Thiererde991232018-03-07 15:10:46 +0000291 java_version: "1.9",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700292 notice: "ojluni/NOTICE",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700293}
294
295java_library {
296 name: "core-libart-testdex",
Colin Cross5b75cdd2018-06-27 11:00:13 -0700297 installable: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700298 static_libs: ["core-libart"],
299 no_standard_libs: true,
300 libs: ["core-all"],
301 system_modules: "core-all-system-modules",
302 dxflags: ["--core-library"],
Colin Cross485ed362017-12-05 17:24:22 -0800303 dex_preopt: {
304 enabled: false,
305 },
Colin Cross3c6c2e22017-10-18 13:24:52 -0700306 notice: "ojluni/NOTICE",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700307}
308
Tobias Thierere0f8b312018-10-23 23:12:30 +0100309
310java_defaults {
311 name: "core_lambda_stubs_defaults",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700312 defaults: ["libcore_java_defaults"],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100313 hostdex: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700314
Colin Crossec80f4f2018-08-15 21:17:11 -0700315 no_standard_libs: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700316 libs: ["core-all"],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700317 system_modules: "core-all-system-modules",
318 openjdk9: {
319 javacflags: ["--patch-module=java.base=."],
320 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700321
322 notice: "ojluni/NOTICE",
323
324 installable: false,
325 include_srcs: true,
326}
Colin Crossa4d9fc42017-09-29 18:04:37 -0700327
Tobias Thierere0f8b312018-10-23 23:12:30 +0100328// Creates a jar that exists to satisfy javac when compiling source code that
329// contains lambdas. This contains all classes / methods required by javac
330// when generating invoke-dynamic lambda implementation code, even those that
331// are also in the public SDK API from API level 26 onwards.
332java_library {
333 name: "core-lambda-stubs",
334 defaults: ["core_lambda_stubs_defaults"],
335 srcs: [
336 ":openjdk_lambda_stub_files",
337 ":openjdk_lambda_duplicate_stub_files",
338 ],
339}
340
341// An alternative to core-lambda-stubs that omits openjdk_lambda_duplicate_stub_files
342// because those classes are also part of the core library public SDK API
343// (since API level 26).
344java_library {
345 name: "core-lambda-stubs-for-system-modules",
346 defaults: ["core_lambda_stubs_defaults"],
347 srcs: [
348 ":openjdk_lambda_stub_files",
349 ],
350}
351
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100352// A system modules definition containing the implementations for the various
353// parts that make up the core library.
354//
355// This system module is intended for use by tests that may need access to
356// core library internals. It should not be generally used; most of the
357// platform build should build against API stubs instead. See
358// "core-platform-api-stubs-system-modules", which is the default used by the
359// Android build.
360//
361// This module also includes lambda stubs for compiling source containing
362// Java lambdas.
Colin Crossa4d9fc42017-09-29 18:04:37 -0700363java_system_modules {
364 name: "core-system-modules",
365 libs: [
366 "core-oj",
367 "core-libart",
Neil Fullerb669ccb2018-10-04 23:10:27 +0100368 "bouncycastle",
369 "conscrypt",
370 "okhttp",
Neil Fuller05723a52018-10-19 10:55:05 +0100371 "apache-xml",
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100372 // This one is not on device but it's needed when javac compiles code
373 // containing lambdas.
Tobias Thierere0f8b312018-10-23 23:12:30 +0100374 "core-lambda-stubs-for-system-modules",
Colin Crossa4d9fc42017-09-29 18:04:37 -0700375 ],
376}
Colin Cross3c6c2e22017-10-18 13:24:52 -0700377
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100378// Builds libcore test rules
Colin Cross3c6c2e22017-10-18 13:24:52 -0700379java_library_static {
380 name: "core-test-rules",
381 hostdex: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700382 srcs: [
383 "dalvik/test-rules/src/main/**/*.java",
384 "test-rules/src/main/**/*.java",
385 ],
386 static_libs: ["junit"],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100387
388 no_standard_libs: true,
389 libs: ["core-all"],
390 system_modules: "core-all-system-modules",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700391}
392
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100393// Builds the core-tests-support library used by various tests.
Colin Cross3c6c2e22017-10-18 13:24:52 -0700394java_library_static {
395 name: "core-tests-support",
396 hostdex: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700397 srcs: ["support/src/test/java/**/*.java"],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100398
Neil Fuller4380ab22018-10-18 19:38:53 +0100399 no_framework_libs: true,
400 libs: ["junit"],
Colin Cross3c6c2e22017-10-18 13:24:52 -0700401 static_libs: [
Neil Fullerde8b0862018-10-12 21:53:31 +0100402 "bouncycastle-unbundled",
403 "bouncycastle-bcpkix-unbundled",
404 "bouncycastle-ocsp-unbundled",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700405 ],
406}
407
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100408// Builds the jsr166-tests library.
Colin Crossec80f4f2018-08-15 21:17:11 -0700409java_test {
Colin Cross3c6c2e22017-10-18 13:24:52 -0700410 name: "jsr166-tests",
411 srcs: ["jsr166-tests/src/test/java/**/*.java"],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100412 no_standard_libs: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700413 libs: [
Neil Fuller4207c7f2018-10-10 14:01:40 +0100414 "core-all",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700415 "junit",
416 ],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100417 system_modules: "core-all-system-modules",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700418}
Nan Zhang65f27a32018-01-05 10:41:46 -0800419
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100420// Builds a library just containing files from luni/src/test/filesystems
421// for use in tests.
Colin Crossec80f4f2018-08-15 21:17:11 -0700422java_library {
423 name: "filesystemstest",
424 compile_dex: true,
425 srcs: ["luni/src/test/filesystems/src/**/*.java"],
426 java_resource_dirs: ["luni/src/test/filesystems/resources"],
427 no_framework_libs: true,
428 errorprone: {
429 javacflags: ["-Xep:MissingOverride:OFF"],
430 },
431}
432
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100433// Builds a library just containing files from luni/src/test/parameter_metadata
434// for use in tests.
Colin Crossec80f4f2018-08-15 21:17:11 -0700435java_library {
436 name: "parameter-metadata-test",
437 compile_dex: true,
438 srcs: ["luni/src/test/parameter_metadata/src/**/*.java"],
439 no_framework_libs: true,
440 javacflags: ["-parameters"],
441 errorprone: {
442 javacflags: ["-Xep:MissingOverride:OFF"],
443 },
444}
445
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100446// Builds the core-tests library.
Colin Crossec80f4f2018-08-15 21:17:11 -0700447java_test {
448 name: "core-tests",
449 defaults: ["libcore_java_defaults"],
450 hostdex: true,
451 srcs: [
452 "dalvik/src/test/java/**/*.java",
453 "dalvik/test-rules/src/test/java/**/*.java",
454 "dom/src/test/java/**/*.java",
455 "harmony-tests/src/test/java/**/*.java",
456 "json/src/test/java/**/*.java",
457 "luni/src/test/java/**/*.java",
458 "xml/src/test/java/**/*.java",
459 ],
460 exclude_srcs: [
461 "luni/src/test/java/libcore/java/util/zip/Zip64Test.java",
462 "luni/src/test/java/libcore/java/util/zip/Zip64FileTest.java",
463 ],
464
465 java_resource_dirs: [
466 "*/src/test/java",
467 "*/src/test/resources",
468 ],
469 exclude_java_resource_dirs: [
470 "ojluni/src/test/java",
471 "ojluni/src/test/resources",
472 ],
473
474 java_resources: [
475 ":filesystemstest",
476 ":parameter-metadata-test",
477 ],
478
Neil Fuller4207c7f2018-10-10 14:01:40 +0100479 no_standard_libs: true,
480 libs: [
481 "core-all",
482 "okhttp",
483 "bouncycastle",
484 ],
485 system_modules: "core-all-system-modules",
486
Colin Crossec80f4f2018-08-15 21:17:11 -0700487 static_libs: [
488 "archive-patcher",
489 "core-test-rules",
490 "core-tests-support",
491 "junit-params",
492 "mockftpserver",
493 "mockito-target",
494 "mockwebserver",
495 "nist-pkix-tests",
496 "slf4j-jdk14",
497 "sqlite-jdbc",
498 "tzdata-testing",
Paul Duffina4df2372018-12-10 15:48:01 +0000499 "truth-prebuilt",
Colin Crossec80f4f2018-08-15 21:17:11 -0700500 ],
501
502 errorprone: {
503 javacflags: [
504 "-Xep:TryFailThrowable:ERROR",
505 "-Xep:ComparisonOutOfRange:ERROR",
506 ],
507 },
Simran Basi3be01e02018-08-21 17:53:49 -0700508
509 test_config: "AndroidTest-core-tests.xml",
Colin Crossec80f4f2018-08-15 21:17:11 -0700510}
511
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100512// Builds the core-ojtests library that contains test code from OpenJDK.
Colin Crossec80f4f2018-08-15 21:17:11 -0700513java_test {
514 name: "core-ojtests",
515 defaults: ["libcore_java_defaults"],
516 hostdex: true,
517
518 srcs: [
519 "ojluni/src/test/java/**/*.java",
520 ],
521 java_resource_dirs: [
522 "ojluni/src/test/java",
523 "ojluni/src/test/resources",
524 ],
Neil Fullerb669ccb2018-10-04 23:10:27 +0100525
Neil Fuller4207c7f2018-10-10 14:01:40 +0100526 no_standard_libs: true,
527 libs: [
528 "core-all",
529 "okhttp",
530 "bouncycastle",
531 ],
532 system_modules: "core-all-system-modules",
533
Colin Crossec80f4f2018-08-15 21:17:11 -0700534 static_libs: ["testng"],
535
536 // ojluni/src/test/java/util/stream/{bootlib,boottest}
537 // contains tests that are in packages from java.base;
538 // By default, OpenJDK 9's javac will only compile such
539 // code if it's declared to also be in java.base at
540 // compile time.
541 //
542 // For now, we use --patch-module to put all sources
543 // and dependencies from this make target into java.base;
544 // other source directories in this make target are in
545 // packages not from java.base; if this becomes a problem
546 // in future, this could be addressed eg. by splitting
547 // boot{lib,test} out into a separate make target,
548 // deleting those tests or moving them to a different
549 // package.
550 patch_module: "java.base",
551}
552
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100553// Builds the core-ojtests-public library. Excludes any private API tests.
554// Like core-ojtests but smaller.
Colin Crossec80f4f2018-08-15 21:17:11 -0700555java_test {
556 name: "core-ojtests-public",
557 defaults: ["libcore_java_defaults"],
558 srcs: [
559 "ojluni/src/test/java/**/*.java",
560 ],
561 // Filter out the following:
562 // 1.) DeserializeMethodTest and SerializedLambdaTest, because they depends on stub classes
563 // and won't actually run, and
564 // 2.) util/stream/boot*. Those directories contain classes in the package java.util.stream;
565 // excluding them means we don't need patch_module: "java.base"
566 exclude_srcs: [
567 "**/DeserializeMethodTest.java",
568 "**/SerializedLambdaTest.java",
569 "ojluni/src/test/java/util/stream/boot*/**/*",
570 ],
571 java_resource_dirs: [
572 "ojluni/src/test/java",
573 "ojluni/src/test/resources",
574 // Include source code as part of JAR
575 "ojluni/src/test/dist",
576 ],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100577
578 no_standard_libs: true,
579 libs: [
580 "core-all",
581 "bouncycastle",
582 "okhttp",
583 "testng",
584 ],
585 system_modules: "core-all-system-modules",
Colin Crossec80f4f2018-08-15 21:17:11 -0700586}
587
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100588// Exports annotated stubs source files in ojluni/annotations/sdk to make them
589// available to metalava. Used for nullability annotations in OpenJDK source.
Pete Gillin7db7faa2018-07-31 13:29:35 +0100590droiddoc_exported_dir {
Pete Gillin0728b742018-09-17 15:41:45 +0100591 name: "ojluni-annotated-sdk-stubs",
592 path: "ojluni/annotations/sdk",
Pete Gillin7db7faa2018-07-31 13:29:35 +0100593}
Pete Gillin600c7cf2018-08-16 19:28:38 +0100594droiddoc_exported_dir {
595 name: "ojluni-annotated-nullability-stubs",
596 path: "ojluni/annotations/sdk/nullability",
597}
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100598
599// Exports annotated stubs source files in ojluni/annotations/mmodules to make
600// them available to metalava. Used for core platform API and intra-code API
601// annotations in OpenJDK source.
Pete Gillinc9935b62018-09-25 14:42:40 +0100602droiddoc_exported_dir {
603 name: "ojluni-annotated-mmodule-stubs",
604 path: "ojluni/annotations/mmodule",
605}
Pete Gillin7db7faa2018-07-31 13:29:35 +0100606
Neil Fuller6f16b462018-09-04 15:40:39 +0100607// A file containing the list of tags that are "known" to us from the OpenJdk
608// source code and so should not cause an error or warning.
Nan Zhangd55722b2018-02-27 15:08:20 -0800609filegroup {
610 name: "known-oj-tags",
611 srcs: [
612 "known_oj_tags.txt",
613 ],
614}
Nan Zhang602fc0e2018-03-22 16:14:22 -0700615
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100616// Generates stubs for the parts of the public SDK API provided by the core
617// library.
Nan Zhangf0207602018-09-10 18:57:38 -0700618droidstubs {
619 name: "core-current-stubs-gen",
Neil Fuller866ed4a2018-09-06 12:05:46 +0100620 srcs: [":core_api_files"],
Tobias Thiererde991232018-03-07 15:10:46 +0000621 java_version: "1.9",
Nan Zhang602fc0e2018-03-22 16:14:22 -0700622 installable: false,
623 no_framework_libs: true,
Neil Fullerbe9258e2018-09-24 17:11:27 +0100624 args: " --exclude-annotations "
625 + "--hide-annotation libcore.api.Hide",
626 merge_inclusion_annotations_dirs: ["ojluni-annotated-mmodule-stubs"],
Nan Zhang602fc0e2018-03-22 16:14:22 -0700627}
628
Pete Gillin600c7cf2018-08-16 19:28:38 +0100629// Target for validating nullability annotations for correctness and
630// completeness. To check that there are no nullability errors:
631// make core-current-stubs-nullability-validation
632// To check that there are only the expected nullability warnings:
633// make core-current-stubs-nullability-validation-check-nullability-warnings
634// To update the the list of known expected nullability warnings:
635// make core-current-stubs-nullability-validation-update-nullability-warnings
636droidstubs {
637 name: "core-current-stubs-nullability-validation",
638 srcs: [":core_api_files"],
639 installable: false,
640 no_framework_libs: true,
641 annotations_enabled: true,
642 args: "--hide-annotation libcore.api.Hide " +
643 "--validate-nullability-from-merged-stubs ",
644 merge_inclusion_annotations_dirs: ["ojluni-annotated-mmodule-stubs"],
645 merge_annotations_dirs: [
646 "metalava-manual",
647 // N.B. Stubs in this filegroup will be validated:
648 "ojluni-annotated-nullability-stubs",
649 ],
Pete Gillinc5f179b2018-11-14 18:42:19 +0000650 // The list of classes which have nullability annotations included in the source.
651 // (This is in addition to those which have annotations in the merged stubs.)
652 validate_nullability_from_list: "nullability_annotated_classes.txt",
Pete Gillin600c7cf2018-08-16 19:28:38 +0100653 // The expected set of warnings about missing annotations:
654 check_nullability_warnings: "nullability_warnings.txt",
655}
656
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100657// A stubs target containing the parts of the public SDK API provided by the
658// core library.
659//
Neil Fullera6ba3592018-09-21 13:19:37 +0100660// Don't use this directly, use "sdk_version: core_current".
661java_library {
Nan Zhang602fc0e2018-03-22 16:14:22 -0700662 name: "core.current.stubs",
Nan Zhangf0207602018-09-10 18:57:38 -0700663 srcs: [":core-current-stubs-gen"],
Nan Zhang602fc0e2018-03-22 16:14:22 -0700664 errorprone: {
665 javacflags: [
666 "-Xep:MissingOverride:OFF",
667 ],
668 },
Tobias Thierer496a9382018-06-12 14:09:11 +0100669 openjdk9: {
670 javacflags: ["--patch-module=java.base=."],
671 },
Nan Zhang602fc0e2018-03-22 16:14:22 -0700672 no_standard_libs: true,
673 system_modules: "none",
674}
Neil Fullere784ef22018-11-16 15:54:30 +0000675
676// A host library containing time zone related classes. Used for
677// host-side tools and tests that have to deal with Android
678// time zone data.
679java_library_host {
680 name: "timezone-host",
681 srcs: [":timezone_host_files"],
682}