blob: 94ba05d48d9ebfd540da5214fbec371db0731594 [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 Fullerde8b0862018-10-12 21:53:31 +0100392 sdk_version: "core_platform_current",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700393 libs: [
394 "junit",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700395 ],
396 static_libs: [
Neil Fullerde8b0862018-10-12 21:53:31 +0100397 "bouncycastle-unbundled",
398 "bouncycastle-bcpkix-unbundled",
399 "bouncycastle-ocsp-unbundled",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700400 ],
401}
402
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100403// Builds the jsr166-tests library.
Colin Crossec80f4f2018-08-15 21:17:11 -0700404java_test {
Colin Cross3c6c2e22017-10-18 13:24:52 -0700405 name: "jsr166-tests",
406 srcs: ["jsr166-tests/src/test/java/**/*.java"],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100407 no_standard_libs: true,
Colin Cross3c6c2e22017-10-18 13:24:52 -0700408 libs: [
Neil Fuller4207c7f2018-10-10 14:01:40 +0100409 "core-all",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700410 "junit",
411 ],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100412 system_modules: "core-all-system-modules",
Colin Cross3c6c2e22017-10-18 13:24:52 -0700413}
Nan Zhang65f27a32018-01-05 10:41:46 -0800414
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100415// Builds a library just containing files from luni/src/test/filesystems
416// for use in tests.
Colin Crossec80f4f2018-08-15 21:17:11 -0700417java_library {
418 name: "filesystemstest",
419 compile_dex: true,
420 srcs: ["luni/src/test/filesystems/src/**/*.java"],
421 java_resource_dirs: ["luni/src/test/filesystems/resources"],
422 no_framework_libs: true,
423 errorprone: {
424 javacflags: ["-Xep:MissingOverride:OFF"],
425 },
426}
427
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100428// Builds a library just containing files from luni/src/test/parameter_metadata
429// for use in tests.
Colin Crossec80f4f2018-08-15 21:17:11 -0700430java_library {
431 name: "parameter-metadata-test",
432 compile_dex: true,
433 srcs: ["luni/src/test/parameter_metadata/src/**/*.java"],
434 no_framework_libs: true,
435 javacflags: ["-parameters"],
436 errorprone: {
437 javacflags: ["-Xep:MissingOverride:OFF"],
438 },
439}
440
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100441// Builds the core-tests library.
Colin Crossec80f4f2018-08-15 21:17:11 -0700442java_test {
443 name: "core-tests",
444 defaults: ["libcore_java_defaults"],
445 hostdex: true,
446 srcs: [
447 "dalvik/src/test/java/**/*.java",
448 "dalvik/test-rules/src/test/java/**/*.java",
449 "dom/src/test/java/**/*.java",
450 "harmony-tests/src/test/java/**/*.java",
451 "json/src/test/java/**/*.java",
452 "luni/src/test/java/**/*.java",
453 "xml/src/test/java/**/*.java",
454 ],
455 exclude_srcs: [
456 "luni/src/test/java/libcore/java/util/zip/Zip64Test.java",
457 "luni/src/test/java/libcore/java/util/zip/Zip64FileTest.java",
458 ],
459
460 java_resource_dirs: [
461 "*/src/test/java",
462 "*/src/test/resources",
463 ],
464 exclude_java_resource_dirs: [
465 "ojluni/src/test/java",
466 "ojluni/src/test/resources",
467 ],
468
469 java_resources: [
470 ":filesystemstest",
471 ":parameter-metadata-test",
472 ],
473
Neil Fuller4207c7f2018-10-10 14:01:40 +0100474 no_standard_libs: true,
475 libs: [
476 "core-all",
477 "okhttp",
478 "bouncycastle",
479 ],
480 system_modules: "core-all-system-modules",
481
Colin Crossec80f4f2018-08-15 21:17:11 -0700482 static_libs: [
483 "archive-patcher",
484 "core-test-rules",
485 "core-tests-support",
486 "junit-params",
487 "mockftpserver",
488 "mockito-target",
489 "mockwebserver",
490 "nist-pkix-tests",
491 "slf4j-jdk14",
492 "sqlite-jdbc",
493 "tzdata-testing",
494 ],
495
496 errorprone: {
497 javacflags: [
498 "-Xep:TryFailThrowable:ERROR",
499 "-Xep:ComparisonOutOfRange:ERROR",
500 ],
501 },
Simran Basi3be01e02018-08-21 17:53:49 -0700502
503 test_config: "AndroidTest-core-tests.xml",
Colin Crossec80f4f2018-08-15 21:17:11 -0700504}
505
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100506// Builds the core-ojtests library that contains test code from OpenJDK.
Colin Crossec80f4f2018-08-15 21:17:11 -0700507java_test {
508 name: "core-ojtests",
509 defaults: ["libcore_java_defaults"],
510 hostdex: true,
511
512 srcs: [
513 "ojluni/src/test/java/**/*.java",
514 ],
515 java_resource_dirs: [
516 "ojluni/src/test/java",
517 "ojluni/src/test/resources",
518 ],
Neil Fullerb669ccb2018-10-04 23:10:27 +0100519
Neil Fuller4207c7f2018-10-10 14:01:40 +0100520 no_standard_libs: true,
521 libs: [
522 "core-all",
523 "okhttp",
524 "bouncycastle",
525 ],
526 system_modules: "core-all-system-modules",
527
Colin Crossec80f4f2018-08-15 21:17:11 -0700528 static_libs: ["testng"],
529
530 // ojluni/src/test/java/util/stream/{bootlib,boottest}
531 // contains tests that are in packages from java.base;
532 // By default, OpenJDK 9's javac will only compile such
533 // code if it's declared to also be in java.base at
534 // compile time.
535 //
536 // For now, we use --patch-module to put all sources
537 // and dependencies from this make target into java.base;
538 // other source directories in this make target are in
539 // packages not from java.base; if this becomes a problem
540 // in future, this could be addressed eg. by splitting
541 // boot{lib,test} out into a separate make target,
542 // deleting those tests or moving them to a different
543 // package.
544 patch_module: "java.base",
545}
546
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100547// Builds the core-ojtests-public library. Excludes any private API tests.
548// Like core-ojtests but smaller.
Colin Crossec80f4f2018-08-15 21:17:11 -0700549java_test {
550 name: "core-ojtests-public",
551 defaults: ["libcore_java_defaults"],
552 srcs: [
553 "ojluni/src/test/java/**/*.java",
554 ],
555 // Filter out the following:
556 // 1.) DeserializeMethodTest and SerializedLambdaTest, because they depends on stub classes
557 // and won't actually run, and
558 // 2.) util/stream/boot*. Those directories contain classes in the package java.util.stream;
559 // excluding them means we don't need patch_module: "java.base"
560 exclude_srcs: [
561 "**/DeserializeMethodTest.java",
562 "**/SerializedLambdaTest.java",
563 "ojluni/src/test/java/util/stream/boot*/**/*",
564 ],
565 java_resource_dirs: [
566 "ojluni/src/test/java",
567 "ojluni/src/test/resources",
568 // Include source code as part of JAR
569 "ojluni/src/test/dist",
570 ],
Neil Fuller4207c7f2018-10-10 14:01:40 +0100571
572 no_standard_libs: true,
573 libs: [
574 "core-all",
575 "bouncycastle",
576 "okhttp",
577 "testng",
578 ],
579 system_modules: "core-all-system-modules",
Colin Crossec80f4f2018-08-15 21:17:11 -0700580}
581
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100582// Exports annotated stubs source files in ojluni/annotations/sdk to make them
583// available to metalava. Used for nullability annotations in OpenJDK source.
Pete Gillin7db7faa2018-07-31 13:29:35 +0100584droiddoc_exported_dir {
Pete Gillin0728b742018-09-17 15:41:45 +0100585 name: "ojluni-annotated-sdk-stubs",
586 path: "ojluni/annotations/sdk",
Pete Gillin7db7faa2018-07-31 13:29:35 +0100587}
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100588
589// Exports annotated stubs source files in ojluni/annotations/mmodules to make
590// them available to metalava. Used for core platform API and intra-code API
591// annotations in OpenJDK source.
Pete Gillinc9935b62018-09-25 14:42:40 +0100592droiddoc_exported_dir {
593 name: "ojluni-annotated-mmodule-stubs",
594 path: "ojluni/annotations/mmodule",
595}
Pete Gillin7db7faa2018-07-31 13:29:35 +0100596
Neil Fuller6f16b462018-09-04 15:40:39 +0100597// A file containing the list of tags that are "known" to us from the OpenJdk
598// source code and so should not cause an error or warning.
Nan Zhangd55722b2018-02-27 15:08:20 -0800599filegroup {
600 name: "known-oj-tags",
601 srcs: [
602 "known_oj_tags.txt",
603 ],
604}
Nan Zhang602fc0e2018-03-22 16:14:22 -0700605
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100606// Generates stubs for the parts of the public SDK API provided by the core
607// library.
Nan Zhangf0207602018-09-10 18:57:38 -0700608droidstubs {
609 name: "core-current-stubs-gen",
Neil Fuller866ed4a2018-09-06 12:05:46 +0100610 srcs: [":core_api_files"],
Nan Zhang602fc0e2018-03-22 16:14:22 -0700611 installable: false,
612 no_framework_libs: true,
Neil Fullerbe9258e2018-09-24 17:11:27 +0100613 args: " --exclude-annotations "
614 + "--hide-annotation libcore.api.Hide",
615 merge_inclusion_annotations_dirs: ["ojluni-annotated-mmodule-stubs"],
Nan Zhang602fc0e2018-03-22 16:14:22 -0700616}
617
Neil Fuller77e3f3b2018-10-19 10:22:32 +0100618// A stubs target containing the parts of the public SDK API provided by the
619// core library.
620//
Neil Fullera6ba3592018-09-21 13:19:37 +0100621// Don't use this directly, use "sdk_version: core_current".
622java_library {
Nan Zhang602fc0e2018-03-22 16:14:22 -0700623 name: "core.current.stubs",
Nan Zhangf0207602018-09-10 18:57:38 -0700624 srcs: [":core-current-stubs-gen"],
Nan Zhang602fc0e2018-03-22 16:14:22 -0700625 errorprone: {
626 javacflags: [
627 "-Xep:MissingOverride:OFF",
628 ],
629 },
Tobias Thierer496a9382018-06-12 14:09:11 +0100630 openjdk9: {
631 javacflags: ["--patch-module=java.base=."],
632 },
Nan Zhang602fc0e2018-03-22 16:14:22 -0700633 no_standard_libs: true,
634 system_modules: "none",
635}