blob: 1a46d48784c9296de7e60df6bef514dfe36c00c4 [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"],
Colin Crossaf0b54c2017-09-27 17:22:32 -0700159
160 required: [
161 "tzdata",
162 "tzlookup.xml",
163 ],
164
165 installable: false,
166}
167
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100168// A system modules definition for use by core library targets only. It only
169// contains the core-all jar, which contains the classes that end up in core-oj,
170// core-libart as well as the lambda stubs needed to compile Java lambda code.
171// It does not contain other parts of core library like conscrypt, bouncycastle,
172// etc. This system_modules definition is used to bootstrap compilation for
173// other parts of the core library like core-oj, core-libart, conscrypt,
174// bouncycastle, etc.
175//
176// If you want to compile against the entire core library implementation, for
177// example to build core library tests, see "core-system-modules" instead.
Colin Crossa4d9fc42017-09-29 18:04:37 -0700178java_system_modules {
179 name: "core-all-system-modules",
180 libs: ["core-all"],
181}
182
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100183// Contains the parts of core library associated with OpenJDK.
Colin Crossaf0b54c2017-09-27 17:22:32 -0700184java_library {
185 name: "core-oj",
186 defaults: ["libcore_java_defaults"],
Colin Cross5b75cdd2018-06-27 11:00:13 -0700187 installable: true,
Colin Crossbb180be2017-10-09 14:54:53 -0700188 hostdex: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700189
Neil Fuller866ed4a2018-09-06 12:05:46 +0100190 srcs: [":core_oj_java_files"],
Colin Crossaf0b54c2017-09-27 17:22:32 -0700191 java_resource_dirs: core_resource_dirs,
Colin Crossec80f4f2018-08-15 21:17:11 -0700192
193 no_standard_libs: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700194 libs: ["core-all"],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700195 system_modules: "core-all-system-modules",
196 openjdk9: {
197 javacflags: ["--patch-module=java.base=."],
198 },
Colin Crossec80f4f2018-08-15 21:17:11 -0700199
Pete Gillin7a7a6d22017-12-19 14:56:03 +0000200 jacoco: {
Pete Gillin27ca0582018-01-10 17:04:17 +0000201 exclude_filter: [
Pete Gillin3f59bad2018-01-30 11:20:29 +0000202 "java.lang.Class",
203 "java.lang.Long",
204 "java.lang.Number",
205 "java.lang.Object",
206 "java.lang.String",
207 "java.lang.invoke.MethodHandle",
208 "java.lang.ref.Reference",
209 "java.lang.reflect.Proxy",
Pete Gillinb1868ada2018-01-17 11:03:10 +0000210 "java.util.AbstractMap",
Pete Gillin3f59bad2018-01-30 11:20:29 +0000211 "java.util.HashMap",
212 "java.util.HashMap$Node",
Pete Gillinb1868ada2018-01-17 11:03:10 +0000213 "java.util.Map",
Pete Gillin7a7a6d22017-12-19 14:56:03 +0000214 ],
215 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700216
217 notice: "ojluni/NOTICE",
218
219 required: [
220 "tzdata",
221 "tzlookup.xml",
222 ],
Colin Crossbb180be2017-10-09 14:54:53 -0700223
Colin Crossaf0b54c2017-09-27 17:22:32 -0700224}
225
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100226// Contains parts of core library not associated with OpenJDK. Contains not
227// just java.*, javax.* code but also android.icu.*, android.system.* and
228// various internal libcore.* packages.
Colin Crossaf0b54c2017-09-27 17:22:32 -0700229java_library {
230 name: "core-libart",
231 defaults: ["libcore_java_defaults"],
Colin Cross5b75cdd2018-06-27 11:00:13 -0700232 installable: true,
Colin Crossbb180be2017-10-09 14:54:53 -0700233 hostdex: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700234
Neil Fuller866ed4a2018-09-06 12:05:46 +0100235 srcs: [":core_libart_java_files"],
Victor Chang7fef4052018-09-25 14:12:03 +0100236 static_libs: ["android_icu4j_resources_lib"],
Colin Crossaf0b54c2017-09-27 17:22:32 -0700237
Colin Crossec80f4f2018-08-15 21:17:11 -0700238 no_standard_libs: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700239 libs: ["core-all"],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700240 system_modules: "core-all-system-modules",
241 openjdk9: {
242 javacflags: ["--patch-module=java.base=."],
243 },
Colin Crossec80f4f2018-08-15 21:17:11 -0700244
Pete Gillin80ebe872018-02-13 15:21:20 +0000245 jacoco: {
246 exclude_filter: [
247 "java.lang.DexCache",
248 "dalvik.system.ClassExt",
249 ],
250 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700251
252 required: [
253 "tzdata",
254 "tzlookup.xml",
255 ],
256}
257
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100258//
259// Guaranteed unstripped versions of core-oj and core-libart.
260//
Colin Cross3c6c2e22017-10-18 13:24:52 -0700261// The build system may or may not strip the core-oj and core-libart jars,
262// but these will not be stripped. See b/24535627.
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100263//
264
Colin Cross3c6c2e22017-10-18 13:24:52 -0700265java_library {
266 name: "core-oj-testdex",
Colin Cross5b75cdd2018-06-27 11:00:13 -0700267 installable: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700268 static_libs: ["core-oj"],
269 no_standard_libs: true,
270 libs: ["core-all"],
271 system_modules: "core-all-system-modules",
272 dxflags: ["--core-library"],
Colin Cross485ed362017-12-05 17:24:22 -0800273 dex_preopt: {
274 enabled: false,
275 },
Colin Cross3c6c2e22017-10-18 13:24:52 -0700276 notice: "ojluni/NOTICE",
277 required: [
278 "tzdata",
279 "tzlookup.xml",
280 ],
281}
282
283java_library {
284 name: "core-libart-testdex",
Colin Cross5b75cdd2018-06-27 11:00:13 -0700285 installable: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700286 static_libs: ["core-libart"],
287 no_standard_libs: true,
288 libs: ["core-all"],
289 system_modules: "core-all-system-modules",
290 dxflags: ["--core-library"],
Colin Cross485ed362017-12-05 17:24:22 -0800291 dex_preopt: {
292 enabled: false,
293 },
Colin Cross3c6c2e22017-10-18 13:24:52 -0700294 notice: "ojluni/NOTICE",
295 required: [
296 "tzdata",
297 "tzlookup.xml",
298 ],
299}
300
Tobias Thierere0f8b312018-10-23 23:12:30 +0100301
302java_defaults {
303 name: "core_lambda_stubs_defaults",
Colin Crossaf0b54c2017-09-27 17:22:32 -0700304 defaults: ["libcore_java_defaults"],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100305 hostdex: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700306
Colin Crossec80f4f2018-08-15 21:17:11 -0700307 no_standard_libs: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700308 libs: ["core-all"],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700309 system_modules: "core-all-system-modules",
310 openjdk9: {
311 javacflags: ["--patch-module=java.base=."],
312 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700313
314 notice: "ojluni/NOTICE",
315
316 installable: false,
317 include_srcs: true,
318}
Colin Crossa4d9fc42017-09-29 18:04:37 -0700319
Tobias Thierere0f8b312018-10-23 23:12:30 +0100320// Creates a jar that exists to satisfy javac when compiling source code that
321// contains lambdas. This contains all classes / methods required by javac
322// when generating invoke-dynamic lambda implementation code, even those that
323// are also in the public SDK API from API level 26 onwards.
324java_library {
325 name: "core-lambda-stubs",
326 defaults: ["core_lambda_stubs_defaults"],
327 srcs: [
328 ":openjdk_lambda_stub_files",
329 ":openjdk_lambda_duplicate_stub_files",
330 ],
331}
332
333// An alternative to core-lambda-stubs that omits openjdk_lambda_duplicate_stub_files
334// because those classes are also part of the core library public SDK API
335// (since API level 26).
336java_library {
337 name: "core-lambda-stubs-for-system-modules",
338 defaults: ["core_lambda_stubs_defaults"],
339 srcs: [
340 ":openjdk_lambda_stub_files",
341 ],
342}
343
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100344// A system modules definition containing the implementations for the various
345// parts that make up the core library.
346//
347// This system module is intended for use by tests that may need access to
348// core library internals. It should not be generally used; most of the
349// platform build should build against API stubs instead. See
350// "core-platform-api-stubs-system-modules", which is the default used by the
351// Android build.
352//
353// This module also includes lambda stubs for compiling source containing
354// Java lambdas.
Colin Crossa4d9fc42017-09-29 18:04:37 -0700355java_system_modules {
356 name: "core-system-modules",
357 libs: [
358 "core-oj",
359 "core-libart",
Neil Fuller866ed4a2018-09-06 12:05:46 +0100360 "core-simple",
Neil Fullerb669ccb2018-10-04 23:10:27 +0100361 "bouncycastle",
362 "conscrypt",
363 "okhttp",
Neil Fuller05723a52018-10-19 10:55:05 +0100364 "apache-xml",
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100365 // This one is not on device but it's needed when javac compiles code
366 // containing lambdas.
Tobias Thierere0f8b312018-10-23 23:12:30 +0100367 "core-lambda-stubs-for-system-modules",
Colin Crossa4d9fc42017-09-29 18:04:37 -0700368 ],
369}
Colin Cross3c6c2e22017-10-18 13:24:52 -0700370
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100371// Builds libcore test rules
Colin Cross3c6c2e22017-10-18 13:24:52 -0700372java_library_static {
373 name: "core-test-rules",
374 hostdex: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700375 srcs: [
376 "dalvik/test-rules/src/main/**/*.java",
377 "test-rules/src/main/**/*.java",
378 ],
379 static_libs: ["junit"],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100380
381 no_standard_libs: true,
382 libs: ["core-all"],
383 system_modules: "core-all-system-modules",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700384}
385
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100386// Builds the core-tests-support library used by various tests.
Colin Cross3c6c2e22017-10-18 13:24:52 -0700387java_library_static {
388 name: "core-tests-support",
389 hostdex: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700390 srcs: ["support/src/test/java/**/*.java"],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100391
Neil Fuller4380ab22018-10-18 19:38:53 +0100392 no_framework_libs: true,
393 libs: ["junit"],
Colin Cross3c6c2e22017-10-18 13:24:52 -0700394 static_libs: [
Neil Fullerde8b0862018-10-12 21:53:31 +0100395 "bouncycastle-unbundled",
396 "bouncycastle-bcpkix-unbundled",
397 "bouncycastle-ocsp-unbundled",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700398 ],
399}
400
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100401// Builds the jsr166-tests library.
Colin Crossec80f4f2018-08-15 21:17:11 -0700402java_test {
Colin Cross3c6c2e22017-10-18 13:24:52 -0700403 name: "jsr166-tests",
404 srcs: ["jsr166-tests/src/test/java/**/*.java"],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100405 no_standard_libs: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700406 libs: [
Neil Fuller4207c7f2018-10-10 14:01:40 +0100407 "core-all",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700408 "junit",
409 ],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100410 system_modules: "core-all-system-modules",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700411}
Nan Zhang65f27a32018-01-05 10:41:46 -0800412
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100413// Builds a library just containing files from luni/src/test/filesystems
414// for use in tests.
Colin Crossec80f4f2018-08-15 21:17:11 -0700415java_library {
416 name: "filesystemstest",
417 compile_dex: true,
418 srcs: ["luni/src/test/filesystems/src/**/*.java"],
419 java_resource_dirs: ["luni/src/test/filesystems/resources"],
420 no_framework_libs: true,
421 errorprone: {
422 javacflags: ["-Xep:MissingOverride:OFF"],
423 },
424}
425
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100426// Builds a library just containing files from luni/src/test/parameter_metadata
427// for use in tests.
Colin Crossec80f4f2018-08-15 21:17:11 -0700428java_library {
429 name: "parameter-metadata-test",
430 compile_dex: true,
431 srcs: ["luni/src/test/parameter_metadata/src/**/*.java"],
432 no_framework_libs: true,
433 javacflags: ["-parameters"],
434 errorprone: {
435 javacflags: ["-Xep:MissingOverride:OFF"],
436 },
437}
438
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100439// Builds the core-tests library.
Colin Crossec80f4f2018-08-15 21:17:11 -0700440java_test {
441 name: "core-tests",
442 defaults: ["libcore_java_defaults"],
443 hostdex: true,
444 srcs: [
445 "dalvik/src/test/java/**/*.java",
446 "dalvik/test-rules/src/test/java/**/*.java",
447 "dom/src/test/java/**/*.java",
448 "harmony-tests/src/test/java/**/*.java",
449 "json/src/test/java/**/*.java",
450 "luni/src/test/java/**/*.java",
451 "xml/src/test/java/**/*.java",
452 ],
453 exclude_srcs: [
454 "luni/src/test/java/libcore/java/util/zip/Zip64Test.java",
455 "luni/src/test/java/libcore/java/util/zip/Zip64FileTest.java",
456 ],
457
458 java_resource_dirs: [
459 "*/src/test/java",
460 "*/src/test/resources",
461 ],
462 exclude_java_resource_dirs: [
463 "ojluni/src/test/java",
464 "ojluni/src/test/resources",
465 ],
466
467 java_resources: [
468 ":filesystemstest",
469 ":parameter-metadata-test",
470 ],
471
Neil Fuller4207c7f2018-10-10 14:01:40 +0100472 no_standard_libs: true,
473 libs: [
474 "core-all",
475 "okhttp",
476 "bouncycastle",
477 ],
478 system_modules: "core-all-system-modules",
479
Colin Crossec80f4f2018-08-15 21:17:11 -0700480 static_libs: [
481 "archive-patcher",
482 "core-test-rules",
483 "core-tests-support",
484 "junit-params",
485 "mockftpserver",
486 "mockito-target",
487 "mockwebserver",
488 "nist-pkix-tests",
489 "slf4j-jdk14",
490 "sqlite-jdbc",
491 "tzdata-testing",
492 ],
493
494 errorprone: {
495 javacflags: [
496 "-Xep:TryFailThrowable:ERROR",
497 "-Xep:ComparisonOutOfRange:ERROR",
498 ],
499 },
Simran Basi3be01e02018-08-21 17:53:49 -0700500
501 test_config: "AndroidTest-core-tests.xml",
Colin Crossec80f4f2018-08-15 21:17:11 -0700502}
503
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100504// Builds the core-ojtests library that contains test code from OpenJDK.
Colin Crossec80f4f2018-08-15 21:17:11 -0700505java_test {
506 name: "core-ojtests",
507 defaults: ["libcore_java_defaults"],
508 hostdex: true,
509
510 srcs: [
511 "ojluni/src/test/java/**/*.java",
512 ],
513 java_resource_dirs: [
514 "ojluni/src/test/java",
515 "ojluni/src/test/resources",
516 ],
Neil Fullerb669ccb2018-10-04 23:10:27 +0100517
Neil Fuller4207c7f2018-10-10 14:01:40 +0100518 no_standard_libs: true,
519 libs: [
520 "core-all",
521 "okhttp",
522 "bouncycastle",
523 ],
524 system_modules: "core-all-system-modules",
525
Colin Crossec80f4f2018-08-15 21:17:11 -0700526 static_libs: ["testng"],
527
528 // ojluni/src/test/java/util/stream/{bootlib,boottest}
529 // contains tests that are in packages from java.base;
530 // By default, OpenJDK 9's javac will only compile such
531 // code if it's declared to also be in java.base at
532 // compile time.
533 //
534 // For now, we use --patch-module to put all sources
535 // and dependencies from this make target into java.base;
536 // other source directories in this make target are in
537 // packages not from java.base; if this becomes a problem
538 // in future, this could be addressed eg. by splitting
539 // boot{lib,test} out into a separate make target,
540 // deleting those tests or moving them to a different
541 // package.
542 patch_module: "java.base",
543}
544
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100545// Builds the core-ojtests-public library. Excludes any private API tests.
546// Like core-ojtests but smaller.
Colin Crossec80f4f2018-08-15 21:17:11 -0700547java_test {
548 name: "core-ojtests-public",
549 defaults: ["libcore_java_defaults"],
550 srcs: [
551 "ojluni/src/test/java/**/*.java",
552 ],
553 // Filter out the following:
554 // 1.) DeserializeMethodTest and SerializedLambdaTest, because they depends on stub classes
555 // and won't actually run, and
556 // 2.) util/stream/boot*. Those directories contain classes in the package java.util.stream;
557 // excluding them means we don't need patch_module: "java.base"
558 exclude_srcs: [
559 "**/DeserializeMethodTest.java",
560 "**/SerializedLambdaTest.java",
561 "ojluni/src/test/java/util/stream/boot*/**/*",
562 ],
563 java_resource_dirs: [
564 "ojluni/src/test/java",
565 "ojluni/src/test/resources",
566 // Include source code as part of JAR
567 "ojluni/src/test/dist",
568 ],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100569
570 no_standard_libs: true,
571 libs: [
572 "core-all",
573 "bouncycastle",
574 "okhttp",
575 "testng",
576 ],
577 system_modules: "core-all-system-modules",
Colin Crossec80f4f2018-08-15 21:17:11 -0700578}
579
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100580// Exports annotated stubs source files in ojluni/annotations/sdk to make them
581// available to metalava. Used for nullability annotations in OpenJDK source.
Pete Gillin7db7faa2018-07-31 13:29:35 +0100582droiddoc_exported_dir {
Pete Gillin0728b742018-09-17 15:41:45 +0100583 name: "ojluni-annotated-sdk-stubs",
584 path: "ojluni/annotations/sdk",
Pete Gillin7db7faa2018-07-31 13:29:35 +0100585}
Pete Gillin600c7cf2018-08-16 19:28:38 +0100586droiddoc_exported_dir {
587 name: "ojluni-annotated-nullability-stubs",
588 path: "ojluni/annotations/sdk/nullability",
589}
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100590
591// Exports annotated stubs source files in ojluni/annotations/mmodules to make
592// them available to metalava. Used for core platform API and intra-code API
593// annotations in OpenJDK source.
Pete Gillinc9935b62018-09-25 14:42:40 +0100594droiddoc_exported_dir {
595 name: "ojluni-annotated-mmodule-stubs",
596 path: "ojluni/annotations/mmodule",
597}
Pete Gillin7db7faa2018-07-31 13:29:35 +0100598
Neil Fuller6f16b462018-09-04 15:40:39 +0100599// A file containing the list of tags that are "known" to us from the OpenJdk
600// source code and so should not cause an error or warning.
Nan Zhangd55722b2018-02-27 15:08:20 -0800601filegroup {
602 name: "known-oj-tags",
603 srcs: [
604 "known_oj_tags.txt",
605 ],
606}
Nan Zhang602fc0e2018-03-22 16:14:22 -0700607
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100608// Generates stubs for the parts of the public SDK API provided by the core
609// library.
Nan Zhangf0207602018-09-10 18:57:38 -0700610droidstubs {
611 name: "core-current-stubs-gen",
Neil Fuller866ed4a2018-09-06 12:05:46 +0100612 srcs: [":core_api_files"],
Nan Zhang602fc0e2018-03-22 16:14:22 -0700613 installable: false,
614 no_framework_libs: true,
Neil Fullerbe9258e2018-09-24 17:11:27 +0100615 args: " --exclude-annotations "
616 + "--hide-annotation libcore.api.Hide",
617 merge_inclusion_annotations_dirs: ["ojluni-annotated-mmodule-stubs"],
Nan Zhang602fc0e2018-03-22 16:14:22 -0700618}
619
Pete Gillin600c7cf2018-08-16 19:28:38 +0100620// Target for validating nullability annotations for correctness and
621// completeness. To check that there are no nullability errors:
622// make core-current-stubs-nullability-validation
623// To check that there are only the expected nullability warnings:
624// make core-current-stubs-nullability-validation-check-nullability-warnings
625// To update the the list of known expected nullability warnings:
626// make core-current-stubs-nullability-validation-update-nullability-warnings
627droidstubs {
628 name: "core-current-stubs-nullability-validation",
629 srcs: [":core_api_files"],
630 installable: false,
631 no_framework_libs: true,
632 annotations_enabled: true,
633 args: "--hide-annotation libcore.api.Hide " +
634 "--validate-nullability-from-merged-stubs ",
635 merge_inclusion_annotations_dirs: ["ojluni-annotated-mmodule-stubs"],
636 merge_annotations_dirs: [
637 "metalava-manual",
638 // N.B. Stubs in this filegroup will be validated:
639 "ojluni-annotated-nullability-stubs",
640 ],
641 // The expected set of warnings about missing annotations:
642 check_nullability_warnings: "nullability_warnings.txt",
643}
644
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100645// A stubs target containing the parts of the public SDK API provided by the
646// core library.
647//
Neil Fullera6ba3592018-09-21 13:19:37 +0100648// Don't use this directly, use "sdk_version: core_current".
649java_library {
Nan Zhang602fc0e2018-03-22 16:14:22 -0700650 name: "core.current.stubs",
Nan Zhangf0207602018-09-10 18:57:38 -0700651 srcs: [":core-current-stubs-gen"],
Nan Zhang602fc0e2018-03-22 16:14:22 -0700652 errorprone: {
653 javacflags: [
654 "-Xep:MissingOverride:OFF",
655 ],
656 },
Tobias Thierer496a9382018-06-12 14:09:11 +0100657 openjdk9: {
658 javacflags: ["--patch-module=java.base=."],
659 },
Nan Zhang602fc0e2018-03-22 16:14:22 -0700660 no_standard_libs: true,
661 system_modules: "none",
662}