blob: 1e4407c4917e7dec8ddd98acd7198e960ba1a9df [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: [
532 ":filesystemstest",
533 ":parameter-metadata-test",
534 ],
535
Neil Fuller4207c7f2018-10-10 14:01:40 +0100536 no_standard_libs: true,
537 libs: [
538 "core-all",
539 "okhttp",
540 "bouncycastle",
541 ],
542 system_modules: "core-all-system-modules",
543
Colin Crossec80f4f2018-08-15 21:17:11 -0700544 static_libs: [
545 "archive-patcher",
546 "core-test-rules",
547 "core-tests-support",
548 "junit-params",
549 "mockftpserver",
550 "mockito-target",
551 "mockwebserver",
552 "nist-pkix-tests",
553 "slf4j-jdk14",
554 "sqlite-jdbc",
555 "tzdata-testing",
Paul Duffina4df2372018-12-10 15:48:01 +0000556 "truth-prebuilt",
Colin Crossec80f4f2018-08-15 21:17:11 -0700557 ],
558
559 errorprone: {
560 javacflags: [
561 "-Xep:TryFailThrowable:ERROR",
562 "-Xep:ComparisonOutOfRange:ERROR",
563 ],
564 },
Simran Basi3be01e02018-08-21 17:53:49 -0700565
566 test_config: "AndroidTest-core-tests.xml",
Colin Crossec80f4f2018-08-15 21:17:11 -0700567}
568
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100569// Builds the core-ojtests library that contains test code from OpenJDK.
Colin Crossec80f4f2018-08-15 21:17:11 -0700570java_test {
571 name: "core-ojtests",
572 defaults: ["libcore_java_defaults"],
573 hostdex: true,
574
575 srcs: [
576 "ojluni/src/test/java/**/*.java",
577 ],
578 java_resource_dirs: [
579 "ojluni/src/test/java",
580 "ojluni/src/test/resources",
581 ],
Neil Fullerb669ccb2018-10-04 23:10:27 +0100582
Neil Fuller4207c7f2018-10-10 14:01:40 +0100583 no_standard_libs: true,
584 libs: [
585 "core-all",
586 "okhttp",
587 "bouncycastle",
588 ],
589 system_modules: "core-all-system-modules",
590
Colin Crossec80f4f2018-08-15 21:17:11 -0700591 static_libs: ["testng"],
592
593 // ojluni/src/test/java/util/stream/{bootlib,boottest}
594 // contains tests that are in packages from java.base;
595 // By default, OpenJDK 9's javac will only compile such
596 // code if it's declared to also be in java.base at
597 // compile time.
598 //
599 // For now, we use --patch-module to put all sources
600 // and dependencies from this make target into java.base;
601 // other source directories in this make target are in
602 // packages not from java.base; if this becomes a problem
603 // in future, this could be addressed eg. by splitting
604 // boot{lib,test} out into a separate make target,
605 // deleting those tests or moving them to a different
606 // package.
607 patch_module: "java.base",
608}
609
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100610// Builds the core-ojtests-public library. Excludes any private API tests.
611// Like core-ojtests but smaller.
Colin Crossec80f4f2018-08-15 21:17:11 -0700612java_test {
613 name: "core-ojtests-public",
614 defaults: ["libcore_java_defaults"],
615 srcs: [
616 "ojluni/src/test/java/**/*.java",
617 ],
618 // Filter out the following:
619 // 1.) DeserializeMethodTest and SerializedLambdaTest, because they depends on stub classes
620 // and won't actually run, and
621 // 2.) util/stream/boot*. Those directories contain classes in the package java.util.stream;
622 // excluding them means we don't need patch_module: "java.base"
623 exclude_srcs: [
624 "**/DeserializeMethodTest.java",
625 "**/SerializedLambdaTest.java",
626 "ojluni/src/test/java/util/stream/boot*/**/*",
627 ],
628 java_resource_dirs: [
629 "ojluni/src/test/java",
630 "ojluni/src/test/resources",
631 // Include source code as part of JAR
632 "ojluni/src/test/dist",
633 ],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100634
635 no_standard_libs: true,
636 libs: [
637 "core-all",
638 "bouncycastle",
639 "okhttp",
640 "testng",
641 ],
642 system_modules: "core-all-system-modules",
Colin Crossec80f4f2018-08-15 21:17:11 -0700643}
644
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100645// Exports annotated stubs source files in ojluni/annotations/sdk to make them
646// available to metalava. Used for nullability annotations in OpenJDK source.
Pete Gillin7db7faa2018-07-31 13:29:35 +0100647droiddoc_exported_dir {
Pete Gillin0728b742018-09-17 15:41:45 +0100648 name: "ojluni-annotated-sdk-stubs",
649 path: "ojluni/annotations/sdk",
Pete Gillin7db7faa2018-07-31 13:29:35 +0100650}
Paul Duffin48ac7b62019-03-28 14:28:06 +0000651
Pete Gillin600c7cf2018-08-16 19:28:38 +0100652droiddoc_exported_dir {
653 name: "ojluni-annotated-nullability-stubs",
654 path: "ojluni/annotations/sdk/nullability",
655}
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100656
657// Exports annotated stubs source files in ojluni/annotations/mmodules to make
658// them available to metalava. Used for core platform API and intra-code API
659// annotations in OpenJDK source.
Pete Gillinc9935b62018-09-25 14:42:40 +0100660droiddoc_exported_dir {
661 name: "ojluni-annotated-mmodule-stubs",
662 path: "ojluni/annotations/mmodule",
663}
Pete Gillin7db7faa2018-07-31 13:29:35 +0100664
Neil Fuller6f16b462018-09-04 15:40:39 +0100665// A file containing the list of tags that are "known" to us from the OpenJdk
666// source code and so should not cause an error or warning.
Nan Zhangd55722b2018-02-27 15:08:20 -0800667filegroup {
668 name: "known-oj-tags",
669 srcs: [
670 "known_oj_tags.txt",
671 ],
672}
Nan Zhang602fc0e2018-03-22 16:14:22 -0700673
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100674// Generates stubs for the parts of the public SDK API provided by the core
675// library.
Paul Duffin0ca3cbe2019-02-14 15:47:58 +0000676//
677// Only for use by core.current.stubs target below.
Nan Zhangf0207602018-09-10 18:57:38 -0700678droidstubs {
679 name: "core-current-stubs-gen",
Neil Fuller866ed4a2018-09-06 12:05:46 +0100680 srcs: [":core_api_files"],
Tobias Thiererde991232018-03-07 15:10:46 +0000681 java_version: "1.9",
Nan Zhang602fc0e2018-03-22 16:14:22 -0700682 installable: false,
683 no_framework_libs: true,
Neil Fullerbe9258e2018-09-24 17:11:27 +0100684 args: " --exclude-annotations "
685 + "--hide-annotation libcore.api.Hide",
686 merge_inclusion_annotations_dirs: ["ojluni-annotated-mmodule-stubs"],
Nan Zhang602fc0e2018-03-22 16:14:22 -0700687}
688
Paul Duffin0ca3cbe2019-02-14 15:47:58 +0000689// A stubs target containing the parts of the public SDK API provided by the
690// core library.
691//
692// Don't use this directly, use "sdk_version: core_current".
693java_library {
694 name: "core.current.stubs",
695 srcs: [":core-current-stubs-gen"],
696 errorprone: {
697 javacflags: [
698 "-Xep:MissingOverride:OFF",
699 ],
700 },
701 openjdk9: {
702 javacflags: ["--patch-module=java.base=."],
703 },
704 no_standard_libs: true,
705 system_modules: "none",
Paul Duffin65641182019-04-08 10:24:23 +0100706
707 dist: {
708 targets: [
709 "sdk",
710 "win_sdk",
711 ],
712 },
Paul Duffin0ca3cbe2019-02-14 15:47:58 +0000713}
714
Pete Gillin600c7cf2018-08-16 19:28:38 +0100715// Target for validating nullability annotations for correctness and
716// completeness. To check that there are no nullability errors:
717// make core-current-stubs-nullability-validation
718// To check that there are only the expected nullability warnings:
719// make core-current-stubs-nullability-validation-check-nullability-warnings
720// To update the the list of known expected nullability warnings:
721// make core-current-stubs-nullability-validation-update-nullability-warnings
722droidstubs {
723 name: "core-current-stubs-nullability-validation",
724 srcs: [":core_api_files"],
725 installable: false,
726 no_framework_libs: true,
727 annotations_enabled: true,
728 args: "--hide-annotation libcore.api.Hide " +
729 "--validate-nullability-from-merged-stubs ",
730 merge_inclusion_annotations_dirs: ["ojluni-annotated-mmodule-stubs"],
731 merge_annotations_dirs: [
732 "metalava-manual",
733 // N.B. Stubs in this filegroup will be validated:
734 "ojluni-annotated-nullability-stubs",
735 ],
Pete Gillinc5f179b2018-11-14 18:42:19 +0000736 // The list of classes which have nullability annotations included in the source.
737 // (This is in addition to those which have annotations in the merged stubs.)
738 validate_nullability_from_list: "nullability_annotated_classes.txt",
Pete Gillin600c7cf2018-08-16 19:28:38 +0100739 // The expected set of warnings about missing annotations:
740 check_nullability_warnings: "nullability_warnings.txt",
741}
742
Neil Fullere784ef22018-11-16 15:54:30 +0000743// A host library containing time zone related classes. Used for
744// host-side tools and tests that have to deal with Android
745// time zone data.
746java_library_host {
747 name: "timezone-host",
748 srcs: [":timezone_host_files"],
749}
Andrei Onea24892e22019-04-16 16:48:37 +0100750
751// The source files that contain the UnsupportedAppUsage annotation and its dependencies.
752filegroup {
753 name: "unsupportedappusage_annotation_files",
754 srcs: [
755 "dalvik/src/main/java/dalvik/annotation/compat/UnsupportedAppUsage.java",
756 "dalvik/src/main/java/dalvik/system/VersionCodes.java",
757 "luni/src/main/java/libcore/api/CorePlatformApi.java",
758 "luni/src/main/java/libcore/api/IntraCoreApi.java",
759 ],
Neil Fuller86345d72019-04-25 09:15:32 +0100760}