blob: 7a01003af5b9e324e3ae088d63906f40d6303182 [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
161 required: [
162 "tzdata",
163 "tzlookup.xml",
Neil Fuller7a4d3db2018-11-20 19:43:10 +0000164 "tz_version",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700165 ],
166
167 installable: false,
168}
169
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100170// A system modules definition for use by core library targets only. It only
171// contains the core-all jar, which contains the classes that end up in core-oj,
172// core-libart as well as the lambda stubs needed to compile Java lambda code.
173// It does not contain other parts of core library like conscrypt, bouncycastle,
174// etc. This system_modules definition is used to bootstrap compilation for
175// other parts of the core library like core-oj, core-libart, conscrypt,
176// bouncycastle, etc.
177//
178// If you want to compile against the entire core library implementation, for
179// example to build core library tests, see "core-system-modules" instead.
Colin Crossa4d9fc42017-09-29 18:04:37 -0700180java_system_modules {
181 name: "core-all-system-modules",
182 libs: ["core-all"],
183}
184
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100185// Contains the parts of core library associated with OpenJDK.
Colin Crossaf0b54c2017-09-27 17:22:32 -0700186java_library {
187 name: "core-oj",
188 defaults: ["libcore_java_defaults"],
Colin Cross5b75cdd2018-06-27 11:00:13 -0700189 installable: true,
Colin Crossbb180be2017-10-09 14:54:53 -0700190 hostdex: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700191
Neil Fuller866ed4a2018-09-06 12:05:46 +0100192 srcs: [":core_oj_java_files"],
Colin Crossaf0b54c2017-09-27 17:22:32 -0700193 java_resource_dirs: core_resource_dirs,
Colin Crossec80f4f2018-08-15 21:17:11 -0700194
195 no_standard_libs: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700196 libs: ["core-all"],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700197 system_modules: "core-all-system-modules",
198 openjdk9: {
199 javacflags: ["--patch-module=java.base=."],
200 },
Colin Crossec80f4f2018-08-15 21:17:11 -0700201
Pete Gillin7a7a6d22017-12-19 14:56:03 +0000202 jacoco: {
Pete Gillin27ca0582018-01-10 17:04:17 +0000203 exclude_filter: [
Pete Gillin3f59bad2018-01-30 11:20:29 +0000204 "java.lang.Class",
205 "java.lang.Long",
206 "java.lang.Number",
207 "java.lang.Object",
208 "java.lang.String",
209 "java.lang.invoke.MethodHandle",
210 "java.lang.ref.Reference",
211 "java.lang.reflect.Proxy",
Pete Gillinb1868ada2018-01-17 11:03:10 +0000212 "java.util.AbstractMap",
Pete Gillin3f59bad2018-01-30 11:20:29 +0000213 "java.util.HashMap",
214 "java.util.HashMap$Node",
Pete Gillinb1868ada2018-01-17 11:03:10 +0000215 "java.util.Map",
Pete Gillin7a7a6d22017-12-19 14:56:03 +0000216 ],
217 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700218
219 notice: "ojluni/NOTICE",
220
221 required: [
222 "tzdata",
223 "tzlookup.xml",
Neil Fuller7a4d3db2018-11-20 19:43:10 +0000224 "tz_version",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700225 ],
Colin Crossbb180be2017-10-09 14:54:53 -0700226
Colin Crossaf0b54c2017-09-27 17:22:32 -0700227}
228
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100229// Contains parts of core library not associated with OpenJDK. Contains not
230// just java.*, javax.* code but also android.icu.*, android.system.* and
231// various internal libcore.* packages.
Colin Crossaf0b54c2017-09-27 17:22:32 -0700232java_library {
233 name: "core-libart",
234 defaults: ["libcore_java_defaults"],
Colin Cross5b75cdd2018-06-27 11:00:13 -0700235 installable: true,
Colin Crossbb180be2017-10-09 14:54:53 -0700236 hostdex: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700237
Neil Fuller866ed4a2018-09-06 12:05:46 +0100238 srcs: [":core_libart_java_files"],
Victor Chang7fef4052018-09-25 14:12:03 +0100239 static_libs: ["android_icu4j_resources_lib"],
Tobias Thiererde991232018-03-07 15:10:46 +0000240 java_version: "1.9",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700241
Colin Crossec80f4f2018-08-15 21:17:11 -0700242 no_standard_libs: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700243 libs: ["core-all"],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700244 system_modules: "core-all-system-modules",
245 openjdk9: {
246 javacflags: ["--patch-module=java.base=."],
247 },
Colin Crossec80f4f2018-08-15 21:17:11 -0700248
Pete Gillin80ebe872018-02-13 15:21:20 +0000249 jacoco: {
250 exclude_filter: [
251 "java.lang.DexCache",
252 "dalvik.system.ClassExt",
253 ],
254 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700255
256 required: [
257 "tzdata",
258 "tzlookup.xml",
Neil Fuller7a4d3db2018-11-20 19:43:10 +0000259 "tz_version",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700260 ],
261}
262
Paul Duffin7bb8d232018-10-23 11:48:38 +0100263// Provided solely to contribute information about which hidden parts of the
264// core-oj API are used by apps.
265java_library {
266 name: "core-oj-hiddenapi",
267 defaults: ["libcore_java_defaults"],
268 compile_dex: true,
269
270 srcs: [":openjdk_hiddenapi_javadoc_files"],
271
272 no_standard_libs: true,
273 libs: ["core-all"],
274 system_modules: "core-all-system-modules",
275 openjdk9: {
276 javacflags: ["--patch-module=java.base=."],
277 },
278}
279
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100280//
281// Guaranteed unstripped versions of core-oj and core-libart.
282//
Colin Cross3c6c2e22017-10-18 13:24:52 -0700283// The build system may or may not strip the core-oj and core-libart jars,
284// but these will not be stripped. See b/24535627.
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100285//
286
Colin Cross3c6c2e22017-10-18 13:24:52 -0700287java_library {
288 name: "core-oj-testdex",
Colin Cross5b75cdd2018-06-27 11:00:13 -0700289 installable: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700290 static_libs: ["core-oj"],
291 no_standard_libs: true,
292 libs: ["core-all"],
293 system_modules: "core-all-system-modules",
294 dxflags: ["--core-library"],
Colin Cross485ed362017-12-05 17:24:22 -0800295 dex_preopt: {
296 enabled: false,
297 },
Tobias Thiererde991232018-03-07 15:10:46 +0000298 java_version: "1.9",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700299 notice: "ojluni/NOTICE",
300 required: [
301 "tzdata",
302 "tzlookup.xml",
Neil Fuller7a4d3db2018-11-20 19:43:10 +0000303 "tz_version",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700304 ],
305}
306
307java_library {
308 name: "core-libart-testdex",
Colin Cross5b75cdd2018-06-27 11:00:13 -0700309 installable: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700310 static_libs: ["core-libart"],
311 no_standard_libs: true,
312 libs: ["core-all"],
313 system_modules: "core-all-system-modules",
314 dxflags: ["--core-library"],
Colin Cross485ed362017-12-05 17:24:22 -0800315 dex_preopt: {
316 enabled: false,
317 },
Colin Cross3c6c2e22017-10-18 13:24:52 -0700318 notice: "ojluni/NOTICE",
319 required: [
320 "tzdata",
321 "tzlookup.xml",
Neil Fuller7a4d3db2018-11-20 19:43:10 +0000322 "tz_version",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700323 ],
324}
325
Tobias Thierere0f8b312018-10-23 23:12:30 +0100326
327java_defaults {
328 name: "core_lambda_stubs_defaults",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700329 defaults: ["libcore_java_defaults"],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100330 hostdex: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700331
Colin Crossec80f4f2018-08-15 21:17:11 -0700332 no_standard_libs: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700333 libs: ["core-all"],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700334 system_modules: "core-all-system-modules",
335 openjdk9: {
336 javacflags: ["--patch-module=java.base=."],
337 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700338
339 notice: "ojluni/NOTICE",
340
341 installable: false,
342 include_srcs: true,
343}
Colin Crossa4d9fc42017-09-29 18:04:37 -0700344
Tobias Thierere0f8b312018-10-23 23:12:30 +0100345// Creates a jar that exists to satisfy javac when compiling source code that
346// contains lambdas. This contains all classes / methods required by javac
347// when generating invoke-dynamic lambda implementation code, even those that
348// are also in the public SDK API from API level 26 onwards.
349java_library {
350 name: "core-lambda-stubs",
351 defaults: ["core_lambda_stubs_defaults"],
352 srcs: [
353 ":openjdk_lambda_stub_files",
354 ":openjdk_lambda_duplicate_stub_files",
355 ],
356}
357
358// An alternative to core-lambda-stubs that omits openjdk_lambda_duplicate_stub_files
359// because those classes are also part of the core library public SDK API
360// (since API level 26).
361java_library {
362 name: "core-lambda-stubs-for-system-modules",
363 defaults: ["core_lambda_stubs_defaults"],
364 srcs: [
365 ":openjdk_lambda_stub_files",
366 ],
367}
368
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100369// A system modules definition containing the implementations for the various
370// parts that make up the core library.
371//
372// This system module is intended for use by tests that may need access to
373// core library internals. It should not be generally used; most of the
374// platform build should build against API stubs instead. See
375// "core-platform-api-stubs-system-modules", which is the default used by the
376// Android build.
377//
378// This module also includes lambda stubs for compiling source containing
379// Java lambdas.
Colin Crossa4d9fc42017-09-29 18:04:37 -0700380java_system_modules {
381 name: "core-system-modules",
382 libs: [
383 "core-oj",
384 "core-libart",
Neil Fuller866ed4a2018-09-06 12:05:46 +0100385 "core-simple",
Neil Fullerb669ccb2018-10-04 23:10:27 +0100386 "bouncycastle",
387 "conscrypt",
388 "okhttp",
Neil Fuller05723a52018-10-19 10:55:05 +0100389 "apache-xml",
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100390 // This one is not on device but it's needed when javac compiles code
391 // containing lambdas.
Tobias Thierere0f8b312018-10-23 23:12:30 +0100392 "core-lambda-stubs-for-system-modules",
Colin Crossa4d9fc42017-09-29 18:04:37 -0700393 ],
394}
Colin Cross3c6c2e22017-10-18 13:24:52 -0700395
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100396// Builds libcore test rules
Colin Cross3c6c2e22017-10-18 13:24:52 -0700397java_library_static {
398 name: "core-test-rules",
399 hostdex: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700400 srcs: [
401 "dalvik/test-rules/src/main/**/*.java",
402 "test-rules/src/main/**/*.java",
403 ],
404 static_libs: ["junit"],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100405
406 no_standard_libs: true,
407 libs: ["core-all"],
408 system_modules: "core-all-system-modules",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700409}
410
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100411// Builds the core-tests-support library used by various tests.
Colin Cross3c6c2e22017-10-18 13:24:52 -0700412java_library_static {
413 name: "core-tests-support",
414 hostdex: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700415 srcs: ["support/src/test/java/**/*.java"],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100416
Neil Fuller4380ab22018-10-18 19:38:53 +0100417 no_framework_libs: true,
418 libs: ["junit"],
Colin Cross3c6c2e22017-10-18 13:24:52 -0700419 static_libs: [
Neil Fullerde8b0862018-10-12 21:53:31 +0100420 "bouncycastle-unbundled",
421 "bouncycastle-bcpkix-unbundled",
422 "bouncycastle-ocsp-unbundled",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700423 ],
424}
425
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100426// Builds the jsr166-tests library.
Colin Crossec80f4f2018-08-15 21:17:11 -0700427java_test {
Colin Cross3c6c2e22017-10-18 13:24:52 -0700428 name: "jsr166-tests",
429 srcs: ["jsr166-tests/src/test/java/**/*.java"],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100430 no_standard_libs: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700431 libs: [
Neil Fuller4207c7f2018-10-10 14:01:40 +0100432 "core-all",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700433 "junit",
434 ],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100435 system_modules: "core-all-system-modules",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700436}
Nan Zhang65f27a32018-01-05 10:41:46 -0800437
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100438// Builds a library just containing files from luni/src/test/filesystems
439// for use in tests.
Colin Crossec80f4f2018-08-15 21:17:11 -0700440java_library {
441 name: "filesystemstest",
442 compile_dex: true,
443 srcs: ["luni/src/test/filesystems/src/**/*.java"],
444 java_resource_dirs: ["luni/src/test/filesystems/resources"],
445 no_framework_libs: true,
446 errorprone: {
447 javacflags: ["-Xep:MissingOverride:OFF"],
448 },
449}
450
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100451// Builds a library just containing files from luni/src/test/parameter_metadata
452// for use in tests.
Colin Crossec80f4f2018-08-15 21:17:11 -0700453java_library {
454 name: "parameter-metadata-test",
455 compile_dex: true,
456 srcs: ["luni/src/test/parameter_metadata/src/**/*.java"],
457 no_framework_libs: true,
458 javacflags: ["-parameters"],
459 errorprone: {
460 javacflags: ["-Xep:MissingOverride:OFF"],
461 },
462}
463
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100464// Builds the core-tests library.
Colin Crossec80f4f2018-08-15 21:17:11 -0700465java_test {
466 name: "core-tests",
467 defaults: ["libcore_java_defaults"],
468 hostdex: true,
469 srcs: [
470 "dalvik/src/test/java/**/*.java",
471 "dalvik/test-rules/src/test/java/**/*.java",
472 "dom/src/test/java/**/*.java",
473 "harmony-tests/src/test/java/**/*.java",
474 "json/src/test/java/**/*.java",
475 "luni/src/test/java/**/*.java",
476 "xml/src/test/java/**/*.java",
477 ],
478 exclude_srcs: [
479 "luni/src/test/java/libcore/java/util/zip/Zip64Test.java",
480 "luni/src/test/java/libcore/java/util/zip/Zip64FileTest.java",
481 ],
482
483 java_resource_dirs: [
484 "*/src/test/java",
485 "*/src/test/resources",
486 ],
487 exclude_java_resource_dirs: [
488 "ojluni/src/test/java",
489 "ojluni/src/test/resources",
490 ],
491
492 java_resources: [
493 ":filesystemstest",
494 ":parameter-metadata-test",
495 ],
496
Neil Fuller4207c7f2018-10-10 14:01:40 +0100497 no_standard_libs: true,
498 libs: [
499 "core-all",
500 "okhttp",
501 "bouncycastle",
502 ],
503 system_modules: "core-all-system-modules",
504
Colin Crossec80f4f2018-08-15 21:17:11 -0700505 static_libs: [
506 "archive-patcher",
507 "core-test-rules",
508 "core-tests-support",
509 "junit-params",
510 "mockftpserver",
511 "mockito-target",
512 "mockwebserver",
513 "nist-pkix-tests",
514 "slf4j-jdk14",
515 "sqlite-jdbc",
516 "tzdata-testing",
517 ],
518
519 errorprone: {
520 javacflags: [
521 "-Xep:TryFailThrowable:ERROR",
522 "-Xep:ComparisonOutOfRange:ERROR",
523 ],
524 },
Simran Basi3be01e02018-08-21 17:53:49 -0700525
526 test_config: "AndroidTest-core-tests.xml",
Colin Crossec80f4f2018-08-15 21:17:11 -0700527}
528
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100529// Builds the core-ojtests library that contains test code from OpenJDK.
Colin Crossec80f4f2018-08-15 21:17:11 -0700530java_test {
531 name: "core-ojtests",
532 defaults: ["libcore_java_defaults"],
533 hostdex: true,
534
535 srcs: [
536 "ojluni/src/test/java/**/*.java",
537 ],
538 java_resource_dirs: [
539 "ojluni/src/test/java",
540 "ojluni/src/test/resources",
541 ],
Neil Fullerb669ccb2018-10-04 23:10:27 +0100542
Neil Fuller4207c7f2018-10-10 14:01:40 +0100543 no_standard_libs: true,
544 libs: [
545 "core-all",
546 "okhttp",
547 "bouncycastle",
548 ],
549 system_modules: "core-all-system-modules",
550
Colin Crossec80f4f2018-08-15 21:17:11 -0700551 static_libs: ["testng"],
552
553 // ojluni/src/test/java/util/stream/{bootlib,boottest}
554 // contains tests that are in packages from java.base;
555 // By default, OpenJDK 9's javac will only compile such
556 // code if it's declared to also be in java.base at
557 // compile time.
558 //
559 // For now, we use --patch-module to put all sources
560 // and dependencies from this make target into java.base;
561 // other source directories in this make target are in
562 // packages not from java.base; if this becomes a problem
563 // in future, this could be addressed eg. by splitting
564 // boot{lib,test} out into a separate make target,
565 // deleting those tests or moving them to a different
566 // package.
567 patch_module: "java.base",
568}
569
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100570// Builds the core-ojtests-public library. Excludes any private API tests.
571// Like core-ojtests but smaller.
Colin Crossec80f4f2018-08-15 21:17:11 -0700572java_test {
573 name: "core-ojtests-public",
574 defaults: ["libcore_java_defaults"],
575 srcs: [
576 "ojluni/src/test/java/**/*.java",
577 ],
578 // Filter out the following:
579 // 1.) DeserializeMethodTest and SerializedLambdaTest, because they depends on stub classes
580 // and won't actually run, and
581 // 2.) util/stream/boot*. Those directories contain classes in the package java.util.stream;
582 // excluding them means we don't need patch_module: "java.base"
583 exclude_srcs: [
584 "**/DeserializeMethodTest.java",
585 "**/SerializedLambdaTest.java",
586 "ojluni/src/test/java/util/stream/boot*/**/*",
587 ],
588 java_resource_dirs: [
589 "ojluni/src/test/java",
590 "ojluni/src/test/resources",
591 // Include source code as part of JAR
592 "ojluni/src/test/dist",
593 ],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100594
595 no_standard_libs: true,
596 libs: [
597 "core-all",
598 "bouncycastle",
599 "okhttp",
600 "testng",
601 ],
602 system_modules: "core-all-system-modules",
Colin Crossec80f4f2018-08-15 21:17:11 -0700603}
604
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100605// Exports annotated stubs source files in ojluni/annotations/sdk to make them
606// available to metalava. Used for nullability annotations in OpenJDK source.
Pete Gillin7db7faa2018-07-31 13:29:35 +0100607droiddoc_exported_dir {
Pete Gillin0728b742018-09-17 15:41:45 +0100608 name: "ojluni-annotated-sdk-stubs",
609 path: "ojluni/annotations/sdk",
Pete Gillin7db7faa2018-07-31 13:29:35 +0100610}
Pete Gillin600c7cf2018-08-16 19:28:38 +0100611droiddoc_exported_dir {
612 name: "ojluni-annotated-nullability-stubs",
613 path: "ojluni/annotations/sdk/nullability",
614}
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100615
616// Exports annotated stubs source files in ojluni/annotations/mmodules to make
617// them available to metalava. Used for core platform API and intra-code API
618// annotations in OpenJDK source.
Pete Gillinc9935b62018-09-25 14:42:40 +0100619droiddoc_exported_dir {
620 name: "ojluni-annotated-mmodule-stubs",
621 path: "ojluni/annotations/mmodule",
622}
Pete Gillin7db7faa2018-07-31 13:29:35 +0100623
Neil Fuller6f16b462018-09-04 15:40:39 +0100624// A file containing the list of tags that are "known" to us from the OpenJdk
625// source code and so should not cause an error or warning.
Nan Zhangd55722b2018-02-27 15:08:20 -0800626filegroup {
627 name: "known-oj-tags",
628 srcs: [
629 "known_oj_tags.txt",
630 ],
631}
Nan Zhang602fc0e2018-03-22 16:14:22 -0700632
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100633// Generates stubs for the parts of the public SDK API provided by the core
634// library.
Nan Zhangf0207602018-09-10 18:57:38 -0700635droidstubs {
636 name: "core-current-stubs-gen",
Neil Fuller866ed4a2018-09-06 12:05:46 +0100637 srcs: [":core_api_files"],
Tobias Thiererde991232018-03-07 15:10:46 +0000638 java_version: "1.9",
Nan Zhang602fc0e2018-03-22 16:14:22 -0700639 installable: false,
640 no_framework_libs: true,
Neil Fullerbe9258e2018-09-24 17:11:27 +0100641 args: " --exclude-annotations "
642 + "--hide-annotation libcore.api.Hide",
643 merge_inclusion_annotations_dirs: ["ojluni-annotated-mmodule-stubs"],
Nan Zhang602fc0e2018-03-22 16:14:22 -0700644}
645
Pete Gillin600c7cf2018-08-16 19:28:38 +0100646// Target for validating nullability annotations for correctness and
647// completeness. To check that there are no nullability errors:
648// make core-current-stubs-nullability-validation
649// To check that there are only the expected nullability warnings:
650// make core-current-stubs-nullability-validation-check-nullability-warnings
651// To update the the list of known expected nullability warnings:
652// make core-current-stubs-nullability-validation-update-nullability-warnings
653droidstubs {
654 name: "core-current-stubs-nullability-validation",
655 srcs: [":core_api_files"],
656 installable: false,
657 no_framework_libs: true,
658 annotations_enabled: true,
659 args: "--hide-annotation libcore.api.Hide " +
660 "--validate-nullability-from-merged-stubs ",
661 merge_inclusion_annotations_dirs: ["ojluni-annotated-mmodule-stubs"],
662 merge_annotations_dirs: [
663 "metalava-manual",
664 // N.B. Stubs in this filegroup will be validated:
665 "ojluni-annotated-nullability-stubs",
666 ],
Pete Gillinc5f179b2018-11-14 18:42:19 +0000667 // The list of classes which have nullability annotations included in the source.
668 // (This is in addition to those which have annotations in the merged stubs.)
669 validate_nullability_from_list: "nullability_annotated_classes.txt",
Pete Gillin600c7cf2018-08-16 19:28:38 +0100670 // The expected set of warnings about missing annotations:
671 check_nullability_warnings: "nullability_warnings.txt",
672}
673
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100674// A stubs target containing the parts of the public SDK API provided by the
675// core library.
676//
Neil Fullera6ba3592018-09-21 13:19:37 +0100677// Don't use this directly, use "sdk_version: core_current".
678java_library {
Nan Zhang602fc0e2018-03-22 16:14:22 -0700679 name: "core.current.stubs",
Nan Zhangf0207602018-09-10 18:57:38 -0700680 srcs: [":core-current-stubs-gen"],
Nan Zhang602fc0e2018-03-22 16:14:22 -0700681 errorprone: {
682 javacflags: [
683 "-Xep:MissingOverride:OFF",
684 ],
685 },
Tobias Thierer496a9382018-06-12 14:09:11 +0100686 openjdk9: {
687 javacflags: ["--patch-module=java.base=."],
688 },
Nan Zhang602fc0e2018-03-22 16:14:22 -0700689 no_standard_libs: true,
690 system_modules: "none",
691}
Neil Fullere784ef22018-11-16 15:54:30 +0000692
693// A host library containing time zone related classes. Used for
694// host-side tools and tests that have to deal with Android
695// time zone data.
696java_library_host {
697 name: "timezone-host",
698 srcs: [":timezone_host_files"],
699}