xref: /aosp_15_r20/libcore/JavaLibrary.bp (revision 89a6322812dc8573315e60046e7959c50dad91d4)
1*89a63228SAndroid Build Coastguard Worker// Copyright (C) 2007 The Android Open Source Project
2*89a63228SAndroid Build Coastguard Worker//
3*89a63228SAndroid Build Coastguard Worker// Licensed under the Apache License, Version 2.0 (the "License");
4*89a63228SAndroid Build Coastguard Worker// you may not use this file except in compliance with the License.
5*89a63228SAndroid Build Coastguard Worker// You may obtain a copy of the License at
6*89a63228SAndroid Build Coastguard Worker//
7*89a63228SAndroid Build Coastguard Worker//      http://www.apache.org/licenses/LICENSE-2.0
8*89a63228SAndroid Build Coastguard Worker//
9*89a63228SAndroid Build Coastguard Worker// Unless required by applicable law or agreed to in writing, software
10*89a63228SAndroid Build Coastguard Worker// distributed under the License is distributed on an "AS IS" BASIS,
11*89a63228SAndroid Build Coastguard Worker// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12*89a63228SAndroid Build Coastguard Worker// See the License for the specific language governing permissions and
13*89a63228SAndroid Build Coastguard Worker// limitations under the License.
14*89a63228SAndroid Build Coastguard Worker
15*89a63228SAndroid Build Coastguard Worker//
16*89a63228SAndroid Build Coastguard Worker// Definitions for building the Android core library and associated tests.
17*89a63228SAndroid Build Coastguard Worker//
18*89a63228SAndroid Build Coastguard Worker
19*89a63228SAndroid Build Coastguard Worker// The Android core library provides low-level APIs for use by the rest of the
20*89a63228SAndroid Build Coastguard Worker// Android software stack. It is made up of various parts, some of which can be
21*89a63228SAndroid Build Coastguard Worker// found in libcore/ and other parts that can be found in various external/
22*89a63228SAndroid Build Coastguard Worker// directories.
23*89a63228SAndroid Build Coastguard Worker//
24*89a63228SAndroid Build Coastguard Worker// libcore has some sub-directories that follow a common structure:
25*89a63228SAndroid Build Coastguard Worker// e.g. dalvik, dom, harmony-tests, json, jsr166-tests, luni, libart, ojluni,
26*89a63228SAndroid Build Coastguard Worker// support, xml, xmlpull.
27*89a63228SAndroid Build Coastguard Worker//
28*89a63228SAndroid Build Coastguard Worker// The structure of these is generally:
29*89a63228SAndroid Build Coastguard Worker//
30*89a63228SAndroid Build Coastguard Worker//   src/
31*89a63228SAndroid Build Coastguard Worker//       main/               # To be shipped on every device.
32*89a63228SAndroid Build Coastguard Worker//            java/          # Java source for library code.
33*89a63228SAndroid Build Coastguard Worker//            native/        # C/C++ source for library code.
34*89a63228SAndroid Build Coastguard Worker//            resources/     # Support files.
35*89a63228SAndroid Build Coastguard Worker//       test/               # Built only on demand, for testing.
36*89a63228SAndroid Build Coastguard Worker//            java/          # Java source for tests.
37*89a63228SAndroid Build Coastguard Worker//            native/        # C/C++ source for tests (rare).
38*89a63228SAndroid Build Coastguard Worker//            resources/     # Support files.
39*89a63228SAndroid Build Coastguard Worker//
40*89a63228SAndroid Build Coastguard Worker// All subdirectories are optional.
41*89a63228SAndroid Build Coastguard Worker
42*89a63228SAndroid Build Coastguard Workerbuild = [
43*89a63228SAndroid Build Coastguard Worker    "openjdk_java_files.bp",
44*89a63228SAndroid Build Coastguard Worker    "non_openjdk_java_files.bp",
45*89a63228SAndroid Build Coastguard Worker]
46*89a63228SAndroid Build Coastguard Worker
47*89a63228SAndroid Build Coastguard Worker// The Java files and their associated resources.
48*89a63228SAndroid Build Coastguard Workerfilegroup {
49*89a63228SAndroid Build Coastguard Worker    name: "core-luni-resources",
50*89a63228SAndroid Build Coastguard Worker    visibility: [
51*89a63228SAndroid Build Coastguard Worker        "//libcore:__subpackages__",
52*89a63228SAndroid Build Coastguard Worker    ],
53*89a63228SAndroid Build Coastguard Worker    path: "luni/src/main/java/",
54*89a63228SAndroid Build Coastguard Worker    srcs: [
55*89a63228SAndroid Build Coastguard Worker        "luni/src/main/java/java/util/logging/logging.properties",
56*89a63228SAndroid Build Coastguard Worker        "luni/src/main/java/java/security/security.properties",
57*89a63228SAndroid Build Coastguard Worker    ],
58*89a63228SAndroid Build Coastguard Worker}
59*89a63228SAndroid Build Coastguard Worker
60*89a63228SAndroid Build Coastguard Workerfilegroup {
61*89a63228SAndroid Build Coastguard Worker    name: "core-ojluni-resources",
62*89a63228SAndroid Build Coastguard Worker    visibility: [
63*89a63228SAndroid Build Coastguard Worker        "//libcore:__subpackages__",
64*89a63228SAndroid Build Coastguard Worker    ],
65*89a63228SAndroid Build Coastguard Worker    path: "ojluni/src/main/resources/",
66*89a63228SAndroid Build Coastguard Worker    srcs: [
67*89a63228SAndroid Build Coastguard Worker        "ojluni/src/main/resources/**/*",
68*89a63228SAndroid Build Coastguard Worker    ],
69*89a63228SAndroid Build Coastguard Worker}
70*89a63228SAndroid Build Coastguard Worker
71*89a63228SAndroid Build Coastguard Workercore_resources = [
72*89a63228SAndroid Build Coastguard Worker    ":core-luni-resources",
73*89a63228SAndroid Build Coastguard Worker    ":core-ojluni-resources",
74*89a63228SAndroid Build Coastguard Worker]
75*89a63228SAndroid Build Coastguard Worker
76*89a63228SAndroid Build Coastguard Worker// The source files that go into core-oj.
77*89a63228SAndroid Build Coastguard Workerfilegroup {
78*89a63228SAndroid Build Coastguard Worker    name: "core_oj_java_files",
79*89a63228SAndroid Build Coastguard Worker    visibility: [
80*89a63228SAndroid Build Coastguard Worker        "//libcore:__subpackages__",
81*89a63228SAndroid Build Coastguard Worker    ],
82*89a63228SAndroid Build Coastguard Worker    srcs: [":openjdk_java_files"],
83*89a63228SAndroid Build Coastguard Worker}
84*89a63228SAndroid Build Coastguard Worker
85*89a63228SAndroid Build Coastguard Worker// http://b/129765390, http://b/188966706
86*89a63228SAndroid Build Coastguard Worker// Rewrite links to "platform" or "technotes" folders which are siblings
87*89a63228SAndroid Build Coastguard Worker// (and thus outside of) {@docRoot}.
88*89a63228SAndroid Build Coastguard Worker//
89*89a63228SAndroid Build Coastguard Worker// We have to escape \ as \\ and $ as $$ here because they get resolved by
90*89a63228SAndroid Build Coastguard Worker// different layers of the build tooling. The arguments are wrapped in '' so
91*89a63228SAndroid Build Coastguard Worker// that the shell doesn't add yet another level of escaping.
92*89a63228SAndroid Build Coastguard Workerrewrite_openjdk_doc_links = "sed -E 's" +
93*89a63228SAndroid Build Coastguard Worker    "!(\\{@docRoot\\}/\\.\\./|[./]+)((platform|technotes).+)\">" +
94*89a63228SAndroid Build Coastguard Worker    "!https://docs.oracle.com/javase/8/docs/\\2\">!' " +
95*89a63228SAndroid Build Coastguard Worker    "$(in) " +
96*89a63228SAndroid Build Coastguard Worker    "| sed -E 's" + // Android doesn't have java.base in the API docs
97*89a63228SAndroid Build Coastguard Worker    "!(\\{@docRoot\\}/)(java\\.base/)(.+)\">" +
98*89a63228SAndroid Build Coastguard Worker    "!\\1reference/\\3\">!' " +
99*89a63228SAndroid Build Coastguard Worker    "| sed -E 's" +
100*89a63228SAndroid Build Coastguard Worker    "!(\\{@docRoot\\}/\\.\\./)(specs/.+)\">" +
101*89a63228SAndroid Build Coastguard Worker    "!https://docs.oracle.com/en/java/javase/17/docs/\\2\">!' " +
102*89a63228SAndroid Build Coastguard Worker    " > $(out) " +
103*89a63228SAndroid Build Coastguard Worker    "&& ! grep '{@docRoot}/../' $(out)" // exit with 1 if "{@docRoot}/../" still exists.
104*89a63228SAndroid Build Coastguard Worker
105*89a63228SAndroid Build Coastguard Worker// OpenJDK source is not annotated with @hide so we need this separate
106*89a63228SAndroid Build Coastguard Worker// filegroup for just the parts that contribute to the API.
107*89a63228SAndroid Build Coastguard Workergensrcs {
108*89a63228SAndroid Build Coastguard Worker    name: "core_oj_api_files",
109*89a63228SAndroid Build Coastguard Worker    cmd: rewrite_openjdk_doc_links,
110*89a63228SAndroid Build Coastguard Worker    srcs: [":openjdk_javadoc_files"],
111*89a63228SAndroid Build Coastguard Worker    output_extension: "java",
112*89a63228SAndroid Build Coastguard Worker}
113*89a63228SAndroid Build Coastguard Worker
114*89a63228SAndroid Build Coastguard Worker// The source files that go into core-libart.l
115*89a63228SAndroid Build Coastguard Workerfilegroup {
116*89a63228SAndroid Build Coastguard Worker    name: "core_libart_java_files",
117*89a63228SAndroid Build Coastguard Worker    visibility: [
118*89a63228SAndroid Build Coastguard Worker        "//libcore:__subpackages__",
119*89a63228SAndroid Build Coastguard Worker    ],
120*89a63228SAndroid Build Coastguard Worker    srcs: [
121*89a63228SAndroid Build Coastguard Worker        ":non_openjdk_java_files",
122*89a63228SAndroid Build Coastguard Worker    ],
123*89a63228SAndroid Build Coastguard Worker}
124*89a63228SAndroid Build Coastguard Worker
125*89a63228SAndroid Build Coastguard Worker// Some parts of libart are not annotated with @hide so we need this separate
126*89a63228SAndroid Build Coastguard Worker// filegroup for just the parts that contribute to the API.
127*89a63228SAndroid Build Coastguard Workerfilegroup {
128*89a63228SAndroid Build Coastguard Worker    name: "core_libart_api_files",
129*89a63228SAndroid Build Coastguard Worker    srcs: [
130*89a63228SAndroid Build Coastguard Worker        ":non_openjdk_javadoc_files",
131*89a63228SAndroid Build Coastguard Worker    ],
132*89a63228SAndroid Build Coastguard Worker}
133*89a63228SAndroid Build Coastguard Worker
134*89a63228SAndroid Build Coastguard Worker// The set of files for the ART module that contribute to one or more API
135*89a63228SAndroid Build Coastguard Worker// surfaces. This includes files that are in the public API as well as those
136*89a63228SAndroid Build Coastguard Worker// that are not but which have been marked up with @hide plus one or more of
137*89a63228SAndroid Build Coastguard Worker// the API defining annotations.
138*89a63228SAndroid Build Coastguard Worker//
139*89a63228SAndroid Build Coastguard Worker// Some source files in :core_oj_api_files and :openjdk_mmodule_extra_files are
140*89a63228SAndroid Build Coastguard Worker// annotated by applying annotations to the .annotated.java stubs files in
141*89a63228SAndroid Build Coastguard Worker// ojluni/annotated/mmodules and rather than in the original source. See the comments
142*89a63228SAndroid Build Coastguard Worker// in openjdk_java_files.bp for more details.
143*89a63228SAndroid Build Coastguard Workerfilegroup {
144*89a63228SAndroid Build Coastguard Worker    name: "art_module_api_files",
145*89a63228SAndroid Build Coastguard Worker    visibility: [
146*89a63228SAndroid Build Coastguard Worker        "//libcore:__subpackages__",
147*89a63228SAndroid Build Coastguard Worker    ],
148*89a63228SAndroid Build Coastguard Worker    srcs: [
149*89a63228SAndroid Build Coastguard Worker        ":apache-xml_api_files",
150*89a63228SAndroid Build Coastguard Worker        ":bouncycastle_java_files",
151*89a63228SAndroid Build Coastguard Worker        ":core_oj_api_files",
152*89a63228SAndroid Build Coastguard Worker        ":core_libart_api_files",
153*89a63228SAndroid Build Coastguard Worker        ":okhttp_api_files",
154*89a63228SAndroid Build Coastguard Worker        ":openjdk_mmodule_extra_files",
155*89a63228SAndroid Build Coastguard Worker    ],
156*89a63228SAndroid Build Coastguard Worker}
157*89a63228SAndroid Build Coastguard Worker
158*89a63228SAndroid Build Coastguard Workerjava_defaults {
159*89a63228SAndroid Build Coastguard Worker    name: "libcore_java_defaults",
160*89a63228SAndroid Build Coastguard Worker    visibility: [
161*89a63228SAndroid Build Coastguard Worker        "//libcore:__subpackages__",
162*89a63228SAndroid Build Coastguard Worker    ],
163*89a63228SAndroid Build Coastguard Worker    javacflags: [
164*89a63228SAndroid Build Coastguard Worker        //"-Xlint:all",
165*89a63228SAndroid Build Coastguard Worker        //"-Xlint:-serial,-deprecation,-unchecked",
166*89a63228SAndroid Build Coastguard Worker    ],
167*89a63228SAndroid Build Coastguard Worker    dxflags: [
168*89a63228SAndroid Build Coastguard Worker        "--android-platform-build",
169*89a63228SAndroid Build Coastguard Worker        "--core-library",
170*89a63228SAndroid Build Coastguard Worker    ],
171*89a63228SAndroid Build Coastguard Worker    errorprone: {
172*89a63228SAndroid Build Coastguard Worker        javacflags: [
173*89a63228SAndroid Build Coastguard Worker            "-Xep:MissingOverride:OFF", // Ignore missing @Override.
174*89a63228SAndroid Build Coastguard Worker            "-Xep:ConstantOverflow:WARN", // Known constant overflow in SplittableRandom
175*89a63228SAndroid Build Coastguard Worker            "-Xep:UnicodeInCode:WARN", // XML parser uses line feeds in whitespace
176*89a63228SAndroid Build Coastguard Worker            "-Xep:ReturnValueIgnored:WARN",
177*89a63228SAndroid Build Coastguard Worker            "-Xep:HashtableContains:WARN",
178*89a63228SAndroid Build Coastguard Worker            "-Xep:ComparableType:WARN",
179*89a63228SAndroid Build Coastguard Worker            "-Xep:IdentityBinaryExpression:WARN",
180*89a63228SAndroid Build Coastguard Worker            "-Xep:BoxedPrimitiveEquality:WARN",
181*89a63228SAndroid Build Coastguard Worker            "-Xep:EmptyTopLevelDeclaration:WARN",
182*89a63228SAndroid Build Coastguard Worker            "-Xep:GetClassOnClass:WARN",
183*89a63228SAndroid Build Coastguard Worker            "-Xep:NullableOnContainingClass:WARN",
184*89a63228SAndroid Build Coastguard Worker            "-Xep:GetClassOnAnnotation:WARN",
185*89a63228SAndroid Build Coastguard Worker            "-Xep:DoNotCall:WARN",
186*89a63228SAndroid Build Coastguard Worker        ],
187*89a63228SAndroid Build Coastguard Worker    },
188*89a63228SAndroid Build Coastguard Worker    lint: {
189*89a63228SAndroid Build Coastguard Worker        warning_checks: [
190*89a63228SAndroid Build Coastguard Worker            "SuspiciousIndentation",
191*89a63228SAndroid Build Coastguard Worker            "NewApi",
192*89a63228SAndroid Build Coastguard Worker        ],
193*89a63228SAndroid Build Coastguard Worker    },
194*89a63228SAndroid Build Coastguard Worker    min_sdk_version: "31",
195*89a63228SAndroid Build Coastguard Worker}
196*89a63228SAndroid Build Coastguard Worker
197*89a63228SAndroid Build Coastguard Worker//
198*89a63228SAndroid Build Coastguard Worker// Build for the target (device).
199*89a63228SAndroid Build Coastguard Worker//
200*89a63228SAndroid Build Coastguard Worker
201*89a63228SAndroid Build Coastguard Worker// A target used to bootstrap compilation for the core library.
202*89a63228SAndroid Build Coastguard Worker//
203*89a63228SAndroid Build Coastguard Worker// See core-all-system-modules for more details.
204*89a63228SAndroid Build Coastguard Workerjava_library {
205*89a63228SAndroid Build Coastguard Worker    name: "core-all",
206*89a63228SAndroid Build Coastguard Worker    defaults: ["libcore_java_defaults"],
207*89a63228SAndroid Build Coastguard Worker
208*89a63228SAndroid Build Coastguard Worker    srcs: [
209*89a63228SAndroid Build Coastguard Worker        // Use the source code for the I18N module intra core API as using the
210*89a63228SAndroid Build Coastguard Worker        // compiled version does not work due to limitations in either soong or the javac
211*89a63228SAndroid Build Coastguard Worker        // toolchain. See http://b/142056316 for more details.
212*89a63228SAndroid Build Coastguard Worker        ":i18n.module.intra.core.api{.public.stubs.source}",
213*89a63228SAndroid Build Coastguard Worker        ":core_oj_java_files",
214*89a63228SAndroid Build Coastguard Worker        ":core_libart_java_files",
215*89a63228SAndroid Build Coastguard Worker        // framework-api-annotations contain API annotations, e.g. @SystemApi.
216*89a63228SAndroid Build Coastguard Worker        ":framework-api-annotations",
217*89a63228SAndroid Build Coastguard Worker        ":openjdk_lambda_stub_files",
218*89a63228SAndroid Build Coastguard Worker        ":app-compat-annotations-source",
219*89a63228SAndroid Build Coastguard Worker
220*89a63228SAndroid Build Coastguard Worker        // Use the okhttp source too to allow libcore code to reference it
221*89a63228SAndroid Build Coastguard Worker        // directly.
222*89a63228SAndroid Build Coastguard Worker        ":okhttp_impl_files",
223*89a63228SAndroid Build Coastguard Worker    ],
224*89a63228SAndroid Build Coastguard Worker    static_libs: [
225*89a63228SAndroid Build Coastguard Worker        "art-aconfig-flags-java-lib-for-core-all-only",
226*89a63228SAndroid Build Coastguard Worker        "libcore-aconfig-flags-lib-for-core-all-only",
227*89a63228SAndroid Build Coastguard Worker    ],
228*89a63228SAndroid Build Coastguard Worker
229*89a63228SAndroid Build Coastguard Worker    sdk_version: "none",
230*89a63228SAndroid Build Coastguard Worker    system_modules: "none",
231*89a63228SAndroid Build Coastguard Worker    patch_module: "java.base",
232*89a63228SAndroid Build Coastguard Worker    openjdk9: {
233*89a63228SAndroid Build Coastguard Worker        srcs: ["luni/src/module/java/module-info.java"],
234*89a63228SAndroid Build Coastguard Worker    },
235*89a63228SAndroid Build Coastguard Worker
236*89a63228SAndroid Build Coastguard Worker    java_resources: core_resources,
237*89a63228SAndroid Build Coastguard Worker
238*89a63228SAndroid Build Coastguard Worker    installable: false,
239*89a63228SAndroid Build Coastguard Worker
240*89a63228SAndroid Build Coastguard Worker    plugins: [
241*89a63228SAndroid Build Coastguard Worker        "compat-changeid-annotation-processor",
242*89a63228SAndroid Build Coastguard Worker        "unsupportedappusage-annotation-processor",
243*89a63228SAndroid Build Coastguard Worker    ],
244*89a63228SAndroid Build Coastguard Worker    libs: [
245*89a63228SAndroid Build Coastguard Worker        "conscrypt.module.intra.core.api.stubs",
246*89a63228SAndroid Build Coastguard Worker    ],
247*89a63228SAndroid Build Coastguard Worker
248*89a63228SAndroid Build Coastguard Worker    java_version: "21",
249*89a63228SAndroid Build Coastguard Worker}
250*89a63228SAndroid Build Coastguard Worker
251*89a63228SAndroid Build Coastguard Workerplatform_compat_config {
252*89a63228SAndroid Build Coastguard Worker    name: "libcore-platform-compat-config",
253*89a63228SAndroid Build Coastguard Worker    src: ":core-all",
254*89a63228SAndroid Build Coastguard Worker    visibility: [
255*89a63228SAndroid Build Coastguard Worker        "//art/build/apex",
256*89a63228SAndroid Build Coastguard Worker        "//art/build/sdk",
257*89a63228SAndroid Build Coastguard Worker    ],
258*89a63228SAndroid Build Coastguard Worker}
259*89a63228SAndroid Build Coastguard Worker
260*89a63228SAndroid Build Coastguard Worker// A system modules definition for use by core library targets only. It only
261*89a63228SAndroid Build Coastguard Worker// contains the core-all jar, which contains the classes that end up in core-oj,
262*89a63228SAndroid Build Coastguard Worker// core-libart as well as the lambda stubs needed to compile Java lambda code.
263*89a63228SAndroid Build Coastguard Worker// It does not contain other parts of core library like conscrypt, bouncycastle,
264*89a63228SAndroid Build Coastguard Worker// etc. This system_modules definition is used to bootstrap compilation for
265*89a63228SAndroid Build Coastguard Worker// other parts of the core library like core-oj, core-libart, conscrypt,
266*89a63228SAndroid Build Coastguard Worker// bouncycastle, etc. It is also used to compile Libcore tests, as well as ART
267*89a63228SAndroid Build Coastguard Worker// Java tests (run-tests).
268*89a63228SAndroid Build Coastguard Workerjava_system_modules {
269*89a63228SAndroid Build Coastguard Worker    name: "core-all-system-modules",
270*89a63228SAndroid Build Coastguard Worker
271*89a63228SAndroid Build Coastguard Worker    // Visibility is deliberately restricted to a small set of build modules that
272*89a63228SAndroid Build Coastguard Worker    // the core library team control.
273*89a63228SAndroid Build Coastguard Worker    visibility: [
274*89a63228SAndroid Build Coastguard Worker        "//art/build/flags",
275*89a63228SAndroid Build Coastguard Worker        "//art/test:__subpackages__",
276*89a63228SAndroid Build Coastguard Worker        "//build/make/tools/aconfig/aconfig_storage_file",
277*89a63228SAndroid Build Coastguard Worker        "//build/make/tools/aconfig/aconfig_storage_read_api",
278*89a63228SAndroid Build Coastguard Worker        "//build/make/tools/aconfig/fake_device_config",
279*89a63228SAndroid Build Coastguard Worker        "//external/apache-harmony:__subpackages__",
280*89a63228SAndroid Build Coastguard Worker        "//external/apache-xml",
281*89a63228SAndroid Build Coastguard Worker        "//external/icu",
282*89a63228SAndroid Build Coastguard Worker        "//external/conscrypt",
283*89a63228SAndroid Build Coastguard Worker        "//external/okhttp",
284*89a63228SAndroid Build Coastguard Worker        "//frameworks/libs/modules-utils/java",
285*89a63228SAndroid Build Coastguard Worker        "//libcore:__subpackages__",
286*89a63228SAndroid Build Coastguard Worker        "//tools/platform-compat/java/android/compat/annotation",
287*89a63228SAndroid Build Coastguard Worker    ],
288*89a63228SAndroid Build Coastguard Worker
289*89a63228SAndroid Build Coastguard Worker    libs: ["core-all"],
290*89a63228SAndroid Build Coastguard Worker}
291*89a63228SAndroid Build Coastguard Worker
292*89a63228SAndroid Build Coastguard Worker// Contains the parts of core library associated with OpenJDK.
293*89a63228SAndroid Build Coastguard Workerjava_library {
294*89a63228SAndroid Build Coastguard Worker    name: "core-oj",
295*89a63228SAndroid Build Coastguard Worker    visibility: [
296*89a63228SAndroid Build Coastguard Worker        "//art/build/apex",
297*89a63228SAndroid Build Coastguard Worker        "//art/build/sdk",
298*89a63228SAndroid Build Coastguard Worker        "//art/tools/ahat",
299*89a63228SAndroid Build Coastguard Worker        "//art/tools/fuzzer",
300*89a63228SAndroid Build Coastguard Worker        "//external/wycheproof",
301*89a63228SAndroid Build Coastguard Worker        "//libcore/benchmarks",
302*89a63228SAndroid Build Coastguard Worker        "//packages/modules/ArtPrebuilt",
303*89a63228SAndroid Build Coastguard Worker    ],
304*89a63228SAndroid Build Coastguard Worker    apex_available: [
305*89a63228SAndroid Build Coastguard Worker        "com.android.art",
306*89a63228SAndroid Build Coastguard Worker        "com.android.art.debug",
307*89a63228SAndroid Build Coastguard Worker    ],
308*89a63228SAndroid Build Coastguard Worker    defaults: ["libcore_java_defaults"],
309*89a63228SAndroid Build Coastguard Worker    installable: true,
310*89a63228SAndroid Build Coastguard Worker    hostdex: true,
311*89a63228SAndroid Build Coastguard Worker
312*89a63228SAndroid Build Coastguard Worker    srcs: [":core_oj_java_files"],
313*89a63228SAndroid Build Coastguard Worker    java_resources: core_resources,
314*89a63228SAndroid Build Coastguard Worker
315*89a63228SAndroid Build Coastguard Worker    sdk_version: "none",
316*89a63228SAndroid Build Coastguard Worker    system_modules: "core-all-system-modules",
317*89a63228SAndroid Build Coastguard Worker    patch_module: "java.base",
318*89a63228SAndroid Build Coastguard Worker
319*89a63228SAndroid Build Coastguard Worker    jacoco: {
320*89a63228SAndroid Build Coastguard Worker        exclude_filter: [
321*89a63228SAndroid Build Coastguard Worker            "java.lang.Class",
322*89a63228SAndroid Build Coastguard Worker            "java.lang.Long",
323*89a63228SAndroid Build Coastguard Worker            "java.lang.Number",
324*89a63228SAndroid Build Coastguard Worker            "java.lang.Object",
325*89a63228SAndroid Build Coastguard Worker            "java.lang.String",
326*89a63228SAndroid Build Coastguard Worker            "java.lang.invoke.MethodHandle",
327*89a63228SAndroid Build Coastguard Worker            "java.lang.invoke.VarHandle",
328*89a63228SAndroid Build Coastguard Worker            "java.lang.ref.Reference",
329*89a63228SAndroid Build Coastguard Worker            "java.lang.reflect.Proxy",
330*89a63228SAndroid Build Coastguard Worker            "java.util.AbstractMap",
331*89a63228SAndroid Build Coastguard Worker            "java.util.HashMap",
332*89a63228SAndroid Build Coastguard Worker            "java.util.HashMap$Node",
333*89a63228SAndroid Build Coastguard Worker            "java.util.Map",
334*89a63228SAndroid Build Coastguard Worker        ],
335*89a63228SAndroid Build Coastguard Worker    },
336*89a63228SAndroid Build Coastguard Worker
337*89a63228SAndroid Build Coastguard Worker    hiddenapi_additional_annotations: [
338*89a63228SAndroid Build Coastguard Worker        "core-oj-hiddenapi-annotations",
339*89a63228SAndroid Build Coastguard Worker    ],
340*89a63228SAndroid Build Coastguard Worker
341*89a63228SAndroid Build Coastguard Worker    errorprone: {
342*89a63228SAndroid Build Coastguard Worker        javacflags: [
343*89a63228SAndroid Build Coastguard Worker            "-Xep:ReturnValueIgnored:WARN",
344*89a63228SAndroid Build Coastguard Worker            "-Xep:HashtableContains:WARN",
345*89a63228SAndroid Build Coastguard Worker            "-Xep:ComparableType:WARN",
346*89a63228SAndroid Build Coastguard Worker            "-Xep:IdentityBinaryExpression:WARN",
347*89a63228SAndroid Build Coastguard Worker            "-Xep:BoxedPrimitiveEquality:WARN",
348*89a63228SAndroid Build Coastguard Worker            "-Xep:EmptyTopLevelDeclaration:WARN",
349*89a63228SAndroid Build Coastguard Worker            "-Xep:GetClassOnClass:WARN",
350*89a63228SAndroid Build Coastguard Worker        ],
351*89a63228SAndroid Build Coastguard Worker    },
352*89a63228SAndroid Build Coastguard Worker}
353*89a63228SAndroid Build Coastguard Worker
354*89a63228SAndroid Build Coastguard Worker// Contains parts of core library not associated with OpenJDK. Contains not
355*89a63228SAndroid Build Coastguard Worker// just java.*, javax.* code but also android.system.* and various internal
356*89a63228SAndroid Build Coastguard Worker// libcore.* packages.
357*89a63228SAndroid Build Coastguard Workerjava_library {
358*89a63228SAndroid Build Coastguard Worker    name: "core-libart",
359*89a63228SAndroid Build Coastguard Worker    visibility: [
360*89a63228SAndroid Build Coastguard Worker        "//art/build/apex",
361*89a63228SAndroid Build Coastguard Worker        "//art/build/sdk",
362*89a63228SAndroid Build Coastguard Worker        "//art/tools/ahat",
363*89a63228SAndroid Build Coastguard Worker        "//art/tools/fuzzer",
364*89a63228SAndroid Build Coastguard Worker        "//external/wycheproof",
365*89a63228SAndroid Build Coastguard Worker        "//libcore/benchmarks",
366*89a63228SAndroid Build Coastguard Worker        "//packages/modules/ArtPrebuilt",
367*89a63228SAndroid Build Coastguard Worker    ],
368*89a63228SAndroid Build Coastguard Worker    apex_available: [
369*89a63228SAndroid Build Coastguard Worker        "com.android.art",
370*89a63228SAndroid Build Coastguard Worker        "com.android.art.debug",
371*89a63228SAndroid Build Coastguard Worker    ],
372*89a63228SAndroid Build Coastguard Worker    defaults: ["libcore_java_defaults"],
373*89a63228SAndroid Build Coastguard Worker    installable: true,
374*89a63228SAndroid Build Coastguard Worker    hostdex: true,
375*89a63228SAndroid Build Coastguard Worker
376*89a63228SAndroid Build Coastguard Worker    srcs: [":core_libart_java_files"],
377*89a63228SAndroid Build Coastguard Worker    static_libs: [
378*89a63228SAndroid Build Coastguard Worker        "art-aconfig-flags-java-lib",
379*89a63228SAndroid Build Coastguard Worker        "libcore-aconfig-flags-lib",
380*89a63228SAndroid Build Coastguard Worker    ],
381*89a63228SAndroid Build Coastguard Worker
382*89a63228SAndroid Build Coastguard Worker    sdk_version: "none",
383*89a63228SAndroid Build Coastguard Worker    system_modules: "core-all-system-modules",
384*89a63228SAndroid Build Coastguard Worker    patch_module: "java.base",
385*89a63228SAndroid Build Coastguard Worker
386*89a63228SAndroid Build Coastguard Worker    jacoco: {
387*89a63228SAndroid Build Coastguard Worker        exclude_filter: [
388*89a63228SAndroid Build Coastguard Worker            "java.lang.DexCache",
389*89a63228SAndroid Build Coastguard Worker            "dalvik.system.ClassExt",
390*89a63228SAndroid Build Coastguard Worker        ],
391*89a63228SAndroid Build Coastguard Worker    },
392*89a63228SAndroid Build Coastguard Worker
393*89a63228SAndroid Build Coastguard Worker    target: {
394*89a63228SAndroid Build Coastguard Worker        hostdex: {
395*89a63228SAndroid Build Coastguard Worker            required: [
396*89a63228SAndroid Build Coastguard Worker                // Files used to simulate the /system, runtime APEX and tzdata
397*89a63228SAndroid Build Coastguard Worker                // APEX dir structure on host.
398*89a63228SAndroid Build Coastguard Worker                "tzdata_icu_res_files_host_prebuilts",
399*89a63228SAndroid Build Coastguard Worker                "tzdata_host",
400*89a63228SAndroid Build Coastguard Worker                "tzdata_host_tzdata_apex",
401*89a63228SAndroid Build Coastguard Worker                "tzlookup.xml_host_tzdata_apex",
402*89a63228SAndroid Build Coastguard Worker                "tz_version_host",
403*89a63228SAndroid Build Coastguard Worker                "tz_version_host_tzdata_apex",
404*89a63228SAndroid Build Coastguard Worker            ],
405*89a63228SAndroid Build Coastguard Worker        },
406*89a63228SAndroid Build Coastguard Worker        darwin: {
407*89a63228SAndroid Build Coastguard Worker            enabled: false,
408*89a63228SAndroid Build Coastguard Worker        },
409*89a63228SAndroid Build Coastguard Worker    },
410*89a63228SAndroid Build Coastguard Worker
411*89a63228SAndroid Build Coastguard Worker    errorprone: {
412*89a63228SAndroid Build Coastguard Worker        javacflags: [
413*89a63228SAndroid Build Coastguard Worker            "-Xep:EmptyTopLevelDeclaration:WARN",
414*89a63228SAndroid Build Coastguard Worker            "-Xep:GetClassOnAnnotation:WARN",
415*89a63228SAndroid Build Coastguard Worker            "-Xep:NullableOnContainingClass:WARN",
416*89a63228SAndroid Build Coastguard Worker        ],
417*89a63228SAndroid Build Coastguard Worker    },
418*89a63228SAndroid Build Coastguard Worker
419*89a63228SAndroid Build Coastguard Worker    java_version: "21",
420*89a63228SAndroid Build Coastguard Worker}
421*89a63228SAndroid Build Coastguard Worker
422*89a63228SAndroid Build Coastguard Worker// Java library for use on host, e.g. by robolectric or layoutlib.
423*89a63228SAndroid Build Coastguard Workerjava_library {
424*89a63228SAndroid Build Coastguard Worker    name: "core-libart-for-host",
425*89a63228SAndroid Build Coastguard Worker    visibility: [
426*89a63228SAndroid Build Coastguard Worker        "//art/build/sdk",
427*89a63228SAndroid Build Coastguard Worker        "//external/robolectric",
428*89a63228SAndroid Build Coastguard Worker        "//external/robolectric-shadows",
429*89a63228SAndroid Build Coastguard Worker        "//frameworks/base",
430*89a63228SAndroid Build Coastguard Worker        "//frameworks/layoutlib",
431*89a63228SAndroid Build Coastguard Worker    ],
432*89a63228SAndroid Build Coastguard Worker    static_libs: [
433*89a63228SAndroid Build Coastguard Worker        "core-libart",
434*89a63228SAndroid Build Coastguard Worker    ],
435*89a63228SAndroid Build Coastguard Worker    sdk_version: "none",
436*89a63228SAndroid Build Coastguard Worker    system_modules: "none",
437*89a63228SAndroid Build Coastguard Worker}
438*89a63228SAndroid Build Coastguard Worker
439*89a63228SAndroid Build Coastguard Worker// Provided solely to contribute information about which hidden parts of the
440*89a63228SAndroid Build Coastguard Worker// core-oj API are used by apps.
441*89a63228SAndroid Build Coastguard Worker//
442*89a63228SAndroid Build Coastguard Worker// Usually, e.g. for core-libart, the UnsupportedAppUsage annotations are
443*89a63228SAndroid Build Coastguard Worker// added to the source that is compiled directly into the bootjar and the build
444*89a63228SAndroid Build Coastguard Worker// system extracts the information about UnsupportedAppUsage directly from
445*89a63228SAndroid Build Coastguard Worker// there.
446*89a63228SAndroid Build Coastguard Worker//
447*89a63228SAndroid Build Coastguard Worker// This approach of having separate annotated source and a separate build
448*89a63228SAndroid Build Coastguard Worker// target was taken for ojluni to avoid having to maintain local patches in the
449*89a63228SAndroid Build Coastguard Worker// ojluni source for UnsupportedAppUsage annotations as that would make it more
450*89a63228SAndroid Build Coastguard Worker// difficult to pull down changes from upstream.
451*89a63228SAndroid Build Coastguard Worker//
452*89a63228SAndroid Build Coastguard Workerjava_library {
453*89a63228SAndroid Build Coastguard Worker    name: "core-oj-hiddenapi-annotations",
454*89a63228SAndroid Build Coastguard Worker    // Do not allow this to be accessed from outside this directory.
455*89a63228SAndroid Build Coastguard Worker    visibility: ["//libcore:__subpackages__"],
456*89a63228SAndroid Build Coastguard Worker    defaults: ["libcore_java_defaults"],
457*89a63228SAndroid Build Coastguard Worker    compile_dex: true,
458*89a63228SAndroid Build Coastguard Worker
459*89a63228SAndroid Build Coastguard Worker    srcs: [":openjdk_hiddenapi_javadoc_files"],
460*89a63228SAndroid Build Coastguard Worker
461*89a63228SAndroid Build Coastguard Worker    sdk_version: "none",
462*89a63228SAndroid Build Coastguard Worker    system_modules: "core-all-system-modules",
463*89a63228SAndroid Build Coastguard Worker    patch_module: "java.base",
464*89a63228SAndroid Build Coastguard Worker    plugins: ["unsupportedappusage-annotation-processor"],
465*89a63228SAndroid Build Coastguard Worker
466*89a63228SAndroid Build Coastguard Worker    errorprone: {
467*89a63228SAndroid Build Coastguard Worker        javacflags: [
468*89a63228SAndroid Build Coastguard Worker            "-Xep:ComparableType:WARN",
469*89a63228SAndroid Build Coastguard Worker        ],
470*89a63228SAndroid Build Coastguard Worker    },
471*89a63228SAndroid Build Coastguard Worker}
472*89a63228SAndroid Build Coastguard Worker
473*89a63228SAndroid Build Coastguard Workerjava_defaults {
474*89a63228SAndroid Build Coastguard Worker    name: "core_lambda_stubs_defaults",
475*89a63228SAndroid Build Coastguard Worker    defaults: ["libcore_java_defaults"],
476*89a63228SAndroid Build Coastguard Worker    hostdex: true,
477*89a63228SAndroid Build Coastguard Worker
478*89a63228SAndroid Build Coastguard Worker    sdk_version: "none",
479*89a63228SAndroid Build Coastguard Worker    system_modules: "core-all-system-modules",
480*89a63228SAndroid Build Coastguard Worker    patch_module: "java.base",
481*89a63228SAndroid Build Coastguard Worker
482*89a63228SAndroid Build Coastguard Worker    installable: false,
483*89a63228SAndroid Build Coastguard Worker    include_srcs: true,
484*89a63228SAndroid Build Coastguard Worker}
485*89a63228SAndroid Build Coastguard Worker
486*89a63228SAndroid Build Coastguard Worker// Creates a jar that exists to satisfy javac when compiling source code that
487*89a63228SAndroid Build Coastguard Worker// contains lambdas. This contains all classes / methods required by javac
488*89a63228SAndroid Build Coastguard Worker// when generating invoke-dynamic lambda implementation code, even those that
489*89a63228SAndroid Build Coastguard Worker// are also in the public SDK API from API level 26 onwards.
490*89a63228SAndroid Build Coastguard Workerjava_library {
491*89a63228SAndroid Build Coastguard Worker    name: "core-lambda-stubs",
492*89a63228SAndroid Build Coastguard Worker    visibility: [
493*89a63228SAndroid Build Coastguard Worker        "//visibility:public",
494*89a63228SAndroid Build Coastguard Worker    ],
495*89a63228SAndroid Build Coastguard Worker    defaults: ["core_lambda_stubs_defaults"],
496*89a63228SAndroid Build Coastguard Worker    srcs: [
497*89a63228SAndroid Build Coastguard Worker        ":openjdk_lambda_stub_files",
498*89a63228SAndroid Build Coastguard Worker        ":openjdk_lambda_duplicate_stub_files",
499*89a63228SAndroid Build Coastguard Worker    ],
500*89a63228SAndroid Build Coastguard Worker    // This jar is packaged as part of the SDK, use -target 8 so that it works
501*89a63228SAndroid Build Coastguard Worker    // with old JDKs.
502*89a63228SAndroid Build Coastguard Worker    java_version: "1.8",
503*89a63228SAndroid Build Coastguard Worker    is_stubs_module: true,
504*89a63228SAndroid Build Coastguard Worker}
505*89a63228SAndroid Build Coastguard Worker
506*89a63228SAndroid Build Coastguard Worker// An alternative to core-lambda-stubs that omits openjdk_lambda_duplicate_stub_files
507*89a63228SAndroid Build Coastguard Worker// because those classes are also part of the core library public SDK API
508*89a63228SAndroid Build Coastguard Worker// (since API level 26).
509*89a63228SAndroid Build Coastguard Workerjava_library {
510*89a63228SAndroid Build Coastguard Worker    name: "core-lambda-stubs-for-system-modules",
511*89a63228SAndroid Build Coastguard Worker    visibility: [
512*89a63228SAndroid Build Coastguard Worker        "//art/build/sdk",
513*89a63228SAndroid Build Coastguard Worker        "//build/soong/java/core-libraries",
514*89a63228SAndroid Build Coastguard Worker        "//frameworks/base",
515*89a63228SAndroid Build Coastguard Worker        "//frameworks/base/api",
516*89a63228SAndroid Build Coastguard Worker    ],
517*89a63228SAndroid Build Coastguard Worker    defaults: ["core_lambda_stubs_defaults"],
518*89a63228SAndroid Build Coastguard Worker    srcs: [
519*89a63228SAndroid Build Coastguard Worker        ":openjdk_lambda_stub_files",
520*89a63228SAndroid Build Coastguard Worker    ],
521*89a63228SAndroid Build Coastguard Worker    include_srcs: true,
522*89a63228SAndroid Build Coastguard Worker    // This jar is packaged as part of the SDK, use -target 8 so that it works
523*89a63228SAndroid Build Coastguard Worker    // with old JDKs.
524*89a63228SAndroid Build Coastguard Worker    java_version: "1.8",
525*89a63228SAndroid Build Coastguard Worker}
526*89a63228SAndroid Build Coastguard Worker
527*89a63228SAndroid Build Coastguard Worker// This is an empty jar that exists for backwards compatibility with T (and below).
528*89a63228SAndroid Build Coastguard Worker// Historically, it existed to satisfy javac when compiling source code that
529*89a63228SAndroid Build Coastguard Worker// contains @Generated annotations.
530*89a63228SAndroid Build Coastguard Worker// This is no longer necessary since @Generated was added to ART's Public API
531*89a63228SAndroid Build Coastguard Worker// surface in U.
532*89a63228SAndroid Build Coastguard Workerjava_library {
533*89a63228SAndroid Build Coastguard Worker    name: "core-generated-annotation-stubs",
534*89a63228SAndroid Build Coastguard Worker    visibility: [
535*89a63228SAndroid Build Coastguard Worker        "//art/build/sdk",
536*89a63228SAndroid Build Coastguard Worker        "//build/soong/java/core-libraries",
537*89a63228SAndroid Build Coastguard Worker        "//frameworks/base",
538*89a63228SAndroid Build Coastguard Worker        "//frameworks/base/api",
539*89a63228SAndroid Build Coastguard Worker    ],
540*89a63228SAndroid Build Coastguard Worker    defaults: ["libcore_java_defaults"],
541*89a63228SAndroid Build Coastguard Worker    srcs: [
542*89a63228SAndroid Build Coastguard Worker    ],
543*89a63228SAndroid Build Coastguard Worker    hostdex: true,
544*89a63228SAndroid Build Coastguard Worker    sdk_version: "none",
545*89a63228SAndroid Build Coastguard Worker    system_modules: "core-all-system-modules",
546*89a63228SAndroid Build Coastguard Worker    patch_module: "java.base",
547*89a63228SAndroid Build Coastguard Worker    installable: false,
548*89a63228SAndroid Build Coastguard Worker    include_srcs: true,
549*89a63228SAndroid Build Coastguard Worker    // This jar is packaged as part of the SDK, use -target 8 so that it works
550*89a63228SAndroid Build Coastguard Worker    // with old JDKs.
551*89a63228SAndroid Build Coastguard Worker    java_version: "1.8",
552*89a63228SAndroid Build Coastguard Worker}
553*89a63228SAndroid Build Coastguard Worker
554*89a63228SAndroid Build Coastguard Worker// Builds libcore test rules
555*89a63228SAndroid Build Coastguard Workerjava_library_static {
556*89a63228SAndroid Build Coastguard Worker    name: "core-test-rules",
557*89a63228SAndroid Build Coastguard Worker    visibility: [
558*89a63228SAndroid Build Coastguard Worker        "//art/build/sdk",
559*89a63228SAndroid Build Coastguard Worker        "//cts/tests/core/runner-axt",
560*89a63228SAndroid Build Coastguard Worker        "//cts/tests/tests/util",
561*89a63228SAndroid Build Coastguard Worker        "//external/conscrypt",
562*89a63228SAndroid Build Coastguard Worker        "//external/conscrypt/apex/tests",
563*89a63228SAndroid Build Coastguard Worker        "//frameworks/base/location/tests/locationtests",
564*89a63228SAndroid Build Coastguard Worker        "//frameworks/base/core/tests/coretests",
565*89a63228SAndroid Build Coastguard Worker        "//frameworks/base/wifi/tests",
566*89a63228SAndroid Build Coastguard Worker        "//libcore/ojluni/src/test",
567*89a63228SAndroid Build Coastguard Worker        "//libcore/luni/src/test/java9compatibility",
568*89a63228SAndroid Build Coastguard Worker        "//packages/modules/Wifi/framework/tests",
569*89a63228SAndroid Build Coastguard Worker    ],
570*89a63228SAndroid Build Coastguard Worker    hostdex: true,
571*89a63228SAndroid Build Coastguard Worker    srcs: [
572*89a63228SAndroid Build Coastguard Worker        "dalvik/test-rules/src/main/**/*.java",
573*89a63228SAndroid Build Coastguard Worker        "test-rules/src/main/**/*.java",
574*89a63228SAndroid Build Coastguard Worker    ],
575*89a63228SAndroid Build Coastguard Worker    static_libs: [
576*89a63228SAndroid Build Coastguard Worker        "junit",
577*89a63228SAndroid Build Coastguard Worker        "platform-test-annotations",
578*89a63228SAndroid Build Coastguard Worker    ],
579*89a63228SAndroid Build Coastguard Worker
580*89a63228SAndroid Build Coastguard Worker    sdk_version: "none",
581*89a63228SAndroid Build Coastguard Worker    system_modules: "core-all-system-modules",
582*89a63228SAndroid Build Coastguard Worker}
583*89a63228SAndroid Build Coastguard Worker
584*89a63228SAndroid Build Coastguard Worker// Builds platform_compat test rules
585*89a63228SAndroid Build Coastguard Workerjava_library_static {
586*89a63228SAndroid Build Coastguard Worker    name: "core-compat-test-rules",
587*89a63228SAndroid Build Coastguard Worker    visibility: [
588*89a63228SAndroid Build Coastguard Worker        "//art/build/sdk",
589*89a63228SAndroid Build Coastguard Worker        "//libcore:__subpackages__",
590*89a63228SAndroid Build Coastguard Worker        "//frameworks/base/tests/PlatformCompatGating/test-rules",
591*89a63228SAndroid Build Coastguard Worker        "//libcore:__subpackages__",
592*89a63228SAndroid Build Coastguard Worker    ],
593*89a63228SAndroid Build Coastguard Worker    srcs: [
594*89a63228SAndroid Build Coastguard Worker        "luni/src/main/java/android/compat/**/*.java",
595*89a63228SAndroid Build Coastguard Worker        "test-rules/src/platform_compat/**/*.java",
596*89a63228SAndroid Build Coastguard Worker        "luni/src/main/java/libcore/api/CorePlatformApi.java",
597*89a63228SAndroid Build Coastguard Worker        "luni/src/main/java/libcore/api/IntraCoreApi.java",
598*89a63228SAndroid Build Coastguard Worker    ],
599*89a63228SAndroid Build Coastguard Worker    static_libs: [
600*89a63228SAndroid Build Coastguard Worker        "junit",
601*89a63228SAndroid Build Coastguard Worker        "guava",
602*89a63228SAndroid Build Coastguard Worker    ],
603*89a63228SAndroid Build Coastguard Worker    sdk_version: "none",
604*89a63228SAndroid Build Coastguard Worker    system_modules: "core-all-system-modules",
605*89a63228SAndroid Build Coastguard Worker    // This builds classes that are in the java.base Java module:
606*89a63228SAndroid Build Coastguard Worker    patch_module: "java.base",
607*89a63228SAndroid Build Coastguard Worker    hostdex: true,
608*89a63228SAndroid Build Coastguard Worker
609*89a63228SAndroid Build Coastguard Worker    errorprone: {
610*89a63228SAndroid Build Coastguard Worker        javacflags: [
611*89a63228SAndroid Build Coastguard Worker            "-Xep:EmptyTopLevelDeclaration:WARN",
612*89a63228SAndroid Build Coastguard Worker            "-Xep:GetClassOnAnnotation:WARN",
613*89a63228SAndroid Build Coastguard Worker        ],
614*89a63228SAndroid Build Coastguard Worker    },
615*89a63228SAndroid Build Coastguard Worker}
616*89a63228SAndroid Build Coastguard Worker
617*89a63228SAndroid Build Coastguard Worker// Builds the core-tests-support library used by various tests.
618*89a63228SAndroid Build Coastguard Workerjava_library_static {
619*89a63228SAndroid Build Coastguard Worker    name: "core-tests-support",
620*89a63228SAndroid Build Coastguard Worker    visibility: [
621*89a63228SAndroid Build Coastguard Worker        "//art/build/sdk",
622*89a63228SAndroid Build Coastguard Worker        "//cts/apps/CtsVerifier",
623*89a63228SAndroid Build Coastguard Worker        "//cts/tests/tests/keystore",
624*89a63228SAndroid Build Coastguard Worker        "//cts/tests/tests/net",
625*89a63228SAndroid Build Coastguard Worker        "//cts/hostsidetests/statsdatom/apps/statsdapp",
626*89a63228SAndroid Build Coastguard Worker        "//cts/tests/tests/net/api23Test",
627*89a63228SAndroid Build Coastguard Worker        "//external/apache-harmony",
628*89a63228SAndroid Build Coastguard Worker        "//frameworks/base/core/tests/coretests",
629*89a63228SAndroid Build Coastguard Worker        "//frameworks/base/apct-tests/perftests/core",
630*89a63228SAndroid Build Coastguard Worker        "//libcore/benchmarks",
631*89a63228SAndroid Build Coastguard Worker        "//packages/apps/KeyChain/tests",
632*89a63228SAndroid Build Coastguard Worker        "//system/timezone/distro/core",
633*89a63228SAndroid Build Coastguard Worker        "//packages/modules/Connectivity/tests:__subpackages__",
634*89a63228SAndroid Build Coastguard Worker    ],
635*89a63228SAndroid Build Coastguard Worker    hostdex: true,
636*89a63228SAndroid Build Coastguard Worker    srcs: ["support/src/test/java/**/*.java"],
637*89a63228SAndroid Build Coastguard Worker
638*89a63228SAndroid Build Coastguard Worker    sdk_version: "core_platform",
639*89a63228SAndroid Build Coastguard Worker    // Make sure that this will be added to the sdk snapshot for S.
640*89a63228SAndroid Build Coastguard Worker    min_sdk_version: "S",
641*89a63228SAndroid Build Coastguard Worker    libs: ["junit"],
642*89a63228SAndroid Build Coastguard Worker    static_libs: [
643*89a63228SAndroid Build Coastguard Worker        "bouncycastle-unbundled",
644*89a63228SAndroid Build Coastguard Worker        "bouncycastle-bcpkix-unbundled",
645*89a63228SAndroid Build Coastguard Worker        "bouncycastle-ocsp-unbundled",
646*89a63228SAndroid Build Coastguard Worker    ],
647*89a63228SAndroid Build Coastguard Worker    errorprone: {
648*89a63228SAndroid Build Coastguard Worker        javacflags: [
649*89a63228SAndroid Build Coastguard Worker            "-Xep:BoxedPrimitiveEquality:WARN",
650*89a63228SAndroid Build Coastguard Worker        ],
651*89a63228SAndroid Build Coastguard Worker    },
652*89a63228SAndroid Build Coastguard Worker}
653*89a63228SAndroid Build Coastguard Worker
654*89a63228SAndroid Build Coastguard Worker// Used to generate the prebuilt file luni/src/test/resources/prebuilt-dex-from-java.dex.
655*89a63228SAndroid Build Coastguard Worker// The reason why we pre-build this dex file is to stabilize the test result from the
656*89a63228SAndroid Build Coastguard Worker// dexer / javac / other toolchains change.
657*89a63228SAndroid Build Coastguard Worker// Regenerate the prebuilt file with the following command:
658*89a63228SAndroid Build Coastguard Worker//   m core-tests-prebuilt-dex-from-java &&
659*89a63228SAndroid Build Coastguard Worker//   unzip out/soong/.intermediates/libcore/core-tests-prebuilt-dex-from-java/android_common/dex/core-tests-prebuilt-dex-from-java.jar classes.dex \
660*89a63228SAndroid Build Coastguard Worker//   -d libcore/luni/src/test/resources/ && mv libcore/luni/src/test/resources/classes.dex libcore/luni/src/test/resources/prebuilt-dex-from-java.dex
661*89a63228SAndroid Build Coastguard Workerjava_test {
662*89a63228SAndroid Build Coastguard Worker    name: "core-tests-prebuilt-dex-from-java",
663*89a63228SAndroid Build Coastguard Worker    srcs: ["luni/src/test/dex_src/**/*.java"],
664*89a63228SAndroid Build Coastguard Worker    compile_dex: true,
665*89a63228SAndroid Build Coastguard Worker    defaults: ["libcore_java_defaults"],
666*89a63228SAndroid Build Coastguard Worker    sdk_version: "none",
667*89a63228SAndroid Build Coastguard Worker    system_modules: "core-all-system-modules",
668*89a63228SAndroid Build Coastguard Worker
669*89a63228SAndroid Build Coastguard Worker    visibility: [
670*89a63228SAndroid Build Coastguard Worker        "//libcore:__subpackages__",
671*89a63228SAndroid Build Coastguard Worker    ],
672*89a63228SAndroid Build Coastguard Worker}
673*89a63228SAndroid Build Coastguard Worker
674*89a63228SAndroid Build Coastguard Worker// Builds the jsr166-tests library.
675*89a63228SAndroid Build Coastguard Workerjava_test {
676*89a63228SAndroid Build Coastguard Worker    name: "jsr166-tests",
677*89a63228SAndroid Build Coastguard Worker    visibility: [
678*89a63228SAndroid Build Coastguard Worker        "//art/build/sdk",
679*89a63228SAndroid Build Coastguard Worker        "//cts/tests/libcore/jsr166",
680*89a63228SAndroid Build Coastguard Worker    ],
681*89a63228SAndroid Build Coastguard Worker    srcs: ["jsr166-tests/src/test/java/**/*.java"],
682*89a63228SAndroid Build Coastguard Worker    sdk_version: "none",
683*89a63228SAndroid Build Coastguard Worker    system_modules: "core-all-system-modules",
684*89a63228SAndroid Build Coastguard Worker    libs: [
685*89a63228SAndroid Build Coastguard Worker        "junit",
686*89a63228SAndroid Build Coastguard Worker    ],
687*89a63228SAndroid Build Coastguard Worker    errorprone: {
688*89a63228SAndroid Build Coastguard Worker        javacflags: [
689*89a63228SAndroid Build Coastguard Worker            "-Xep:DoNotCall:OFF",
690*89a63228SAndroid Build Coastguard Worker            "-Xep:ModifyingCollectionWithItself:WARN",
691*89a63228SAndroid Build Coastguard Worker            "-Xep:ReturnValueIgnored:WARN",
692*89a63228SAndroid Build Coastguard Worker            "-Xep:HashtableContains:WARN",
693*89a63228SAndroid Build Coastguard Worker        ],
694*89a63228SAndroid Build Coastguard Worker    },
695*89a63228SAndroid Build Coastguard Worker}
696*89a63228SAndroid Build Coastguard Worker
697*89a63228SAndroid Build Coastguard Worker// A filegroup that provides access to a source file for a toolchain test that
698*89a63228SAndroid Build Coastguard Worker// checks Java 9 language features are handled properly by JarJar.
699*89a63228SAndroid Build Coastguard Workerfilegroup {
700*89a63228SAndroid Build Coastguard Worker    name: "core-java-9-language-features-source",
701*89a63228SAndroid Build Coastguard Worker    srcs: ["luni/src/main/java/libcore/internal/Java9LanguageFeatures.java"],
702*89a63228SAndroid Build Coastguard Worker    visibility: ["//libcore/luni/src/test/java9language"],
703*89a63228SAndroid Build Coastguard Worker}
704*89a63228SAndroid Build Coastguard Worker
705*89a63228SAndroid Build Coastguard Worker// A filegroup that provides access to a source file for a toolchain test that
706*89a63228SAndroid Build Coastguard Worker// checks Java 11 language features are handled properly by JarJar.
707*89a63228SAndroid Build Coastguard Workerfilegroup {
708*89a63228SAndroid Build Coastguard Worker    name: "core-java-11-language-features-source",
709*89a63228SAndroid Build Coastguard Worker    srcs: ["luni/src/main/java/libcore/internal/Java11LanguageFeatures.java"],
710*89a63228SAndroid Build Coastguard Worker    visibility: ["//libcore/luni/src/test/java11language"],
711*89a63228SAndroid Build Coastguard Worker}
712*89a63228SAndroid Build Coastguard Worker
713*89a63228SAndroid Build Coastguard Worker// A filegroup that provides access to a source file for a toolchain test that
714*89a63228SAndroid Build Coastguard Worker// checks Java 17 language features are handled properly by JarJar.
715*89a63228SAndroid Build Coastguard Workerfilegroup {
716*89a63228SAndroid Build Coastguard Worker    name: "core-java-17-language-features-source",
717*89a63228SAndroid Build Coastguard Worker    srcs: ["luni/src/main/java/libcore/internal/Java17LanguageFeatures.java"],
718*89a63228SAndroid Build Coastguard Worker    visibility: ["//libcore/luni/src/test/java17language"],
719*89a63228SAndroid Build Coastguard Worker}
720*89a63228SAndroid Build Coastguard Worker
721*89a63228SAndroid Build Coastguard Worker// A filegroup that provides access to a source file for a toolchain test that
722*89a63228SAndroid Build Coastguard Worker// checks Java 21 language features are handled properly by JarJar.
723*89a63228SAndroid Build Coastguard Workerfilegroup {
724*89a63228SAndroid Build Coastguard Worker    name: "core-java-21-language-features-source",
725*89a63228SAndroid Build Coastguard Worker    srcs: ["luni/src/main/java/libcore/internal/Java21LanguageFeatures.java"],
726*89a63228SAndroid Build Coastguard Worker    visibility: ["//libcore/luni/src/test/java21language"],
727*89a63228SAndroid Build Coastguard Worker}
728*89a63228SAndroid Build Coastguard Worker
729*89a63228SAndroid Build Coastguard Workergenrule {
730*89a63228SAndroid Build Coastguard Worker    name: "core-tests-smali-dex",
731*89a63228SAndroid Build Coastguard Worker    srcs: ["luni/src/test/java/**/*.smali"],
732*89a63228SAndroid Build Coastguard Worker    cmd: "$(location android-smali) ass --api 28 -o $(out) $(in)",
733*89a63228SAndroid Build Coastguard Worker    out: ["core-tests-smali.dex"],
734*89a63228SAndroid Build Coastguard Worker    tools: ["android-smali"],
735*89a63228SAndroid Build Coastguard Worker}
736*89a63228SAndroid Build Coastguard Worker
737*89a63228SAndroid Build Coastguard Workerfilegroup {
738*89a63228SAndroid Build Coastguard Worker    name: "core-ojtests-javax-resources",
739*89a63228SAndroid Build Coastguard Worker    // Set path to keep the resources and .class files in the same directory in the jar file.
740*89a63228SAndroid Build Coastguard Worker    path: "ojluni/src",
741*89a63228SAndroid Build Coastguard Worker    srcs: ["ojluni/src/test/javax/**/*"],
742*89a63228SAndroid Build Coastguard Worker    exclude_srcs: ["ojluni/src/test/javax/**/*.java"],
743*89a63228SAndroid Build Coastguard Worker}
744*89a63228SAndroid Build Coastguard Worker
745*89a63228SAndroid Build Coastguard Workerfilegroup {
746*89a63228SAndroid Build Coastguard Worker    name: "core-ojtests-java-resources",
747*89a63228SAndroid Build Coastguard Worker    // Set path to keep the resources and .class files in the same directory in the jar file.
748*89a63228SAndroid Build Coastguard Worker    path: "ojluni/src",
749*89a63228SAndroid Build Coastguard Worker    srcs: [
750*89a63228SAndroid Build Coastguard Worker        "ojluni/src/test/java/util/regex/**/*",
751*89a63228SAndroid Build Coastguard Worker        "ojluni/src/test/java/util/Base64/**/*",
752*89a63228SAndroid Build Coastguard Worker        "ojluni/src/test/java/util/Scanner/**/*",
753*89a63228SAndroid Build Coastguard Worker        "ojluni/src/test/java/util/Properties/**/*",
754*89a63228SAndroid Build Coastguard Worker    ],
755*89a63228SAndroid Build Coastguard Worker    exclude_srcs: ["ojluni/src/test/java/**/*.java"],
756*89a63228SAndroid Build Coastguard Worker}
757*89a63228SAndroid Build Coastguard Worker
758*89a63228SAndroid Build Coastguard Worker// Builds the core-tests library.
759*89a63228SAndroid Build Coastguard Workerjava_test {
760*89a63228SAndroid Build Coastguard Worker    name: "core-tests",
761*89a63228SAndroid Build Coastguard Worker    visibility: [
762*89a63228SAndroid Build Coastguard Worker        "//art/build/sdk",
763*89a63228SAndroid Build Coastguard Worker        "//cts/tests/libcore/luni",
764*89a63228SAndroid Build Coastguard Worker    ],
765*89a63228SAndroid Build Coastguard Worker    defaults: ["libcore_java_defaults"],
766*89a63228SAndroid Build Coastguard Worker    hostdex: true,
767*89a63228SAndroid Build Coastguard Worker    srcs: [
768*89a63228SAndroid Build Coastguard Worker        "dalvik/src/test/java/**/*.java",
769*89a63228SAndroid Build Coastguard Worker        "dalvik/test-rules/src/test/java/**/*.java",
770*89a63228SAndroid Build Coastguard Worker        "dom/src/test/java/**/*.java",
771*89a63228SAndroid Build Coastguard Worker        "harmony-tests/src/test/java/**/*.java",
772*89a63228SAndroid Build Coastguard Worker        "json/src/test/java/**/*.java",
773*89a63228SAndroid Build Coastguard Worker        "luni/src/test/java/**/*.java",
774*89a63228SAndroid Build Coastguard Worker        "test-rules/src/test/java/**/*.java",
775*89a63228SAndroid Build Coastguard Worker        "xml/src/test/java/**/*.java",
776*89a63228SAndroid Build Coastguard Worker    ],
777*89a63228SAndroid Build Coastguard Worker    exclude_srcs: [
778*89a63228SAndroid Build Coastguard Worker        "harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/*.java",
779*89a63228SAndroid Build Coastguard Worker        "luni/src/test/java/libcore/java/util/zip/Zip64Test.java",
780*89a63228SAndroid Build Coastguard Worker        "luni/src/test/java/libcore/java/util/zip/Zip64FileTest.java",
781*89a63228SAndroid Build Coastguard Worker        "luni/src/test/java/libcore/javax/crypto/**/*.java",
782*89a63228SAndroid Build Coastguard Worker        "luni/src/test/java/libcore/javax/net/ssl/**/*.java",
783*89a63228SAndroid Build Coastguard Worker        "luni/src/test/java/org/apache/harmony/crypto/**/*.java",
784*89a63228SAndroid Build Coastguard Worker    ],
785*89a63228SAndroid Build Coastguard Worker
786*89a63228SAndroid Build Coastguard Worker    java_resource_dirs: [
787*89a63228SAndroid Build Coastguard Worker        "*/src/test/java",
788*89a63228SAndroid Build Coastguard Worker        "*/src/test/resources",
789*89a63228SAndroid Build Coastguard Worker    ],
790*89a63228SAndroid Build Coastguard Worker    exclude_java_resource_dirs: [
791*89a63228SAndroid Build Coastguard Worker        "ojluni/src/test/java",
792*89a63228SAndroid Build Coastguard Worker        "ojluni/src/test/javax",
793*89a63228SAndroid Build Coastguard Worker        "ojluni/src/test/resources",
794*89a63228SAndroid Build Coastguard Worker    ],
795*89a63228SAndroid Build Coastguard Worker
796*89a63228SAndroid Build Coastguard Worker    java_resources: [
797*89a63228SAndroid Build Coastguard Worker        ":annotations-test",
798*89a63228SAndroid Build Coastguard Worker        ":filesystemstest",
799*89a63228SAndroid Build Coastguard Worker        ":parameter-metadata-test",
800*89a63228SAndroid Build Coastguard Worker        ":core-tests-smali-dex",
801*89a63228SAndroid Build Coastguard Worker    ],
802*89a63228SAndroid Build Coastguard Worker
803*89a63228SAndroid Build Coastguard Worker    sdk_version: "none",
804*89a63228SAndroid Build Coastguard Worker    system_modules: "core-all-system-modules",
805*89a63228SAndroid Build Coastguard Worker    libs: [
806*89a63228SAndroid Build Coastguard Worker        "okhttp",
807*89a63228SAndroid Build Coastguard Worker        "bouncycastle",
808*89a63228SAndroid Build Coastguard Worker    ],
809*89a63228SAndroid Build Coastguard Worker
810*89a63228SAndroid Build Coastguard Worker    static_libs: [
811*89a63228SAndroid Build Coastguard Worker        "apache-xml-tests",
812*89a63228SAndroid Build Coastguard Worker        "core-compat-test-rules",
813*89a63228SAndroid Build Coastguard Worker        "core-java-9-compatibility-tests",
814*89a63228SAndroid Build Coastguard Worker        "core-java-9-language-tests",
815*89a63228SAndroid Build Coastguard Worker        "core-java-11-language-tests",
816*89a63228SAndroid Build Coastguard Worker        "core-java-17-language-tests",
817*89a63228SAndroid Build Coastguard Worker        "core-java-21-language-tests",
818*89a63228SAndroid Build Coastguard Worker        "core-test-rules",
819*89a63228SAndroid Build Coastguard Worker        "core-tests-support",
820*89a63228SAndroid Build Coastguard Worker        "junit-params",
821*89a63228SAndroid Build Coastguard Worker        "libcore-crypto-tests",
822*89a63228SAndroid Build Coastguard Worker        "mockftpserver",
823*89a63228SAndroid Build Coastguard Worker        "mockito-target",
824*89a63228SAndroid Build Coastguard Worker        "mockwebserver",
825*89a63228SAndroid Build Coastguard Worker        "nist-pkix-tests",
826*89a63228SAndroid Build Coastguard Worker        "slf4j-jdk14",
827*89a63228SAndroid Build Coastguard Worker        "sqlite-jdbc",
828*89a63228SAndroid Build Coastguard Worker    ],
829*89a63228SAndroid Build Coastguard Worker
830*89a63228SAndroid Build Coastguard Worker    errorprone: {
831*89a63228SAndroid Build Coastguard Worker        javacflags: [
832*89a63228SAndroid Build Coastguard Worker            "-Xep:TryFailThrowable:ERROR",
833*89a63228SAndroid Build Coastguard Worker            "-Xep:ComparisonOutOfRange:ERROR",
834*89a63228SAndroid Build Coastguard Worker            "-Xep:DoNotCall:OFF",
835*89a63228SAndroid Build Coastguard Worker            "-Xep:ArrayToString:WARN",
836*89a63228SAndroid Build Coastguard Worker            "-Xep:SelfEquals:WARN",
837*89a63228SAndroid Build Coastguard Worker            "-Xep:SelfComparison:WARN",
838*89a63228SAndroid Build Coastguard Worker            "-Xep:ReturnValueIgnored:WARN",
839*89a63228SAndroid Build Coastguard Worker            "-Xep:BoxedPrimitiveEquality:WARN",
840*89a63228SAndroid Build Coastguard Worker            "-Xep:SizeGreaterThanOrEqualsZero:WARN",
841*89a63228SAndroid Build Coastguard Worker            "-Xep:MisusedDayOfYear:WARN",
842*89a63228SAndroid Build Coastguard Worker            "-Xep:InvalidTimeZoneID:WARN",
843*89a63228SAndroid Build Coastguard Worker            "-Xep:CollectionToArraySafeParameter:WARN",
844*89a63228SAndroid Build Coastguard Worker            "-Xep:ModifyingCollectionWithItself:WARN",
845*89a63228SAndroid Build Coastguard Worker            "-Xep:ComparableType:WARN",
846*89a63228SAndroid Build Coastguard Worker            "-Xep:UnusedCollectionModifiedInPlace:WARN",
847*89a63228SAndroid Build Coastguard Worker            "-Xep:HashtableContains:WARN",
848*89a63228SAndroid Build Coastguard Worker            "-Xep:DoubleBraceInitialization:WARN",
849*89a63228SAndroid Build Coastguard Worker            "-Xep:RandomModInteger:WARN",
850*89a63228SAndroid Build Coastguard Worker            "-Xep:IdentityBinaryExpression:WARN",
851*89a63228SAndroid Build Coastguard Worker            "-Xep:UnnecessaryStringBuilder:OFF", // https://github.com/google/error-prone/issues/4195
852*89a63228SAndroid Build Coastguard Worker            // Some of the invalid regexes in the tests cause java to throw
853*89a63228SAndroid Build Coastguard Worker            // an exception that contains a null byte. The null byte is then
854*89a63228SAndroid Build Coastguard Worker            // printed by errorprone to the build log, causing some tools to
855*89a63228SAndroid Build Coastguard Worker            // think the build log is a binary file. Disable instead of demoting
856*89a63228SAndroid Build Coastguard Worker            // to a warning.
857*89a63228SAndroid Build Coastguard Worker            "-Xep:InvalidPatternSyntax:OFF",
858*89a63228SAndroid Build Coastguard Worker        ],
859*89a63228SAndroid Build Coastguard Worker    },
860*89a63228SAndroid Build Coastguard Worker
861*89a63228SAndroid Build Coastguard Worker    test_config: "AndroidTest-core-tests.xml",
862*89a63228SAndroid Build Coastguard Worker}
863*89a63228SAndroid Build Coastguard Worker
864*89a63228SAndroid Build Coastguard Workerjava_test {
865*89a63228SAndroid Build Coastguard Worker    name: "libcore-crypto-tests",
866*89a63228SAndroid Build Coastguard Worker
867*89a63228SAndroid Build Coastguard Worker    visibility: [
868*89a63228SAndroid Build Coastguard Worker        "//art/build/sdk",
869*89a63228SAndroid Build Coastguard Worker        "//external/conscrypt/apex/tests",
870*89a63228SAndroid Build Coastguard Worker    ],
871*89a63228SAndroid Build Coastguard Worker    exclude_srcs: [
872*89a63228SAndroid Build Coastguard Worker        "luni/src/test/java/libcore/javax/crypto/CipherTest.java",
873*89a63228SAndroid Build Coastguard Worker    ],
874*89a63228SAndroid Build Coastguard Worker    srcs: [
875*89a63228SAndroid Build Coastguard Worker        "harmony-tests/src/test/java/org/apache/harmony/tests/javax/net/ssl/*.java",
876*89a63228SAndroid Build Coastguard Worker        "luni/src/test/java/libcore/javax/crypto/**/*.java",
877*89a63228SAndroid Build Coastguard Worker        "luni/src/test/java/libcore/javax/net/ssl/**/*.java",
878*89a63228SAndroid Build Coastguard Worker        "luni/src/test/java/libcore/libcore/util/SerializationTester.java",
879*89a63228SAndroid Build Coastguard Worker        "luni/src/test/java/libcore/sun/security/**/*.java",
880*89a63228SAndroid Build Coastguard Worker        "luni/src/test/java/org/apache/harmony/crypto/**/*.java",
881*89a63228SAndroid Build Coastguard Worker    ],
882*89a63228SAndroid Build Coastguard Worker
883*89a63228SAndroid Build Coastguard Worker    java_resource_dirs: [
884*89a63228SAndroid Build Coastguard Worker        "luni/src/test/java",
885*89a63228SAndroid Build Coastguard Worker        "luni/src/test/resources",
886*89a63228SAndroid Build Coastguard Worker        "support/src/test/java",
887*89a63228SAndroid Build Coastguard Worker    ],
888*89a63228SAndroid Build Coastguard Worker
889*89a63228SAndroid Build Coastguard Worker    sdk_version: "none",
890*89a63228SAndroid Build Coastguard Worker    system_modules: "core-all-system-modules",
891*89a63228SAndroid Build Coastguard Worker
892*89a63228SAndroid Build Coastguard Worker    static_libs: [
893*89a63228SAndroid Build Coastguard Worker        "core-test-rules",
894*89a63228SAndroid Build Coastguard Worker        "core-tests-support",
895*89a63228SAndroid Build Coastguard Worker        "junit-params",
896*89a63228SAndroid Build Coastguard Worker        "mockito-target",
897*89a63228SAndroid Build Coastguard Worker    ],
898*89a63228SAndroid Build Coastguard Worker
899*89a63228SAndroid Build Coastguard Worker    errorprone: {
900*89a63228SAndroid Build Coastguard Worker        javacflags: [
901*89a63228SAndroid Build Coastguard Worker            "-Xep:ArrayToString:WARN",
902*89a63228SAndroid Build Coastguard Worker            "-Xep:ReturnValueIgnored:WARN",
903*89a63228SAndroid Build Coastguard Worker        ],
904*89a63228SAndroid Build Coastguard Worker    },
905*89a63228SAndroid Build Coastguard Worker}
906*89a63228SAndroid Build Coastguard Worker
907*89a63228SAndroid Build Coastguard Workerjava_genrule {
908*89a63228SAndroid Build Coastguard Worker    name: "libcore-non-cts-tests-txt",
909*89a63228SAndroid Build Coastguard Worker    srcs: [
910*89a63228SAndroid Build Coastguard Worker        ":apache-harmony-tests{.jar}",
911*89a63228SAndroid Build Coastguard Worker        ":conscrypt-tests{.jar}",
912*89a63228SAndroid Build Coastguard Worker        ":core-tests{.jar}",
913*89a63228SAndroid Build Coastguard Worker        ":core-ojtests{.jar}",
914*89a63228SAndroid Build Coastguard Worker    ],
915*89a63228SAndroid Build Coastguard Worker    tools: ["non-cts-json-generator"],
916*89a63228SAndroid Build Coastguard Worker    out: ["libcore-non-cts-tests.txt"],
917*89a63228SAndroid Build Coastguard Worker    cmd: "$(location non-cts-json-generator) $(in) > $(out)",
918*89a63228SAndroid Build Coastguard Worker}
919*89a63228SAndroid Build Coastguard Worker
920*89a63228SAndroid Build Coastguard Worker// Exports annotated stubs source files in ojluni/annotations/sdk to make them
921*89a63228SAndroid Build Coastguard Worker// available to metalava. Used for nullability annotations in OpenJDK source.
922*89a63228SAndroid Build Coastguard Workerdroiddoc_exported_dir {
923*89a63228SAndroid Build Coastguard Worker    name: "ojluni-annotated-sdk-stubs",
924*89a63228SAndroid Build Coastguard Worker    visibility: [
925*89a63228SAndroid Build Coastguard Worker        "//libcore:__subpackages__",
926*89a63228SAndroid Build Coastguard Worker    ],
927*89a63228SAndroid Build Coastguard Worker    path: "ojluni/annotations/sdk",
928*89a63228SAndroid Build Coastguard Worker}
929*89a63228SAndroid Build Coastguard Worker
930*89a63228SAndroid Build Coastguard Workerdroiddoc_exported_dir {
931*89a63228SAndroid Build Coastguard Worker    name: "ojluni-annotated-nullability-stubs",
932*89a63228SAndroid Build Coastguard Worker    path: "ojluni/annotations/sdk/nullability",
933*89a63228SAndroid Build Coastguard Worker}
934*89a63228SAndroid Build Coastguard Worker
935*89a63228SAndroid Build Coastguard Worker// Exports annotated stubs source files in ojluni/annotations/mmodules to make
936*89a63228SAndroid Build Coastguard Worker// them available to metalava. Used for core platform API and intra-core API
937*89a63228SAndroid Build Coastguard Worker// annotations in OpenJDK source.
938*89a63228SAndroid Build Coastguard Workerdroiddoc_exported_dir {
939*89a63228SAndroid Build Coastguard Worker    name: "ojluni-annotated-mmodule-stubs",
940*89a63228SAndroid Build Coastguard Worker    visibility: [
941*89a63228SAndroid Build Coastguard Worker        "//libcore/mmodules/intracoreapi",
942*89a63228SAndroid Build Coastguard Worker    ],
943*89a63228SAndroid Build Coastguard Worker    path: "ojluni/annotations/mmodule",
944*89a63228SAndroid Build Coastguard Worker}
945*89a63228SAndroid Build Coastguard Worker
946*89a63228SAndroid Build Coastguard Workerdroiddoc_exported_dir {
947*89a63228SAndroid Build Coastguard Worker    name: "ojluni-annotated-flagged-stubs",
948*89a63228SAndroid Build Coastguard Worker    path: "ojluni/annotations/flagged_api",
949*89a63228SAndroid Build Coastguard Worker    visibility: ["//visibility:private"],
950*89a63228SAndroid Build Coastguard Worker}
951*89a63228SAndroid Build Coastguard Worker
952*89a63228SAndroid Build Coastguard Workerdroiddoc_exported_dir {
953*89a63228SAndroid Build Coastguard Worker    name: "toolchainapi-annotated-flagged-stubs",
954*89a63228SAndroid Build Coastguard Worker    path: "ojluni/annotations/flagged_toolchainapi",
955*89a63228SAndroid Build Coastguard Worker    visibility: ["//libcore/toolchainapi"],
956*89a63228SAndroid Build Coastguard Worker}
957*89a63228SAndroid Build Coastguard Worker
958*89a63228SAndroid Build Coastguard Worker// A file containing the list of tags that are "known" to us from the OpenJdk
959*89a63228SAndroid Build Coastguard Worker// source code and so should not cause an error or warning.
960*89a63228SAndroid Build Coastguard Workerfilegroup {
961*89a63228SAndroid Build Coastguard Worker    name: "known-oj-tags",
962*89a63228SAndroid Build Coastguard Worker    visibility: [
963*89a63228SAndroid Build Coastguard Worker        "//frameworks/base",
964*89a63228SAndroid Build Coastguard Worker        "//frameworks/base/api",
965*89a63228SAndroid Build Coastguard Worker    ],
966*89a63228SAndroid Build Coastguard Worker    srcs: [
967*89a63228SAndroid Build Coastguard Worker        "known_oj_tags.txt",
968*89a63228SAndroid Build Coastguard Worker    ],
969*89a63228SAndroid Build Coastguard Worker}
970*89a63228SAndroid Build Coastguard Worker
971*89a63228SAndroid Build Coastguard Worker// A special set of stubs containing the minimal set of self consistent
972*89a63228SAndroid Build Coastguard Worker// classes for which a system module can be created. Every system module must
973*89a63228SAndroid Build Coastguard Worker// contain the java.lang classes so the set was constructed by starting with
974*89a63228SAndroid Build Coastguard Worker// the java.lang classes and then adding their transitive dependencies without
975*89a63228SAndroid Build Coastguard Worker// splitting packages. So, if one class from a package is used then all classes
976*89a63228SAndroid Build Coastguard Worker// in that package were added to the set.
977*89a63228SAndroid Build Coastguard Worker//
978*89a63228SAndroid Build Coastguard Worker// Needed for java-current-stubs-system-modules.
979*89a63228SAndroid Build Coastguard Workerdroidstubs {
980*89a63228SAndroid Build Coastguard Worker    name: "java-current-stubs-source",
981*89a63228SAndroid Build Coastguard Worker    srcs: [
982*89a63228SAndroid Build Coastguard Worker        ":core_oj_api_files",
983*89a63228SAndroid Build Coastguard Worker        ":core_libart_api_files",
984*89a63228SAndroid Build Coastguard Worker    ],
985*89a63228SAndroid Build Coastguard Worker    installable: false,
986*89a63228SAndroid Build Coastguard Worker    sdk_version: "none",
987*89a63228SAndroid Build Coastguard Worker    system_modules: "none",
988*89a63228SAndroid Build Coastguard Worker
989*89a63228SAndroid Build Coastguard Worker    args: "--stub-packages java.*:javax.*:org.w3c.dom.*:org.xml.sax.*",
990*89a63228SAndroid Build Coastguard Worker}
991*89a63228SAndroid Build Coastguard Worker
992*89a63228SAndroid Build Coastguard Worker// Generates stub files for the classes exposed in the public API, without
993*89a63228SAndroid Build Coastguard Worker// javadoc. This can be used as a starting point for adding a new file to
994*89a63228SAndroid Build Coastguard Worker// libcore/luni/annotations/flagged_api.
995*89a63228SAndroid Build Coastguard Workerdroidstubs {
996*89a63228SAndroid Build Coastguard Worker    name: "libart-sdk-stubs-no-javadoc",
997*89a63228SAndroid Build Coastguard Worker    srcs: [
998*89a63228SAndroid Build Coastguard Worker        ":core_libart_api_files",
999*89a63228SAndroid Build Coastguard Worker        // The definition of @SystemApi is needed to generate module-lib stubs.
1000*89a63228SAndroid Build Coastguard Worker        ":framework-api-annotations",
1001*89a63228SAndroid Build Coastguard Worker    ],
1002*89a63228SAndroid Build Coastguard Worker    installable: false,
1003*89a63228SAndroid Build Coastguard Worker    sdk_version: "none",
1004*89a63228SAndroid Build Coastguard Worker    system_modules: "none",
1005*89a63228SAndroid Build Coastguard Worker    api_levels_sdk_type: "module-lib",
1006*89a63228SAndroid Build Coastguard Worker    flags: [
1007*89a63228SAndroid Build Coastguard Worker        "--exclude-documentation-from-stubs",
1008*89a63228SAndroid Build Coastguard Worker        "--show-for-stub-purposes-annotation android.annotation.SystemApi\\(client=android.annotation.SystemApi.Client.MODULE_LIBRARIES\\)",
1009*89a63228SAndroid Build Coastguard Worker    ],
1010*89a63228SAndroid Build Coastguard Worker}
1011*89a63228SAndroid Build Coastguard Worker
1012*89a63228SAndroid Build Coastguard Worker// Separate @FlaggedApi annotations for luni/ to avoid a circular dependency between
1013*89a63228SAndroid Build Coastguard Worker// libcore_aconfig_flags_lib and core-all
1014*89a63228SAndroid Build Coastguard Workerdroiddoc_exported_dir {
1015*89a63228SAndroid Build Coastguard Worker    name: "luni-annotated-flagged-stubs",
1016*89a63228SAndroid Build Coastguard Worker    path: "luni/annotations/flagged_api",
1017*89a63228SAndroid Build Coastguard Worker    visibility: ["//visibility:private"],
1018*89a63228SAndroid Build Coastguard Worker}
1019*89a63228SAndroid Build Coastguard Worker
1020*89a63228SAndroid Build Coastguard Workerjava_library {
1021*89a63228SAndroid Build Coastguard Worker    name: "java.current.stubs",
1022*89a63228SAndroid Build Coastguard Worker    srcs: [":java-current-stubs-source"],
1023*89a63228SAndroid Build Coastguard Worker    errorprone: {
1024*89a63228SAndroid Build Coastguard Worker        javacflags: [
1025*89a63228SAndroid Build Coastguard Worker            "-Xep:MissingOverride:OFF",
1026*89a63228SAndroid Build Coastguard Worker        ],
1027*89a63228SAndroid Build Coastguard Worker    },
1028*89a63228SAndroid Build Coastguard Worker    patch_module: "java.base",
1029*89a63228SAndroid Build Coastguard Worker    sdk_version: "none",
1030*89a63228SAndroid Build Coastguard Worker    system_modules: "none",
1031*89a63228SAndroid Build Coastguard Worker}
1032*89a63228SAndroid Build Coastguard Worker
1033*89a63228SAndroid Build Coastguard Worker// A special set of system modules needed to build art.module.public.api
1034*89a63228SAndroid Build Coastguard Workerjava_system_modules {
1035*89a63228SAndroid Build Coastguard Worker    name: "java-current-stubs-system-modules",
1036*89a63228SAndroid Build Coastguard Worker    libs: [
1037*89a63228SAndroid Build Coastguard Worker        // Minimal set of classes required for a system module.
1038*89a63228SAndroid Build Coastguard Worker        "java.current.stubs",
1039*89a63228SAndroid Build Coastguard Worker    ],
1040*89a63228SAndroid Build Coastguard Worker}
1041*89a63228SAndroid Build Coastguard Worker
1042*89a63228SAndroid Build Coastguard Workerjava_library {
1043*89a63228SAndroid Build Coastguard Worker    name: "framework-api-annotations-lib",
1044*89a63228SAndroid Build Coastguard Worker    srcs: [":framework-api-annotations"],
1045*89a63228SAndroid Build Coastguard Worker    static_libs: ["aconfig-annotations-lib-sdk-none"],
1046*89a63228SAndroid Build Coastguard Worker    sdk_version: "none",
1047*89a63228SAndroid Build Coastguard Worker    patch_module: "java.base",
1048*89a63228SAndroid Build Coastguard Worker    system_modules: "core-all-system-modules",
1049*89a63228SAndroid Build Coastguard Worker    installable: false,
1050*89a63228SAndroid Build Coastguard Worker    visibility: [
1051*89a63228SAndroid Build Coastguard Worker        "//art/build/flags",
1052*89a63228SAndroid Build Coastguard Worker        "//libcore:__subpackages__",
1053*89a63228SAndroid Build Coastguard Worker    ],
1054*89a63228SAndroid Build Coastguard Worker}
1055*89a63228SAndroid Build Coastguard Worker
1056*89a63228SAndroid Build Coastguard Workeraconfig_declarations {
1057*89a63228SAndroid Build Coastguard Worker    name: "libcore-aconfig-flags",
1058*89a63228SAndroid Build Coastguard Worker    package: "com.android.libcore",
1059*89a63228SAndroid Build Coastguard Worker    container: "com.android.art",
1060*89a63228SAndroid Build Coastguard Worker    exportable: true,
1061*89a63228SAndroid Build Coastguard Worker    srcs: ["libcore.aconfig"],
1062*89a63228SAndroid Build Coastguard Worker    visibility: [
1063*89a63228SAndroid Build Coastguard Worker        "//libcore:__subpackages__",
1064*89a63228SAndroid Build Coastguard Worker        "//frameworks/base",
1065*89a63228SAndroid Build Coastguard Worker    ],
1066*89a63228SAndroid Build Coastguard Worker}
1067*89a63228SAndroid Build Coastguard Worker
1068*89a63228SAndroid Build Coastguard Workerjava_system_modules {
1069*89a63228SAndroid Build Coastguard Worker    name: "libcore-bootstrap-core-current-from-text-system-modules",
1070*89a63228SAndroid Build Coastguard Worker    libs: ["core.current.stubs.from-text"],
1071*89a63228SAndroid Build Coastguard Worker    visibility: ["//visibility:private"],
1072*89a63228SAndroid Build Coastguard Worker}
1073*89a63228SAndroid Build Coastguard Worker
1074*89a63228SAndroid Build Coastguard Workerjava_library {
1075*89a63228SAndroid Build Coastguard Worker    name: "libcore-bootstrap-lib-for-flags-lib",
1076*89a63228SAndroid Build Coastguard Worker    srcs: [
1077*89a63228SAndroid Build Coastguard Worker        // Needs @UnsupportedAppUsage definition from this source
1078*89a63228SAndroid Build Coastguard Worker        ":app-compat-annotations-source",
1079*89a63228SAndroid Build Coastguard Worker        // Needs @AssumeFalseForR8 and AconfigFlagAccessor from this source
1080*89a63228SAndroid Build Coastguard Worker        ":framework-api-annotations",
1081*89a63228SAndroid Build Coastguard Worker        // Needs LambdaMetafactory due to lambda usage in the lib
1082*89a63228SAndroid Build Coastguard Worker        ":openjdk_lambda_stub_files",
1083*89a63228SAndroid Build Coastguard Worker    ],
1084*89a63228SAndroid Build Coastguard Worker    sdk_version: "none",
1085*89a63228SAndroid Build Coastguard Worker    patch_module: "java.base",
1086*89a63228SAndroid Build Coastguard Worker    system_modules: "libcore-bootstrap-core-current-from-text-system-modules",
1087*89a63228SAndroid Build Coastguard Worker    installable: false,
1088*89a63228SAndroid Build Coastguard Worker    visibility: [
1089*89a63228SAndroid Build Coastguard Worker        "//visibility:private",
1090*89a63228SAndroid Build Coastguard Worker    ],
1091*89a63228SAndroid Build Coastguard Worker}
1092*89a63228SAndroid Build Coastguard Worker
1093*89a63228SAndroid Build Coastguard Worker// We need this system module because openjdk_lambda_stub_files and core.current.stubs.from-text
1094*89a63228SAndroid Build Coastguard Worker// need to be in the same module. Otherwise, javac isn't happy to use the LambdaMetaFactory if
1095*89a63228SAndroid Build Coastguard Worker// it's not in the system module.
1096*89a63228SAndroid Build Coastguard Workerjava_system_modules {
1097*89a63228SAndroid Build Coastguard Worker    name: "libcore-bootstrap-lib-for-flags-lib-system-modules",
1098*89a63228SAndroid Build Coastguard Worker    libs: [
1099*89a63228SAndroid Build Coastguard Worker        "core.current.stubs.from-text",
1100*89a63228SAndroid Build Coastguard Worker        "libcore-bootstrap-lib-for-flags-lib",
1101*89a63228SAndroid Build Coastguard Worker    ],
1102*89a63228SAndroid Build Coastguard Worker    visibility: ["//visibility:private"],
1103*89a63228SAndroid Build Coastguard Worker}
1104*89a63228SAndroid Build Coastguard Worker
1105*89a63228SAndroid Build Coastguard Workerjava_aconfig_library {
1106*89a63228SAndroid Build Coastguard Worker    name: "libcore-aconfig-flags-lib-for-core-all-only",
1107*89a63228SAndroid Build Coastguard Worker    aconfig_declarations: "libcore-aconfig-flags",
1108*89a63228SAndroid Build Coastguard Worker    // This system module is specifically crafted to avoid a circular dependency on core-all.
1109*89a63228SAndroid Build Coastguard Worker    // Instead of dependency on core-all, this system module contains the stubs generated from
1110*89a63228SAndroid Build Coastguard Worker    // API files, e.g. libcore/api/current.txt. See "core.current.stubs.from-text" for more details.
1111*89a63228SAndroid Build Coastguard Worker    // An alternative is to generate the .java source files of this lib without running javac,
1112*89a63228SAndroid Build Coastguard Worker    // but it wasn't possible using java_aconfig_library when this comment is written.
1113*89a63228SAndroid Build Coastguard Worker    system_modules: "libcore-bootstrap-lib-for-flags-lib-system-modules",
1114*89a63228SAndroid Build Coastguard Worker    sdk_version: "none",
1115*89a63228SAndroid Build Coastguard Worker    patch_module: "java.base",
1116*89a63228SAndroid Build Coastguard Worker    installable: false,
1117*89a63228SAndroid Build Coastguard Worker    visibility: ["//visibility:private"],
1118*89a63228SAndroid Build Coastguard Worker}
1119*89a63228SAndroid Build Coastguard Worker
1120*89a63228SAndroid Build Coastguard Workerjava_aconfig_library {
1121*89a63228SAndroid Build Coastguard Worker    name: "art-aconfig-flags-java-lib-for-core-all-only",
1122*89a63228SAndroid Build Coastguard Worker    aconfig_declarations: "art-aconfig-flags",
1123*89a63228SAndroid Build Coastguard Worker    system_modules: "libcore-bootstrap-lib-for-flags-lib-system-modules",
1124*89a63228SAndroid Build Coastguard Worker    sdk_version: "none",
1125*89a63228SAndroid Build Coastguard Worker    patch_module: "java.base",
1126*89a63228SAndroid Build Coastguard Worker    installable: false,
1127*89a63228SAndroid Build Coastguard Worker    visibility: ["//visibility:private"],
1128*89a63228SAndroid Build Coastguard Worker}
1129*89a63228SAndroid Build Coastguard Worker
1130*89a63228SAndroid Build Coastguard Workerjava_aconfig_library {
1131*89a63228SAndroid Build Coastguard Worker    name: "libcore-aconfig-flags-lib",
1132*89a63228SAndroid Build Coastguard Worker    aconfig_declarations: "libcore-aconfig-flags",
1133*89a63228SAndroid Build Coastguard Worker    sdk_version: "none",
1134*89a63228SAndroid Build Coastguard Worker    patch_module: "java.base",
1135*89a63228SAndroid Build Coastguard Worker    system_modules: "core-all-system-modules",
1136*89a63228SAndroid Build Coastguard Worker    libs: ["framework-api-annotations-lib"],
1137*89a63228SAndroid Build Coastguard Worker    min_sdk_version: "31", // ART module is enabled on Android 12 or above.
1138*89a63228SAndroid Build Coastguard Worker    apex_available: [
1139*89a63228SAndroid Build Coastguard Worker        "com.android.art",
1140*89a63228SAndroid Build Coastguard Worker        "com.android.art.debug",
1141*89a63228SAndroid Build Coastguard Worker    ],
1142*89a63228SAndroid Build Coastguard Worker    visibility: [
1143*89a63228SAndroid Build Coastguard Worker        "//libcore:__subpackages__",
1144*89a63228SAndroid Build Coastguard Worker    ],
1145*89a63228SAndroid Build Coastguard Worker}
1146*89a63228SAndroid Build Coastguard Worker
1147*89a63228SAndroid Build Coastguard Worker// Define the public SDK API provided by the ART module.
1148*89a63228SAndroid Build Coastguard Workerjava_sdk_library {
1149*89a63228SAndroid Build Coastguard Worker    name: "art.module.public.api",
1150*89a63228SAndroid Build Coastguard Worker    visibility: [
1151*89a63228SAndroid Build Coastguard Worker        "//art/build/sdk",
1152*89a63228SAndroid Build Coastguard Worker        "//build/soong/java/core-libraries",
1153*89a63228SAndroid Build Coastguard Worker        "//frameworks/base",
1154*89a63228SAndroid Build Coastguard Worker        "//frameworks/base/api",
1155*89a63228SAndroid Build Coastguard Worker
1156*89a63228SAndroid Build Coastguard Worker        // DO NOT REMOVE: Legacy visibility, needed for snapshots that are
1157*89a63228SAndroid Build Coastguard Worker        // generated for the S build.
1158*89a63228SAndroid Build Coastguard Worker        "//libcore/mmodules/core_platform_api",
1159*89a63228SAndroid Build Coastguard Worker    ],
1160*89a63228SAndroid Build Coastguard Worker    srcs: [
1161*89a63228SAndroid Build Coastguard Worker        ":core_oj_api_files",
1162*89a63228SAndroid Build Coastguard Worker        ":core_libart_api_files",
1163*89a63228SAndroid Build Coastguard Worker
1164*89a63228SAndroid Build Coastguard Worker        // Some source files in :core_oj_api_files and :openjdk_mmodule_extra_files are
1165*89a63228SAndroid Build Coastguard Worker        // annotated by applying annotations to the .annotated.java stubs files in
1166*89a63228SAndroid Build Coastguard Worker        // ojluni/annotated/mmodules and rather than in the original source. See the comments
1167*89a63228SAndroid Build Coastguard Worker        // in openjdk_java_files.bp for more details.
1168*89a63228SAndroid Build Coastguard Worker        ":openjdk_mmodule_extra_files",
1169*89a63228SAndroid Build Coastguard Worker        ":okhttp_api_files",
1170*89a63228SAndroid Build Coastguard Worker    ],
1171*89a63228SAndroid Build Coastguard Worker    api_srcs: [
1172*89a63228SAndroid Build Coastguard Worker        ":openjdk_javadoc_only_files",
1173*89a63228SAndroid Build Coastguard Worker    ],
1174*89a63228SAndroid Build Coastguard Worker    libs: [
1175*89a63228SAndroid Build Coastguard Worker        // Put framework-api-annotations into libs to avoid exposing the definition of framework's
1176*89a63228SAndroid Build Coastguard Worker        // annotations from libcore (wrong place) instead of framework (correct place).
1177*89a63228SAndroid Build Coastguard Worker        "framework-api-annotations-lib",
1178*89a63228SAndroid Build Coastguard Worker        // Provide access to I18N constants that are used to initialize
1179*89a63228SAndroid Build Coastguard Worker        // constants in the public API. i.e. to allow the value of the
1180*89a63228SAndroid Build Coastguard Worker        // java.text.CollectionElementIterator.NULLORDER to be initialized from
1181*89a63228SAndroid Build Coastguard Worker        // android.icu.text.CollationElementIterator.NULLORDER.
1182*89a63228SAndroid Build Coastguard Worker        "i18n.module.intra.core.api.stubs",
1183*89a63228SAndroid Build Coastguard Worker        "art-aconfig-flags-java-lib",
1184*89a63228SAndroid Build Coastguard Worker        "libcore-aconfig-flags-lib",
1185*89a63228SAndroid Build Coastguard Worker    ],
1186*89a63228SAndroid Build Coastguard Worker    stub_only_static_libs: ["notices-for-stubs-jar"],
1187*89a63228SAndroid Build Coastguard Worker
1188*89a63228SAndroid Build Coastguard Worker    // Make dex jars for the stubs available for use by hiddenapi processing.
1189*89a63228SAndroid Build Coastguard Worker    compile_dex: true,
1190*89a63228SAndroid Build Coastguard Worker
1191*89a63228SAndroid Build Coastguard Worker    public: {
1192*89a63228SAndroid Build Coastguard Worker        enabled: true,
1193*89a63228SAndroid Build Coastguard Worker    },
1194*89a63228SAndroid Build Coastguard Worker    system: {
1195*89a63228SAndroid Build Coastguard Worker        enabled: true,
1196*89a63228SAndroid Build Coastguard Worker    },
1197*89a63228SAndroid Build Coastguard Worker    module_lib: {
1198*89a63228SAndroid Build Coastguard Worker        enabled: true,
1199*89a63228SAndroid Build Coastguard Worker    },
1200*89a63228SAndroid Build Coastguard Worker
1201*89a63228SAndroid Build Coastguard Worker    api_only: true,
1202*89a63228SAndroid Build Coastguard Worker    droiddoc_options: [
1203*89a63228SAndroid Build Coastguard Worker        "--force-convert-to-warning-nullability-annotations +*:-android.*:+android.icu.*:-dalvik.* ",
1204*89a63228SAndroid Build Coastguard Worker        "--hide-annotation libcore.api.Hide",
1205*89a63228SAndroid Build Coastguard Worker    ],
1206*89a63228SAndroid Build Coastguard Worker
1207*89a63228SAndroid Build Coastguard Worker    merge_inclusion_annotations_dirs: [
1208*89a63228SAndroid Build Coastguard Worker        "luni-annotated-flagged-stubs",
1209*89a63228SAndroid Build Coastguard Worker        "ojluni-annotated-flagged-stubs",
1210*89a63228SAndroid Build Coastguard Worker        "ojluni-annotated-mmodule-stubs",
1211*89a63228SAndroid Build Coastguard Worker    ],
1212*89a63228SAndroid Build Coastguard Worker    // Emit nullability annotations from the source to the stub files.
1213*89a63228SAndroid Build Coastguard Worker    annotations_enabled: true,
1214*89a63228SAndroid Build Coastguard Worker
1215*89a63228SAndroid Build Coastguard Worker    merge_annotations_dirs: [
1216*89a63228SAndroid Build Coastguard Worker        "metalava-manual",
1217*89a63228SAndroid Build Coastguard Worker        "ojluni-annotated-sdk-stubs",
1218*89a63228SAndroid Build Coastguard Worker    ],
1219*89a63228SAndroid Build Coastguard Worker
1220*89a63228SAndroid Build Coastguard Worker    doctag_files: [
1221*89a63228SAndroid Build Coastguard Worker        ":known-oj-tags",
1222*89a63228SAndroid Build Coastguard Worker    ],
1223*89a63228SAndroid Build Coastguard Worker
1224*89a63228SAndroid Build Coastguard Worker    errorprone: {
1225*89a63228SAndroid Build Coastguard Worker        javacflags: [
1226*89a63228SAndroid Build Coastguard Worker            "-Xep:MissingOverride:OFF",
1227*89a63228SAndroid Build Coastguard Worker        ],
1228*89a63228SAndroid Build Coastguard Worker    },
1229*89a63228SAndroid Build Coastguard Worker    patch_module: "java.base",
1230*89a63228SAndroid Build Coastguard Worker    sdk_version: "none",
1231*89a63228SAndroid Build Coastguard Worker    system_modules: "java-current-stubs-system-modules",
1232*89a63228SAndroid Build Coastguard Worker    // The base name for the artifacts that are automatically published to the
1233*89a63228SAndroid Build Coastguard Worker    // dist and which end up in one of the sub-directories of prebuilts/sdk.
1234*89a63228SAndroid Build Coastguard Worker    // As long as this matches the name of the artifacts in prebuilts/sdk then
1235*89a63228SAndroid Build Coastguard Worker    // the API will be checked for compatibility against the latest released
1236*89a63228SAndroid Build Coastguard Worker    // version of the API.
1237*89a63228SAndroid Build Coastguard Worker    dist_stem: "art",
1238*89a63228SAndroid Build Coastguard Worker    dist_group: "android",
1239*89a63228SAndroid Build Coastguard Worker    aconfig_declarations: [
1240*89a63228SAndroid Build Coastguard Worker        "art-aconfig-flags",
1241*89a63228SAndroid Build Coastguard Worker        "libcore-aconfig-flags",
1242*89a63228SAndroid Build Coastguard Worker    ],
1243*89a63228SAndroid Build Coastguard Worker}
1244*89a63228SAndroid Build Coastguard Worker
1245*89a63228SAndroid Build Coastguard Worker// Target for validating nullability annotations for correctness and
1246*89a63228SAndroid Build Coastguard Worker// completeness. To check that there are no nullability errors:
1247*89a63228SAndroid Build Coastguard Worker//   m art-module-public-api-stubs-nullability-validation
1248*89a63228SAndroid Build Coastguard Worker// To check that there are only the expected nullability warnings:
1249*89a63228SAndroid Build Coastguard Worker//   m art-module-public-api-stubs-nullability-validation-check-nullability-warnings
1250*89a63228SAndroid Build Coastguard Worker// (If that check fails, it will provide instructions on how to proceed,
1251*89a63228SAndroid Build Coastguard Worker// including the command to run to update the expected warnings file.)
1252*89a63228SAndroid Build Coastguard Workerdroidstubs {
1253*89a63228SAndroid Build Coastguard Worker    name: "art-module-public-api-stubs-nullability-validation",
1254*89a63228SAndroid Build Coastguard Worker    srcs: [":art_module_api_files"],
1255*89a63228SAndroid Build Coastguard Worker    installable: false,
1256*89a63228SAndroid Build Coastguard Worker    sdk_version: "none",
1257*89a63228SAndroid Build Coastguard Worker    system_modules: "none",
1258*89a63228SAndroid Build Coastguard Worker    annotations_enabled: true,
1259*89a63228SAndroid Build Coastguard Worker    args: "--hide-annotation libcore.api.Hide " +
1260*89a63228SAndroid Build Coastguard Worker        "--validate-nullability-from-merged-stubs ",
1261*89a63228SAndroid Build Coastguard Worker    merge_inclusion_annotations_dirs: ["ojluni-annotated-mmodule-stubs"],
1262*89a63228SAndroid Build Coastguard Worker    merge_annotations_dirs: [
1263*89a63228SAndroid Build Coastguard Worker        // N.B. Stubs in this filegroup will be validated:
1264*89a63228SAndroid Build Coastguard Worker        "ojluni-annotated-nullability-stubs",
1265*89a63228SAndroid Build Coastguard Worker    ],
1266*89a63228SAndroid Build Coastguard Worker    // The list of classes which have nullability annotations included in the source.
1267*89a63228SAndroid Build Coastguard Worker    // (This is in addition to those which have annotations in the merged stubs.)
1268*89a63228SAndroid Build Coastguard Worker    validate_nullability_from_list: "nullability_annotated_classes.txt",
1269*89a63228SAndroid Build Coastguard Worker    // The expected set of warnings about missing annotations:
1270*89a63228SAndroid Build Coastguard Worker    check_nullability_warnings: "nullability_warnings.txt",
1271*89a63228SAndroid Build Coastguard Worker}
1272*89a63228SAndroid Build Coastguard Worker
1273*89a63228SAndroid Build Coastguard Worker// A special set of system modules for building the following library for use
1274*89a63228SAndroid Build Coastguard Worker// in the art-module-public-api-system-modules.
1275*89a63228SAndroid Build Coastguard Workerjava_system_modules {
1276*89a63228SAndroid Build Coastguard Worker    name: "api-annotations-system-modules",
1277*89a63228SAndroid Build Coastguard Worker    libs: [
1278*89a63228SAndroid Build Coastguard Worker        "art.module.public.api.stubs",
1279*89a63228SAndroid Build Coastguard Worker    ],
1280*89a63228SAndroid Build Coastguard Worker}
1281*89a63228SAndroid Build Coastguard Worker
1282*89a63228SAndroid Build Coastguard Worker// A library that contains annotations that define API surfaces (core
1283*89a63228SAndroid Build Coastguard Worker// platform, intra core and the hidden API) along with some supporting
1284*89a63228SAndroid Build Coastguard Worker// constants. The annotations are source only and do not introduce any runtime
1285*89a63228SAndroid Build Coastguard Worker// dependencies. Specially built for use in system modules definitions to
1286*89a63228SAndroid Build Coastguard Worker// avoid introducing compile time cycles.
1287*89a63228SAndroid Build Coastguard Workerjava_library {
1288*89a63228SAndroid Build Coastguard Worker    name: "art.module.api.annotations.for.system.modules",
1289*89a63228SAndroid Build Coastguard Worker    visibility: [
1290*89a63228SAndroid Build Coastguard Worker        "//build/soong/java/core-libraries",
1291*89a63228SAndroid Build Coastguard Worker    ],
1292*89a63228SAndroid Build Coastguard Worker    srcs: [
1293*89a63228SAndroid Build Coastguard Worker        ":api_surface_annotation_files",
1294*89a63228SAndroid Build Coastguard Worker    ],
1295*89a63228SAndroid Build Coastguard Worker
1296*89a63228SAndroid Build Coastguard Worker    installable: false,
1297*89a63228SAndroid Build Coastguard Worker    sdk_version: "none",
1298*89a63228SAndroid Build Coastguard Worker    system_modules: "api-annotations-system-modules",
1299*89a63228SAndroid Build Coastguard Worker    patch_module: "java.base",
1300*89a63228SAndroid Build Coastguard Worker    // This jar is packaged as part of the SDK, use -target 8 so that it works
1301*89a63228SAndroid Build Coastguard Worker    // with old JDKs.
1302*89a63228SAndroid Build Coastguard Worker    java_version: "1.8",
1303*89a63228SAndroid Build Coastguard Worker}
1304*89a63228SAndroid Build Coastguard Worker
1305*89a63228SAndroid Build Coastguard Worker// Create a library containing the api surface annotations, built against
1306*89a63228SAndroid Build Coastguard Worker// core_current for use by the annotation processor in frameworks/base.
1307*89a63228SAndroid Build Coastguard Workerjava_library {
1308*89a63228SAndroid Build Coastguard Worker    name: "art.module.api.annotations",
1309*89a63228SAndroid Build Coastguard Worker    visibility: [
1310*89a63228SAndroid Build Coastguard Worker        "//art/build/sdk",
1311*89a63228SAndroid Build Coastguard Worker        "//external/icu/android_icu4j",
1312*89a63228SAndroid Build Coastguard Worker        "//frameworks/base",
1313*89a63228SAndroid Build Coastguard Worker        "//frameworks/base/api",
1314*89a63228SAndroid Build Coastguard Worker    ],
1315*89a63228SAndroid Build Coastguard Worker    host_supported: true,
1316*89a63228SAndroid Build Coastguard Worker    srcs: [
1317*89a63228SAndroid Build Coastguard Worker        ":api_surface_annotation_files",
1318*89a63228SAndroid Build Coastguard Worker    ],
1319*89a63228SAndroid Build Coastguard Worker    sdk_version: "core_current",
1320*89a63228SAndroid Build Coastguard Worker    // Make sure that this will be added to the sdk snapshot for S.
1321*89a63228SAndroid Build Coastguard Worker    min_sdk_version: "S",
1322*89a63228SAndroid Build Coastguard Worker    // This jar is packaged as part of the ART module host exports, use -target 8 so that it works
1323*89a63228SAndroid Build Coastguard Worker    // with old JDKs.
1324*89a63228SAndroid Build Coastguard Worker    java_version: "1.8",
1325*89a63228SAndroid Build Coastguard Worker}
1326