blob: e4639a2cdfe0e680733660b030867c5018670d40 [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",
101 ":core_simple_java_files",
Neil Fuller641d5f92018-09-24 15:40:39 +0100102 ":okhttp_api_files",
Pete Gillinc9935b62018-09-25 14:42:40 +0100103 ":openjdk_mmodule_extra_files",
Neil Fuller866ed4a2018-09-06 12:05:46 +0100104 ],
105}
106
Colin Crossaf0b54c2017-09-27 17:22:32 -0700107java_defaults {
108 name: "libcore_java_defaults",
109 javacflags: [
110 //"-Xlint:all",
111 //"-Xlint:-serial,-deprecation,-unchecked",
112 ],
113 dxflags: ["--core-library"],
Andreas Gampe66b31732018-02-20 09:22:16 -0800114 errorprone: {
115 javacflags: [
116 "-Xep:MissingOverride:OFF", // Ignore missing @Override.
Andreas Gampe24a20172018-06-13 11:28:45 -0700117 "-Xep:ConstantOverflow:WARN", // Known constant overflow in SplittableRandom
Andreas Gampe66b31732018-02-20 09:22:16 -0800118 ],
119 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700120}
121
122//
123// Build for the target (device).
124//
125
Victor Chang7fef4052018-09-25 14:12:03 +0100126// Rule generating resource lib for android_icu4j.
127// In the downstream branch master-icu-dev, the resource files are generated.
128// This rule can't be moved external/icu because soong enforces that no_standard_libs:true can only
129// be used in libcore/ or development/
130java_library {
131 name: "android_icu4j_resources_lib",
132 java_resources: [":android_icu4j_resources"],
133 no_standard_libs: true,
134 system_modules: "none",
135}
136
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100137// A target used to bootstrap compilation for the core library.
138// See core-all-system-modules for more details.
Colin Crossaf0b54c2017-09-27 17:22:32 -0700139java_library {
140 name: "core-all",
141 defaults: ["libcore_java_defaults"],
142
143 srcs: [
Neil Fuller866ed4a2018-09-06 12:05:46 +0100144 ":core_oj_java_files",
145 ":core_libart_java_files",
146 ":core_simple_java_files",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700147 ":openjdk_lambda_stub_files",
148 ],
Colin Crossec80f4f2018-08-15 21:17:11 -0700149
150 no_standard_libs: true,
151 system_modules: "none",
Colin Crossa4d9fc42017-09-29 18:04:37 -0700152 openjdk9: {
153 srcs: ["luni/src/module/java/module-info.java"],
154 javacflags: ["--patch-module=java.base=."],
155 },
Colin Crossec80f4f2018-08-15 21:17:11 -0700156
Colin Crossaf0b54c2017-09-27 17:22:32 -0700157 java_resource_dirs: core_resource_dirs,
Victor Chang7fef4052018-09-25 14:12:03 +0100158 static_libs: ["android_icu4j_resources_lib"],
Tobias Thiererde991232018-03-07 15:10:46 +0000159 java_version: "1.9",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700160
Colin Crossaf0b54c2017-09-27 17:22:32 -0700161 installable: false,
162}
163
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100164// A system modules definition for use by core library targets only. It only
165// contains the core-all jar, which contains the classes that end up in core-oj,
166// core-libart as well as the lambda stubs needed to compile Java lambda code.
167// It does not contain other parts of core library like conscrypt, bouncycastle,
168// etc. This system_modules definition is used to bootstrap compilation for
169// other parts of the core library like core-oj, core-libart, conscrypt,
170// bouncycastle, etc.
171//
172// If you want to compile against the entire core library implementation, for
173// example to build core library tests, see "core-system-modules" instead.
Colin Crossa4d9fc42017-09-29 18:04:37 -0700174java_system_modules {
175 name: "core-all-system-modules",
176 libs: ["core-all"],
177}
178
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100179// Contains the parts of core library associated with OpenJDK.
Colin Crossaf0b54c2017-09-27 17:22:32 -0700180java_library {
181 name: "core-oj",
182 defaults: ["libcore_java_defaults"],
Colin Cross5b75cdd2018-06-27 11:00:13 -0700183 installable: true,
Colin Crossbb180be2017-10-09 14:54:53 -0700184 hostdex: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700185
Neil Fuller866ed4a2018-09-06 12:05:46 +0100186 srcs: [":core_oj_java_files"],
Colin Crossaf0b54c2017-09-27 17:22:32 -0700187 java_resource_dirs: core_resource_dirs,
Colin Crossec80f4f2018-08-15 21:17:11 -0700188
189 no_standard_libs: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700190 libs: ["core-all"],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700191 system_modules: "core-all-system-modules",
192 openjdk9: {
193 javacflags: ["--patch-module=java.base=."],
194 },
Colin Crossec80f4f2018-08-15 21:17:11 -0700195
Pete Gillin7a7a6d22017-12-19 14:56:03 +0000196 jacoco: {
Pete Gillin27ca0582018-01-10 17:04:17 +0000197 exclude_filter: [
Pete Gillin3f59bad2018-01-30 11:20:29 +0000198 "java.lang.Class",
199 "java.lang.Long",
200 "java.lang.Number",
201 "java.lang.Object",
202 "java.lang.String",
203 "java.lang.invoke.MethodHandle",
204 "java.lang.ref.Reference",
205 "java.lang.reflect.Proxy",
Pete Gillinb1868ada2018-01-17 11:03:10 +0000206 "java.util.AbstractMap",
Pete Gillin3f59bad2018-01-30 11:20:29 +0000207 "java.util.HashMap",
208 "java.util.HashMap$Node",
Pete Gillinb1868ada2018-01-17 11:03:10 +0000209 "java.util.Map",
Pete Gillin7a7a6d22017-12-19 14:56:03 +0000210 ],
211 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700212
213 notice: "ojluni/NOTICE",
214
Colin Crossaf0b54c2017-09-27 17:22:32 -0700215}
216
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100217// Contains parts of core library not associated with OpenJDK. Contains not
218// just java.*, javax.* code but also android.icu.*, android.system.* and
219// various internal libcore.* packages.
Colin Crossaf0b54c2017-09-27 17:22:32 -0700220java_library {
221 name: "core-libart",
222 defaults: ["libcore_java_defaults"],
Colin Cross5b75cdd2018-06-27 11:00:13 -0700223 installable: true,
Colin Crossbb180be2017-10-09 14:54:53 -0700224 hostdex: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700225
Neil Fuller866ed4a2018-09-06 12:05:46 +0100226 srcs: [":core_libart_java_files"],
Victor Chang7fef4052018-09-25 14:12:03 +0100227 static_libs: ["android_icu4j_resources_lib"],
Tobias Thiererde991232018-03-07 15:10:46 +0000228 java_version: "1.9",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700229
Colin Crossec80f4f2018-08-15 21:17:11 -0700230 no_standard_libs: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700231 libs: ["core-all"],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700232 system_modules: "core-all-system-modules",
233 openjdk9: {
234 javacflags: ["--patch-module=java.base=."],
235 },
Colin Crossec80f4f2018-08-15 21:17:11 -0700236
Pete Gillin80ebe872018-02-13 15:21:20 +0000237 jacoco: {
238 exclude_filter: [
239 "java.lang.DexCache",
240 "dalvik.system.ClassExt",
241 ],
242 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700243
244 required: [
Neil Fuller3b8c0552018-12-14 22:19:07 +0000245 // Device files put in /system.
Colin Crossaf0b54c2017-09-27 17:22:32 -0700246 "tzdata",
Neil Fuller7a4d3db2018-11-20 19:43:10 +0000247 "tz_version",
Neil Fuller3b8c0552018-12-14 22:19:07 +0000248 // Files used to simulate the /system and runtime APEX dir
249 // structure on host.
250 "tzdata_host",
251 "tzdata_host_runtime_apex",
252 "tzlookup.xml_host_runtime_apex",
253 "tz_version_host",
254 "tz_version_host_runtime_apex",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700255 ],
256}
257
Paul Duffin7bb8d232018-10-23 11:48:38 +0100258// Provided solely to contribute information about which hidden parts of the
259// core-oj API are used by apps.
260java_library {
261 name: "core-oj-hiddenapi",
262 defaults: ["libcore_java_defaults"],
263 compile_dex: true,
264
265 srcs: [":openjdk_hiddenapi_javadoc_files"],
266
267 no_standard_libs: true,
268 libs: ["core-all"],
269 system_modules: "core-all-system-modules",
270 openjdk9: {
271 javacflags: ["--patch-module=java.base=."],
272 },
273}
274
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100275//
276// Guaranteed unstripped versions of core-oj and core-libart.
277//
Colin Cross3c6c2e22017-10-18 13:24:52 -0700278// The build system may or may not strip the core-oj and core-libart jars,
279// but these will not be stripped. See b/24535627.
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100280//
281
Colin Cross3c6c2e22017-10-18 13:24:52 -0700282java_library {
283 name: "core-oj-testdex",
Colin Cross5b75cdd2018-06-27 11:00:13 -0700284 installable: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700285 static_libs: ["core-oj"],
286 no_standard_libs: true,
287 libs: ["core-all"],
288 system_modules: "core-all-system-modules",
289 dxflags: ["--core-library"],
Colin Cross485ed362017-12-05 17:24:22 -0800290 dex_preopt: {
291 enabled: false,
292 },
Tobias Thiererde991232018-03-07 15:10:46 +0000293 java_version: "1.9",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700294 notice: "ojluni/NOTICE",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700295}
296
297java_library {
298 name: "core-libart-testdex",
Colin Cross5b75cdd2018-06-27 11:00:13 -0700299 installable: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700300 static_libs: ["core-libart"],
301 no_standard_libs: true,
302 libs: ["core-all"],
303 system_modules: "core-all-system-modules",
304 dxflags: ["--core-library"],
Colin Cross485ed362017-12-05 17:24:22 -0800305 dex_preopt: {
306 enabled: false,
307 },
Colin Cross3c6c2e22017-10-18 13:24:52 -0700308 notice: "ojluni/NOTICE",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700309}
310
Tobias Thierere0f8b312018-10-23 23:12:30 +0100311
312java_defaults {
313 name: "core_lambda_stubs_defaults",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700314 defaults: ["libcore_java_defaults"],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100315 hostdex: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700316
Colin Crossec80f4f2018-08-15 21:17:11 -0700317 no_standard_libs: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700318 libs: ["core-all"],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700319 system_modules: "core-all-system-modules",
320 openjdk9: {
321 javacflags: ["--patch-module=java.base=."],
322 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700323
324 notice: "ojluni/NOTICE",
325
326 installable: false,
327 include_srcs: true,
328}
Colin Crossa4d9fc42017-09-29 18:04:37 -0700329
Tobias Thierere0f8b312018-10-23 23:12:30 +0100330// Creates a jar that exists to satisfy javac when compiling source code that
331// contains lambdas. This contains all classes / methods required by javac
332// when generating invoke-dynamic lambda implementation code, even those that
333// are also in the public SDK API from API level 26 onwards.
334java_library {
335 name: "core-lambda-stubs",
336 defaults: ["core_lambda_stubs_defaults"],
337 srcs: [
338 ":openjdk_lambda_stub_files",
339 ":openjdk_lambda_duplicate_stub_files",
340 ],
341}
342
343// An alternative to core-lambda-stubs that omits openjdk_lambda_duplicate_stub_files
344// because those classes are also part of the core library public SDK API
345// (since API level 26).
346java_library {
347 name: "core-lambda-stubs-for-system-modules",
348 defaults: ["core_lambda_stubs_defaults"],
349 srcs: [
350 ":openjdk_lambda_stub_files",
351 ],
352}
353
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100354// A system modules definition containing the implementations for the various
355// parts that make up the core library.
356//
357// This system module is intended for use by tests that may need access to
358// core library internals. It should not be generally used; most of the
359// platform build should build against API stubs instead. See
360// "core-platform-api-stubs-system-modules", which is the default used by the
361// Android build.
362//
363// This module also includes lambda stubs for compiling source containing
364// Java lambdas.
Colin Crossa4d9fc42017-09-29 18:04:37 -0700365java_system_modules {
366 name: "core-system-modules",
367 libs: [
368 "core-oj",
369 "core-libart",
Neil Fuller866ed4a2018-09-06 12:05:46 +0100370 "core-simple",
Neil Fullerb669ccb2018-10-04 23:10:27 +0100371 "bouncycastle",
372 "conscrypt",
373 "okhttp",
Neil Fuller05723a52018-10-19 10:55:05 +0100374 "apache-xml",
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100375 // This one is not on device but it's needed when javac compiles code
376 // containing lambdas.
Tobias Thierere0f8b312018-10-23 23:12:30 +0100377 "core-lambda-stubs-for-system-modules",
Colin Crossa4d9fc42017-09-29 18:04:37 -0700378 ],
379}
Colin Cross3c6c2e22017-10-18 13:24:52 -0700380
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100381// Builds libcore test rules
Colin Cross3c6c2e22017-10-18 13:24:52 -0700382java_library_static {
383 name: "core-test-rules",
384 hostdex: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700385 srcs: [
386 "dalvik/test-rules/src/main/**/*.java",
387 "test-rules/src/main/**/*.java",
388 ],
389 static_libs: ["junit"],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100390
391 no_standard_libs: true,
392 libs: ["core-all"],
393 system_modules: "core-all-system-modules",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700394}
395
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100396// Builds the core-tests-support library used by various tests.
Colin Cross3c6c2e22017-10-18 13:24:52 -0700397java_library_static {
398 name: "core-tests-support",
399 hostdex: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700400 srcs: ["support/src/test/java/**/*.java"],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100401
Neil Fuller4380ab22018-10-18 19:38:53 +0100402 no_framework_libs: true,
403 libs: ["junit"],
Colin Cross3c6c2e22017-10-18 13:24:52 -0700404 static_libs: [
Neil Fullerde8b0862018-10-12 21:53:31 +0100405 "bouncycastle-unbundled",
406 "bouncycastle-bcpkix-unbundled",
407 "bouncycastle-ocsp-unbundled",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700408 ],
409}
410
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100411// Builds the jsr166-tests library.
Colin Crossec80f4f2018-08-15 21:17:11 -0700412java_test {
Colin Cross3c6c2e22017-10-18 13:24:52 -0700413 name: "jsr166-tests",
414 srcs: ["jsr166-tests/src/test/java/**/*.java"],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100415 no_standard_libs: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700416 libs: [
Neil Fuller4207c7f2018-10-10 14:01:40 +0100417 "core-all",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700418 "junit",
419 ],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100420 system_modules: "core-all-system-modules",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700421}
Nan Zhang65f27a32018-01-05 10:41:46 -0800422
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100423// Builds a library just containing files from luni/src/test/filesystems
424// for use in tests.
Colin Crossec80f4f2018-08-15 21:17:11 -0700425java_library {
426 name: "filesystemstest",
427 compile_dex: true,
428 srcs: ["luni/src/test/filesystems/src/**/*.java"],
429 java_resource_dirs: ["luni/src/test/filesystems/resources"],
430 no_framework_libs: true,
431 errorprone: {
432 javacflags: ["-Xep:MissingOverride:OFF"],
433 },
434}
435
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100436// Builds a library just containing files from luni/src/test/parameter_metadata
437// for use in tests.
Colin Crossec80f4f2018-08-15 21:17:11 -0700438java_library {
439 name: "parameter-metadata-test",
440 compile_dex: true,
441 srcs: ["luni/src/test/parameter_metadata/src/**/*.java"],
442 no_framework_libs: true,
443 javacflags: ["-parameters"],
444 errorprone: {
445 javacflags: ["-Xep:MissingOverride:OFF"],
446 },
447}
448
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100449// Builds the core-tests library.
Colin Crossec80f4f2018-08-15 21:17:11 -0700450java_test {
451 name: "core-tests",
452 defaults: ["libcore_java_defaults"],
453 hostdex: true,
454 srcs: [
455 "dalvik/src/test/java/**/*.java",
456 "dalvik/test-rules/src/test/java/**/*.java",
457 "dom/src/test/java/**/*.java",
458 "harmony-tests/src/test/java/**/*.java",
459 "json/src/test/java/**/*.java",
460 "luni/src/test/java/**/*.java",
461 "xml/src/test/java/**/*.java",
462 ],
463 exclude_srcs: [
464 "luni/src/test/java/libcore/java/util/zip/Zip64Test.java",
465 "luni/src/test/java/libcore/java/util/zip/Zip64FileTest.java",
466 ],
467
468 java_resource_dirs: [
469 "*/src/test/java",
470 "*/src/test/resources",
471 ],
472 exclude_java_resource_dirs: [
473 "ojluni/src/test/java",
474 "ojluni/src/test/resources",
475 ],
476
477 java_resources: [
478 ":filesystemstest",
479 ":parameter-metadata-test",
480 ],
481
Neil Fuller4207c7f2018-10-10 14:01:40 +0100482 no_standard_libs: true,
483 libs: [
484 "core-all",
485 "okhttp",
486 "bouncycastle",
487 ],
488 system_modules: "core-all-system-modules",
489
Colin Crossec80f4f2018-08-15 21:17:11 -0700490 static_libs: [
491 "archive-patcher",
492 "core-test-rules",
493 "core-tests-support",
494 "junit-params",
495 "mockftpserver",
496 "mockito-target",
497 "mockwebserver",
498 "nist-pkix-tests",
499 "slf4j-jdk14",
500 "sqlite-jdbc",
501 "tzdata-testing",
Paul Duffina4df2372018-12-10 15:48:01 +0000502 "truth-prebuilt",
Colin Crossec80f4f2018-08-15 21:17:11 -0700503 ],
504
505 errorprone: {
506 javacflags: [
507 "-Xep:TryFailThrowable:ERROR",
508 "-Xep:ComparisonOutOfRange:ERROR",
509 ],
510 },
Simran Basi3be01e02018-08-21 17:53:49 -0700511
512 test_config: "AndroidTest-core-tests.xml",
Colin Crossec80f4f2018-08-15 21:17:11 -0700513}
514
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100515// Builds the core-ojtests library that contains test code from OpenJDK.
Colin Crossec80f4f2018-08-15 21:17:11 -0700516java_test {
517 name: "core-ojtests",
518 defaults: ["libcore_java_defaults"],
519 hostdex: true,
520
521 srcs: [
522 "ojluni/src/test/java/**/*.java",
523 ],
524 java_resource_dirs: [
525 "ojluni/src/test/java",
526 "ojluni/src/test/resources",
527 ],
Neil Fullerb669ccb2018-10-04 23:10:27 +0100528
Neil Fuller4207c7f2018-10-10 14:01:40 +0100529 no_standard_libs: true,
530 libs: [
531 "core-all",
532 "okhttp",
533 "bouncycastle",
534 ],
535 system_modules: "core-all-system-modules",
536
Colin Crossec80f4f2018-08-15 21:17:11 -0700537 static_libs: ["testng"],
538
539 // ojluni/src/test/java/util/stream/{bootlib,boottest}
540 // contains tests that are in packages from java.base;
541 // By default, OpenJDK 9's javac will only compile such
542 // code if it's declared to also be in java.base at
543 // compile time.
544 //
545 // For now, we use --patch-module to put all sources
546 // and dependencies from this make target into java.base;
547 // other source directories in this make target are in
548 // packages not from java.base; if this becomes a problem
549 // in future, this could be addressed eg. by splitting
550 // boot{lib,test} out into a separate make target,
551 // deleting those tests or moving them to a different
552 // package.
553 patch_module: "java.base",
554}
555
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100556// Builds the core-ojtests-public library. Excludes any private API tests.
557// Like core-ojtests but smaller.
Colin Crossec80f4f2018-08-15 21:17:11 -0700558java_test {
559 name: "core-ojtests-public",
560 defaults: ["libcore_java_defaults"],
561 srcs: [
562 "ojluni/src/test/java/**/*.java",
563 ],
564 // Filter out the following:
565 // 1.) DeserializeMethodTest and SerializedLambdaTest, because they depends on stub classes
566 // and won't actually run, and
567 // 2.) util/stream/boot*. Those directories contain classes in the package java.util.stream;
568 // excluding them means we don't need patch_module: "java.base"
569 exclude_srcs: [
570 "**/DeserializeMethodTest.java",
571 "**/SerializedLambdaTest.java",
572 "ojluni/src/test/java/util/stream/boot*/**/*",
573 ],
574 java_resource_dirs: [
575 "ojluni/src/test/java",
576 "ojluni/src/test/resources",
577 // Include source code as part of JAR
578 "ojluni/src/test/dist",
579 ],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100580
581 no_standard_libs: true,
582 libs: [
583 "core-all",
584 "bouncycastle",
585 "okhttp",
586 "testng",
587 ],
588 system_modules: "core-all-system-modules",
Colin Crossec80f4f2018-08-15 21:17:11 -0700589}
590
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100591// Exports annotated stubs source files in ojluni/annotations/sdk to make them
592// available to metalava. Used for nullability annotations in OpenJDK source.
Pete Gillin7db7faa2018-07-31 13:29:35 +0100593droiddoc_exported_dir {
Pete Gillin0728b742018-09-17 15:41:45 +0100594 name: "ojluni-annotated-sdk-stubs",
595 path: "ojluni/annotations/sdk",
Pete Gillin7db7faa2018-07-31 13:29:35 +0100596}
Pete Gillin600c7cf2018-08-16 19:28:38 +0100597droiddoc_exported_dir {
598 name: "ojluni-annotated-nullability-stubs",
599 path: "ojluni/annotations/sdk/nullability",
600}
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100601
602// Exports annotated stubs source files in ojluni/annotations/mmodules to make
603// them available to metalava. Used for core platform API and intra-code API
604// annotations in OpenJDK source.
Pete Gillinc9935b62018-09-25 14:42:40 +0100605droiddoc_exported_dir {
606 name: "ojluni-annotated-mmodule-stubs",
607 path: "ojluni/annotations/mmodule",
608}
Pete Gillin7db7faa2018-07-31 13:29:35 +0100609
Neil Fuller6f16b462018-09-04 15:40:39 +0100610// A file containing the list of tags that are "known" to us from the OpenJdk
611// source code and so should not cause an error or warning.
Nan Zhangd55722b2018-02-27 15:08:20 -0800612filegroup {
613 name: "known-oj-tags",
614 srcs: [
615 "known_oj_tags.txt",
616 ],
617}
Nan Zhang602fc0e2018-03-22 16:14:22 -0700618
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100619// Generates stubs for the parts of the public SDK API provided by the core
620// library.
Nan Zhangf0207602018-09-10 18:57:38 -0700621droidstubs {
622 name: "core-current-stubs-gen",
Neil Fuller866ed4a2018-09-06 12:05:46 +0100623 srcs: [":core_api_files"],
Tobias Thiererde991232018-03-07 15:10:46 +0000624 java_version: "1.9",
Nan Zhang602fc0e2018-03-22 16:14:22 -0700625 installable: false,
626 no_framework_libs: true,
Neil Fullerbe9258e2018-09-24 17:11:27 +0100627 args: " --exclude-annotations "
628 + "--hide-annotation libcore.api.Hide",
629 merge_inclusion_annotations_dirs: ["ojluni-annotated-mmodule-stubs"],
Nan Zhang602fc0e2018-03-22 16:14:22 -0700630}
631
Pete Gillin600c7cf2018-08-16 19:28:38 +0100632// Target for validating nullability annotations for correctness and
633// completeness. To check that there are no nullability errors:
634// make core-current-stubs-nullability-validation
635// To check that there are only the expected nullability warnings:
636// make core-current-stubs-nullability-validation-check-nullability-warnings
637// To update the the list of known expected nullability warnings:
638// make core-current-stubs-nullability-validation-update-nullability-warnings
639droidstubs {
640 name: "core-current-stubs-nullability-validation",
641 srcs: [":core_api_files"],
642 installable: false,
643 no_framework_libs: true,
644 annotations_enabled: true,
645 args: "--hide-annotation libcore.api.Hide " +
646 "--validate-nullability-from-merged-stubs ",
647 merge_inclusion_annotations_dirs: ["ojluni-annotated-mmodule-stubs"],
648 merge_annotations_dirs: [
649 "metalava-manual",
650 // N.B. Stubs in this filegroup will be validated:
651 "ojluni-annotated-nullability-stubs",
652 ],
Pete Gillinc5f179b2018-11-14 18:42:19 +0000653 // The list of classes which have nullability annotations included in the source.
654 // (This is in addition to those which have annotations in the merged stubs.)
655 validate_nullability_from_list: "nullability_annotated_classes.txt",
Pete Gillin600c7cf2018-08-16 19:28:38 +0100656 // The expected set of warnings about missing annotations:
657 check_nullability_warnings: "nullability_warnings.txt",
658}
659
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100660// A stubs target containing the parts of the public SDK API provided by the
661// core library.
662//
Neil Fullera6ba3592018-09-21 13:19:37 +0100663// Don't use this directly, use "sdk_version: core_current".
664java_library {
Nan Zhang602fc0e2018-03-22 16:14:22 -0700665 name: "core.current.stubs",
Nan Zhangf0207602018-09-10 18:57:38 -0700666 srcs: [":core-current-stubs-gen"],
Nan Zhang602fc0e2018-03-22 16:14:22 -0700667 errorprone: {
668 javacflags: [
669 "-Xep:MissingOverride:OFF",
670 ],
671 },
Tobias Thierer496a9382018-06-12 14:09:11 +0100672 openjdk9: {
673 javacflags: ["--patch-module=java.base=."],
674 },
Nan Zhang602fc0e2018-03-22 16:14:22 -0700675 no_standard_libs: true,
676 system_modules: "none",
677}
Neil Fullere784ef22018-11-16 15:54:30 +0000678
679// A host library containing time zone related classes. Used for
680// host-side tools and tests that have to deal with Android
681// time zone data.
682java_library_host {
683 name: "timezone-host",
684 srcs: [":timezone_host_files"],
685}