blob: 5c7000d469f099f68a256e2cd640f12456a7888f [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
Neil Fullere32e2e12019-02-26 11:48:30 +000059// OpenJDK source is not annotated with @hide so we need this separate
Neil Fuller866ed4a2018-09-06 12:05:46 +010060// 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
Neil Fullere32e2e12019-02-26 11:48:30 +000075// Some parts of libart are not annotated with @hide so we need this separate
Neil Fuller866ed4a2018-09-06 12:05:46 +010076// 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 Fullere32e2e12019-02-26 11:48:30 +000085// The set of files for the core library that have been marked up with @hide
86// for the public SDK APIs. Used from frameworks/base/ to indicate the source
87// files for inclusion in the public SDK docs.
88filegroup {
89 name: "core_public_api_files",
90 srcs: [
91 ":core_oj_api_files",
92 ":core_libart_api_files",
93 ":conscrypt_public_api_files",
94 ],
95}
96
Neil Fuller77e3f3b2018-10-19 10:22:32 +010097// The set of files for the core library that have been marked up with @hide and
98// API-related annotations. Note that this includes the intra-core and
99// core-platform APIs as well as the public APIs.
100//
Neil Fullere32e2e12019-02-26 11:48:30 +0000101// Some source files in :core_oj_api_files and :openjdk_mmodule_extra_files are
102// annotated by applying annotations to the .annotated.java stubs files in
103// ojluni/annotated/mmodules and rather than in the original source. See the comments
104// in openjdk_java_files.bp for more details.
Neil Fuller866ed4a2018-09-06 12:05:46 +0100105filegroup {
106 name: "core_api_files",
107 srcs: [
Neil Fullerd129bc92018-09-26 11:12:58 +0100108 ":apache-xml_api_files",
Neil Fullera77f7102018-09-21 19:04:41 +0100109 ":bouncycastle_java_files",
Neil Fuller603e1a72018-09-25 11:55:41 +0100110 ":conscrypt_java_files",
Neil Fuller866ed4a2018-09-06 12:05:46 +0100111 ":core_oj_api_files",
112 ":core_libart_api_files",
Neil Fuller641d5f92018-09-24 15:40:39 +0100113 ":okhttp_api_files",
Pete Gillinc9935b62018-09-25 14:42:40 +0100114 ":openjdk_mmodule_extra_files",
Neil Fuller866ed4a2018-09-06 12:05:46 +0100115 ],
116}
117
Colin Crossaf0b54c2017-09-27 17:22:32 -0700118java_defaults {
119 name: "libcore_java_defaults",
120 javacflags: [
121 //"-Xlint:all",
122 //"-Xlint:-serial,-deprecation,-unchecked",
123 ],
124 dxflags: ["--core-library"],
Andreas Gampe66b31732018-02-20 09:22:16 -0800125 errorprone: {
126 javacflags: [
127 "-Xep:MissingOverride:OFF", // Ignore missing @Override.
Andreas Gampe24a20172018-06-13 11:28:45 -0700128 "-Xep:ConstantOverflow:WARN", // Known constant overflow in SplittableRandom
Andreas Gampe66b31732018-02-20 09:22:16 -0800129 ],
130 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700131}
132
133//
134// Build for the target (device).
135//
136
Victor Chang7fef4052018-09-25 14:12:03 +0100137// Rule generating resource lib for android_icu4j.
138// In the downstream branch master-icu-dev, the resource files are generated.
139// This rule can't be moved external/icu because soong enforces that no_standard_libs:true can only
140// be used in libcore/ or development/
141java_library {
142 name: "android_icu4j_resources_lib",
143 java_resources: [":android_icu4j_resources"],
144 no_standard_libs: true,
145 system_modules: "none",
146}
147
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100148// A target used to bootstrap compilation for the core library.
149// See core-all-system-modules for more details.
Colin Crossaf0b54c2017-09-27 17:22:32 -0700150java_library {
151 name: "core-all",
Paul Duffin48ac7b62019-03-28 14:28:06 +0000152 visibility: [
153 "//external/apache-harmony:__subpackages__",
154 "//external/apache-xml",
155 "//external/bouncycastle",
156 "//external/conscrypt",
157 "//external/icu/android_icu4j",
158 "//external/okhttp",
159 "//libcore/mmodules/intracoreapi",
160 ],
Colin Crossaf0b54c2017-09-27 17:22:32 -0700161 defaults: ["libcore_java_defaults"],
162
163 srcs: [
Neil Fuller866ed4a2018-09-06 12:05:46 +0100164 ":core_oj_java_files",
165 ":core_libart_java_files",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700166 ":openjdk_lambda_stub_files",
Pete Gillin54035812019-05-08 15:09:39 +0100167 ":openjdk_generated_annotation_stub_files",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700168 ],
Colin Crossec80f4f2018-08-15 21:17:11 -0700169
170 no_standard_libs: true,
171 system_modules: "none",
Colin Crossa4d9fc42017-09-29 18:04:37 -0700172 openjdk9: {
173 srcs: ["luni/src/module/java/module-info.java"],
174 javacflags: ["--patch-module=java.base=."],
175 },
Colin Crossec80f4f2018-08-15 21:17:11 -0700176
Colin Crossaf0b54c2017-09-27 17:22:32 -0700177 java_resource_dirs: core_resource_dirs,
Victor Chang7fef4052018-09-25 14:12:03 +0100178 static_libs: ["android_icu4j_resources_lib"],
Tobias Thiererde991232018-03-07 15:10:46 +0000179 java_version: "1.9",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700180
Colin Crossaf0b54c2017-09-27 17:22:32 -0700181 installable: false,
182}
183
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100184// A system modules definition for use by core library targets only. It only
185// contains the core-all jar, which contains the classes that end up in core-oj,
186// core-libart as well as the lambda stubs needed to compile Java lambda code.
187// It does not contain other parts of core library like conscrypt, bouncycastle,
188// etc. This system_modules definition is used to bootstrap compilation for
189// other parts of the core library like core-oj, core-libart, conscrypt,
190// bouncycastle, etc.
191//
192// If you want to compile against the entire core library implementation, for
193// example to build core library tests, see "core-system-modules" instead.
Colin Crossa4d9fc42017-09-29 18:04:37 -0700194java_system_modules {
195 name: "core-all-system-modules",
196 libs: ["core-all"],
197}
198
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100199// Contains the parts of core library associated with OpenJDK.
Colin Crossaf0b54c2017-09-27 17:22:32 -0700200java_library {
201 name: "core-oj",
Paul Duffin48ac7b62019-03-28 14:28:06 +0000202 visibility: [
203 "//art/build/apex",
204 "//external/wycheproof",
205 ],
Colin Crossaf0b54c2017-09-27 17:22:32 -0700206 defaults: ["libcore_java_defaults"],
Colin Cross5b75cdd2018-06-27 11:00:13 -0700207 installable: true,
Colin Crossbb180be2017-10-09 14:54:53 -0700208 hostdex: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700209
Neil Fuller866ed4a2018-09-06 12:05:46 +0100210 srcs: [":core_oj_java_files"],
Colin Crossaf0b54c2017-09-27 17:22:32 -0700211 java_resource_dirs: core_resource_dirs,
Colin Crossec80f4f2018-08-15 21:17:11 -0700212
213 no_standard_libs: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700214 libs: ["core-all"],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700215 system_modules: "core-all-system-modules",
216 openjdk9: {
217 javacflags: ["--patch-module=java.base=."],
218 },
Colin Crossec80f4f2018-08-15 21:17:11 -0700219
Pete Gillin7a7a6d22017-12-19 14:56:03 +0000220 jacoco: {
Pete Gillin27ca0582018-01-10 17:04:17 +0000221 exclude_filter: [
Pete Gillin3f59bad2018-01-30 11:20:29 +0000222 "java.lang.Class",
223 "java.lang.Long",
224 "java.lang.Number",
225 "java.lang.Object",
226 "java.lang.String",
227 "java.lang.invoke.MethodHandle",
228 "java.lang.ref.Reference",
229 "java.lang.reflect.Proxy",
Pete Gillinb1868ada2018-01-17 11:03:10 +0000230 "java.util.AbstractMap",
Pete Gillin3f59bad2018-01-30 11:20:29 +0000231 "java.util.HashMap",
232 "java.util.HashMap$Node",
Pete Gillinb1868ada2018-01-17 11:03:10 +0000233 "java.util.Map",
Pete Gillin7a7a6d22017-12-19 14:56:03 +0000234 ],
235 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700236
237 notice: "ojluni/NOTICE",
238
Colin Crossaf0b54c2017-09-27 17:22:32 -0700239}
240
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100241// Contains parts of core library not associated with OpenJDK. Contains not
242// just java.*, javax.* code but also android.icu.*, android.system.* and
243// various internal libcore.* packages.
Colin Crossaf0b54c2017-09-27 17:22:32 -0700244java_library {
245 name: "core-libart",
Paul Duffin48ac7b62019-03-28 14:28:06 +0000246 visibility: [
247 "//art/build/apex",
248 "//external/robolectric-shadows",
249 "//external/wycheproof",
250 ],
Colin Crossaf0b54c2017-09-27 17:22:32 -0700251 defaults: ["libcore_java_defaults"],
Colin Cross5b75cdd2018-06-27 11:00:13 -0700252 installable: true,
Colin Crossbb180be2017-10-09 14:54:53 -0700253 hostdex: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700254
Neil Fuller866ed4a2018-09-06 12:05:46 +0100255 srcs: [":core_libart_java_files"],
Victor Chang7fef4052018-09-25 14:12:03 +0100256 static_libs: ["android_icu4j_resources_lib"],
Tobias Thiererde991232018-03-07 15:10:46 +0000257 java_version: "1.9",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700258
Colin Crossec80f4f2018-08-15 21:17:11 -0700259 no_standard_libs: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700260 libs: ["core-all"],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700261 system_modules: "core-all-system-modules",
262 openjdk9: {
263 javacflags: ["--patch-module=java.base=."],
264 },
Colin Crossec80f4f2018-08-15 21:17:11 -0700265
Pete Gillin80ebe872018-02-13 15:21:20 +0000266 jacoco: {
267 exclude_filter: [
268 "java.lang.DexCache",
269 "dalvik.system.ClassExt",
270 ],
271 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700272
Andreas Gampe9a1ba892019-04-24 12:35:40 -0700273 target: {
274 hostdex: {
275 required: [
276 // Files used to simulate the /system and runtime APEX dir
277 // structure on host.
278 "tzdata_host",
279 "tzdata_host_runtime_apex",
280 "tzlookup.xml_host_runtime_apex",
281 "tz_version_host",
282 "tz_version_host_runtime_apex",
283 ],
284 },
285 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700286}
287
Paul Duffin7bb8d232018-10-23 11:48:38 +0100288// Provided solely to contribute information about which hidden parts of the
289// core-oj API are used by apps.
290java_library {
291 name: "core-oj-hiddenapi",
Paul Duffin48ac7b62019-03-28 14:28:06 +0000292 // Do not allow this to be accessed from outside this directory.
293 visibility: ["//visibility:private"],
Paul Duffin7bb8d232018-10-23 11:48:38 +0100294 defaults: ["libcore_java_defaults"],
295 compile_dex: true,
296
297 srcs: [":openjdk_hiddenapi_javadoc_files"],
298
299 no_standard_libs: true,
300 libs: ["core-all"],
301 system_modules: "core-all-system-modules",
302 openjdk9: {
303 javacflags: ["--patch-module=java.base=."],
304 },
305}
306
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100307//
308// Guaranteed unstripped versions of core-oj and core-libart.
309//
Colin Cross3c6c2e22017-10-18 13:24:52 -0700310// The build system may or may not strip the core-oj and core-libart jars,
311// but these will not be stripped. See b/24535627.
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100312//
313
Colin Cross3c6c2e22017-10-18 13:24:52 -0700314java_library {
315 name: "core-oj-testdex",
Colin Cross5b75cdd2018-06-27 11:00:13 -0700316 installable: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700317 static_libs: ["core-oj"],
318 no_standard_libs: true,
319 libs: ["core-all"],
320 system_modules: "core-all-system-modules",
321 dxflags: ["--core-library"],
Colin Cross485ed362017-12-05 17:24:22 -0800322 dex_preopt: {
323 enabled: false,
324 },
Tobias Thiererde991232018-03-07 15:10:46 +0000325 java_version: "1.9",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700326 notice: "ojluni/NOTICE",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700327}
328
329java_library {
330 name: "core-libart-testdex",
Colin Cross5b75cdd2018-06-27 11:00:13 -0700331 installable: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700332 static_libs: ["core-libart"],
333 no_standard_libs: true,
334 libs: ["core-all"],
335 system_modules: "core-all-system-modules",
336 dxflags: ["--core-library"],
Colin Cross485ed362017-12-05 17:24:22 -0800337 dex_preopt: {
338 enabled: false,
339 },
Colin Cross3c6c2e22017-10-18 13:24:52 -0700340 notice: "ojluni/NOTICE",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700341}
342
Tobias Thierere0f8b312018-10-23 23:12:30 +0100343java_defaults {
344 name: "core_lambda_stubs_defaults",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700345 defaults: ["libcore_java_defaults"],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100346 hostdex: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700347
Colin Crossec80f4f2018-08-15 21:17:11 -0700348 no_standard_libs: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700349 libs: ["core-all"],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700350 system_modules: "core-all-system-modules",
351 openjdk9: {
352 javacflags: ["--patch-module=java.base=."],
353 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700354
355 notice: "ojluni/NOTICE",
356
357 installable: false,
358 include_srcs: true,
359}
Colin Crossa4d9fc42017-09-29 18:04:37 -0700360
Tobias Thierere0f8b312018-10-23 23:12:30 +0100361// Creates a jar that exists to satisfy javac when compiling source code that
362// contains lambdas. This contains all classes / methods required by javac
363// when generating invoke-dynamic lambda implementation code, even those that
364// are also in the public SDK API from API level 26 onwards.
365java_library {
366 name: "core-lambda-stubs",
367 defaults: ["core_lambda_stubs_defaults"],
368 srcs: [
369 ":openjdk_lambda_stub_files",
370 ":openjdk_lambda_duplicate_stub_files",
371 ],
372}
373
374// An alternative to core-lambda-stubs that omits openjdk_lambda_duplicate_stub_files
375// because those classes are also part of the core library public SDK API
376// (since API level 26).
377java_library {
378 name: "core-lambda-stubs-for-system-modules",
379 defaults: ["core_lambda_stubs_defaults"],
380 srcs: [
381 ":openjdk_lambda_stub_files",
382 ],
383}
384
Pete Gillin54035812019-05-08 15:09:39 +0100385
386// Creates a jar that exists to satisfy javac when compiling source code that
387// contains @Generated annotations, which are produced by some code generation
388// tools (notably dagger) but aren't part of the Android API.
389// See http://b/123891440.
390java_library {
391 name: "core-generated-annotation-stubs",
392 defaults: ["libcore_java_defaults"],
393 srcs: [
394 ":openjdk_generated_annotation_stub_files",
395 ],
396 hostdex: true,
397 no_standard_libs: true,
398 libs: ["core-all"],
399 system_modules: "core-all-system-modules",
400 openjdk9: {
401 javacflags: ["--patch-module=java.base=."],
402 },
403 notice: "ojluni/NOTICE",
404 installable: false,
405 include_srcs: true,
406}
407
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100408// A system modules definition containing the implementations for the various
409// parts that make up the core library.
410//
411// This system module is intended for use by tests that may need access to
412// core library internals. It should not be generally used; most of the
413// platform build should build against API stubs instead. See
414// "core-platform-api-stubs-system-modules", which is the default used by the
415// Android build.
416//
417// This module also includes lambda stubs for compiling source containing
418// Java lambdas.
Colin Crossa4d9fc42017-09-29 18:04:37 -0700419java_system_modules {
420 name: "core-system-modules",
421 libs: [
422 "core-oj",
423 "core-libart",
Neil Fullerb669ccb2018-10-04 23:10:27 +0100424 "bouncycastle",
425 "conscrypt",
426 "okhttp",
Neil Fuller05723a52018-10-19 10:55:05 +0100427 "apache-xml",
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100428 // This one is not on device but it's needed when javac compiles code
429 // containing lambdas.
Tobias Thierere0f8b312018-10-23 23:12:30 +0100430 "core-lambda-stubs-for-system-modules",
Colin Crossa4d9fc42017-09-29 18:04:37 -0700431 ],
432}
Colin Cross3c6c2e22017-10-18 13:24:52 -0700433
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100434// Builds libcore test rules
Colin Cross3c6c2e22017-10-18 13:24:52 -0700435java_library_static {
436 name: "core-test-rules",
437 hostdex: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700438 srcs: [
439 "dalvik/test-rules/src/main/**/*.java",
440 "test-rules/src/main/**/*.java",
441 ],
442 static_libs: ["junit"],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100443
444 no_standard_libs: true,
445 libs: ["core-all"],
446 system_modules: "core-all-system-modules",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700447}
448
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100449// Builds the core-tests-support library used by various tests.
Colin Cross3c6c2e22017-10-18 13:24:52 -0700450java_library_static {
451 name: "core-tests-support",
452 hostdex: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700453 srcs: ["support/src/test/java/**/*.java"],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100454
Neil Fuller4380ab22018-10-18 19:38:53 +0100455 no_framework_libs: true,
456 libs: ["junit"],
Colin Cross3c6c2e22017-10-18 13:24:52 -0700457 static_libs: [
Neil Fullerde8b0862018-10-12 21:53:31 +0100458 "bouncycastle-unbundled",
459 "bouncycastle-bcpkix-unbundled",
460 "bouncycastle-ocsp-unbundled",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700461 ],
462}
463
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100464// Builds the jsr166-tests library.
Colin Crossec80f4f2018-08-15 21:17:11 -0700465java_test {
Colin Cross3c6c2e22017-10-18 13:24:52 -0700466 name: "jsr166-tests",
467 srcs: ["jsr166-tests/src/test/java/**/*.java"],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100468 no_standard_libs: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700469 libs: [
Neil Fuller4207c7f2018-10-10 14:01:40 +0100470 "core-all",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700471 "junit",
472 ],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100473 system_modules: "core-all-system-modules",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700474}
Nan Zhang65f27a32018-01-05 10:41:46 -0800475
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100476// Builds a library just containing files from luni/src/test/filesystems
477// for use in tests.
Colin Crossec80f4f2018-08-15 21:17:11 -0700478java_library {
479 name: "filesystemstest",
480 compile_dex: true,
481 srcs: ["luni/src/test/filesystems/src/**/*.java"],
482 java_resource_dirs: ["luni/src/test/filesystems/resources"],
483 no_framework_libs: true,
484 errorprone: {
485 javacflags: ["-Xep:MissingOverride:OFF"],
486 },
487}
488
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100489// Builds a library just containing files from luni/src/test/parameter_metadata
490// for use in tests.
Colin Crossec80f4f2018-08-15 21:17:11 -0700491java_library {
492 name: "parameter-metadata-test",
493 compile_dex: true,
494 srcs: ["luni/src/test/parameter_metadata/src/**/*.java"],
495 no_framework_libs: true,
496 javacflags: ["-parameters"],
497 errorprone: {
498 javacflags: ["-Xep:MissingOverride:OFF"],
499 },
500}
501
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100502// Builds the core-tests library.
Colin Crossec80f4f2018-08-15 21:17:11 -0700503java_test {
504 name: "core-tests",
505 defaults: ["libcore_java_defaults"],
506 hostdex: true,
507 srcs: [
508 "dalvik/src/test/java/**/*.java",
509 "dalvik/test-rules/src/test/java/**/*.java",
510 "dom/src/test/java/**/*.java",
511 "harmony-tests/src/test/java/**/*.java",
512 "json/src/test/java/**/*.java",
513 "luni/src/test/java/**/*.java",
Paul Duffin4ba14532019-03-21 10:32:41 +0000514 "test-rules/src/test/java/**/*.java",
Colin Crossec80f4f2018-08-15 21:17:11 -0700515 "xml/src/test/java/**/*.java",
516 ],
517 exclude_srcs: [
518 "luni/src/test/java/libcore/java/util/zip/Zip64Test.java",
519 "luni/src/test/java/libcore/java/util/zip/Zip64FileTest.java",
520 ],
521
522 java_resource_dirs: [
523 "*/src/test/java",
524 "*/src/test/resources",
525 ],
526 exclude_java_resource_dirs: [
527 "ojluni/src/test/java",
528 "ojluni/src/test/resources",
529 ],
530
531 java_resources: [
Paul Duffin16a057f2019-05-13 12:20:55 +0100532 ":annotations-test",
Colin Crossec80f4f2018-08-15 21:17:11 -0700533 ":filesystemstest",
534 ":parameter-metadata-test",
535 ],
536
Neil Fuller4207c7f2018-10-10 14:01:40 +0100537 no_standard_libs: true,
538 libs: [
539 "core-all",
540 "okhttp",
541 "bouncycastle",
542 ],
543 system_modules: "core-all-system-modules",
544
Colin Crossec80f4f2018-08-15 21:17:11 -0700545 static_libs: [
546 "archive-patcher",
547 "core-test-rules",
548 "core-tests-support",
549 "junit-params",
550 "mockftpserver",
551 "mockito-target",
552 "mockwebserver",
553 "nist-pkix-tests",
554 "slf4j-jdk14",
555 "sqlite-jdbc",
556 "tzdata-testing",
Paul Duffina4df2372018-12-10 15:48:01 +0000557 "truth-prebuilt",
Colin Crossec80f4f2018-08-15 21:17:11 -0700558 ],
559
560 errorprone: {
561 javacflags: [
562 "-Xep:TryFailThrowable:ERROR",
563 "-Xep:ComparisonOutOfRange:ERROR",
564 ],
565 },
Simran Basi3be01e02018-08-21 17:53:49 -0700566
567 test_config: "AndroidTest-core-tests.xml",
Colin Crossec80f4f2018-08-15 21:17:11 -0700568}
569
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100570// Builds the core-ojtests library that contains test code from OpenJDK.
Colin Crossec80f4f2018-08-15 21:17:11 -0700571java_test {
572 name: "core-ojtests",
573 defaults: ["libcore_java_defaults"],
574 hostdex: true,
575
576 srcs: [
577 "ojluni/src/test/java/**/*.java",
578 ],
579 java_resource_dirs: [
580 "ojluni/src/test/java",
581 "ojluni/src/test/resources",
582 ],
Neil Fullerb669ccb2018-10-04 23:10:27 +0100583
Neil Fuller4207c7f2018-10-10 14:01:40 +0100584 no_standard_libs: true,
585 libs: [
586 "core-all",
587 "okhttp",
588 "bouncycastle",
589 ],
590 system_modules: "core-all-system-modules",
591
Colin Crossec80f4f2018-08-15 21:17:11 -0700592 static_libs: ["testng"],
593
594 // ojluni/src/test/java/util/stream/{bootlib,boottest}
595 // contains tests that are in packages from java.base;
596 // By default, OpenJDK 9's javac will only compile such
597 // code if it's declared to also be in java.base at
598 // compile time.
599 //
600 // For now, we use --patch-module to put all sources
601 // and dependencies from this make target into java.base;
602 // other source directories in this make target are in
603 // packages not from java.base; if this becomes a problem
604 // in future, this could be addressed eg. by splitting
605 // boot{lib,test} out into a separate make target,
606 // deleting those tests or moving them to a different
607 // package.
608 patch_module: "java.base",
609}
610
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100611// Builds the core-ojtests-public library. Excludes any private API tests.
612// Like core-ojtests but smaller.
Colin Crossec80f4f2018-08-15 21:17:11 -0700613java_test {
614 name: "core-ojtests-public",
615 defaults: ["libcore_java_defaults"],
616 srcs: [
617 "ojluni/src/test/java/**/*.java",
618 ],
619 // Filter out the following:
620 // 1.) DeserializeMethodTest and SerializedLambdaTest, because they depends on stub classes
621 // and won't actually run, and
622 // 2.) util/stream/boot*. Those directories contain classes in the package java.util.stream;
623 // excluding them means we don't need patch_module: "java.base"
624 exclude_srcs: [
625 "**/DeserializeMethodTest.java",
626 "**/SerializedLambdaTest.java",
627 "ojluni/src/test/java/util/stream/boot*/**/*",
628 ],
629 java_resource_dirs: [
630 "ojluni/src/test/java",
631 "ojluni/src/test/resources",
632 // Include source code as part of JAR
633 "ojluni/src/test/dist",
634 ],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100635
636 no_standard_libs: true,
637 libs: [
638 "core-all",
639 "bouncycastle",
640 "okhttp",
641 "testng",
642 ],
643 system_modules: "core-all-system-modules",
Colin Crossec80f4f2018-08-15 21:17:11 -0700644}
645
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100646// Exports annotated stubs source files in ojluni/annotations/sdk to make them
647// available to metalava. Used for nullability annotations in OpenJDK source.
Pete Gillin7db7faa2018-07-31 13:29:35 +0100648droiddoc_exported_dir {
Pete Gillin0728b742018-09-17 15:41:45 +0100649 name: "ojluni-annotated-sdk-stubs",
650 path: "ojluni/annotations/sdk",
Pete Gillin7db7faa2018-07-31 13:29:35 +0100651}
Paul Duffin48ac7b62019-03-28 14:28:06 +0000652
Pete Gillin600c7cf2018-08-16 19:28:38 +0100653droiddoc_exported_dir {
654 name: "ojluni-annotated-nullability-stubs",
655 path: "ojluni/annotations/sdk/nullability",
656}
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100657
658// Exports annotated stubs source files in ojluni/annotations/mmodules to make
659// them available to metalava. Used for core platform API and intra-code API
660// annotations in OpenJDK source.
Pete Gillinc9935b62018-09-25 14:42:40 +0100661droiddoc_exported_dir {
662 name: "ojluni-annotated-mmodule-stubs",
663 path: "ojluni/annotations/mmodule",
664}
Pete Gillin7db7faa2018-07-31 13:29:35 +0100665
Neil Fuller6f16b462018-09-04 15:40:39 +0100666// A file containing the list of tags that are "known" to us from the OpenJdk
667// source code and so should not cause an error or warning.
Nan Zhangd55722b2018-02-27 15:08:20 -0800668filegroup {
669 name: "known-oj-tags",
670 srcs: [
671 "known_oj_tags.txt",
672 ],
673}
Nan Zhang602fc0e2018-03-22 16:14:22 -0700674
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100675// Generates stubs for the parts of the public SDK API provided by the core
676// library.
Paul Duffin0ca3cbe2019-02-14 15:47:58 +0000677//
678// Only for use by core.current.stubs target below.
Nan Zhangf0207602018-09-10 18:57:38 -0700679droidstubs {
680 name: "core-current-stubs-gen",
Neil Fuller866ed4a2018-09-06 12:05:46 +0100681 srcs: [":core_api_files"],
Tobias Thiererde991232018-03-07 15:10:46 +0000682 java_version: "1.9",
Nan Zhang602fc0e2018-03-22 16:14:22 -0700683 installable: false,
684 no_framework_libs: true,
Neil Fullerbe9258e2018-09-24 17:11:27 +0100685 args: " --exclude-annotations "
686 + "--hide-annotation libcore.api.Hide",
687 merge_inclusion_annotations_dirs: ["ojluni-annotated-mmodule-stubs"],
Nan Zhang602fc0e2018-03-22 16:14:22 -0700688}
689
Paul Duffin0ca3cbe2019-02-14 15:47:58 +0000690// A stubs target containing the parts of the public SDK API provided by the
691// core library.
692//
693// Don't use this directly, use "sdk_version: core_current".
694java_library {
695 name: "core.current.stubs",
696 srcs: [":core-current-stubs-gen"],
697 errorprone: {
698 javacflags: [
699 "-Xep:MissingOverride:OFF",
700 ],
701 },
702 openjdk9: {
703 javacflags: ["--patch-module=java.base=."],
704 },
705 no_standard_libs: true,
706 system_modules: "none",
Paul Duffin65641182019-04-08 10:24:23 +0100707
708 dist: {
709 targets: [
710 "sdk",
711 "win_sdk",
712 ],
713 },
Paul Duffin0ca3cbe2019-02-14 15:47:58 +0000714}
715
Pete Gillin600c7cf2018-08-16 19:28:38 +0100716// Target for validating nullability annotations for correctness and
717// completeness. To check that there are no nullability errors:
718// make core-current-stubs-nullability-validation
719// To check that there are only the expected nullability warnings:
720// make core-current-stubs-nullability-validation-check-nullability-warnings
721// To update the the list of known expected nullability warnings:
722// make core-current-stubs-nullability-validation-update-nullability-warnings
723droidstubs {
724 name: "core-current-stubs-nullability-validation",
725 srcs: [":core_api_files"],
726 installable: false,
727 no_framework_libs: true,
728 annotations_enabled: true,
729 args: "--hide-annotation libcore.api.Hide " +
730 "--validate-nullability-from-merged-stubs ",
731 merge_inclusion_annotations_dirs: ["ojluni-annotated-mmodule-stubs"],
732 merge_annotations_dirs: [
733 "metalava-manual",
734 // N.B. Stubs in this filegroup will be validated:
735 "ojluni-annotated-nullability-stubs",
736 ],
Pete Gillinc5f179b2018-11-14 18:42:19 +0000737 // The list of classes which have nullability annotations included in the source.
738 // (This is in addition to those which have annotations in the merged stubs.)
739 validate_nullability_from_list: "nullability_annotated_classes.txt",
Pete Gillin600c7cf2018-08-16 19:28:38 +0100740 // The expected set of warnings about missing annotations:
741 check_nullability_warnings: "nullability_warnings.txt",
742}
743
Neil Fullere784ef22018-11-16 15:54:30 +0000744// A host library containing time zone related classes. Used for
745// host-side tools and tests that have to deal with Android
746// time zone data.
747java_library_host {
748 name: "timezone-host",
749 srcs: [":timezone_host_files"],
750}
Andrei Onea24892e22019-04-16 16:48:37 +0100751
752// The source files that contain the UnsupportedAppUsage annotation and its dependencies.
753filegroup {
754 name: "unsupportedappusage_annotation_files",
755 srcs: [
756 "dalvik/src/main/java/dalvik/annotation/compat/UnsupportedAppUsage.java",
757 "dalvik/src/main/java/dalvik/system/VersionCodes.java",
758 "luni/src/main/java/libcore/api/CorePlatformApi.java",
759 "luni/src/main/java/libcore/api/IntraCoreApi.java",
760 ],
Neil Fuller86345d72019-04-25 09:15:32 +0100761}