blob: 401d0564f97cf2e3abe75669193834c5ab2878b4 [file] [log] [blame]
Colin Crossaf0b54c2017-09-27 17:22:32 -07001// Copyright (C) 2007 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15//
16// Definitions for building the Java library and associated tests.
17//
18
19// libcore is divided into modules.
20//
21// The structure of each module is:
22//
23// src/
24// main/ # To be shipped on every device.
25// java/ # Java source for library code.
26// native/ # C++ source for library code.
27// resources/ # Support files.
28// test/ # Built only on demand, for testing.
29// java/ # Java source for tests.
30// native/ # C++ source for tests (rare).
31// resources/ # Support files.
32//
33// All subdirectories are optional
34
35build = [
36 "openjdk_java_files.bp",
37 "non_openjdk_java_files.bp",
Colin Crossfb7218e2017-10-27 17:50:42 +000038 "annotated_java_files.bp",
Colin Crossaf0b54c2017-09-27 17:22:32 -070039]
40
41// The Java files and their associated resources.
42core_resource_dirs = [
43 "luni/src/main/java",
44 "ojluni/src/main/resources/",
45]
46
47java_defaults {
48 name: "libcore_java_defaults",
49 javacflags: [
50 //"-Xlint:all",
51 //"-Xlint:-serial,-deprecation,-unchecked",
52 ],
53 dxflags: ["--core-library"],
54 no_standard_libs: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -070055}
56
57//
58// Build for the target (device).
59//
60
61java_library {
62 name: "core-all",
63 defaults: ["libcore_java_defaults"],
64
65 srcs: [
66 ":openjdk_java_files",
67 ":non_openjdk_java_files",
68 ":android_icu4j_src_files",
69 ":openjdk_lambda_stub_files",
70 ],
Colin Crossa4d9fc42017-09-29 18:04:37 -070071 openjdk9: {
72 srcs: ["luni/src/module/java/module-info.java"],
73 javacflags: ["--patch-module=java.base=."],
74 },
Colin Crossaf0b54c2017-09-27 17:22:32 -070075 java_resource_dirs: core_resource_dirs,
Colin Crossa4d9fc42017-09-29 18:04:37 -070076 java_resources: [":android_icu4j_resources"],
Colin Crossaf0b54c2017-09-27 17:22:32 -070077
78 required: [
79 "tzdata",
80 "tzlookup.xml",
81 ],
82
Colin Crossa4d9fc42017-09-29 18:04:37 -070083 system_modules: "none",
84
Colin Crossaf0b54c2017-09-27 17:22:32 -070085 installable: false,
86}
87
Colin Crossa4d9fc42017-09-29 18:04:37 -070088java_system_modules {
89 name: "core-all-system-modules",
90 libs: ["core-all"],
91}
92
Colin Crossaf0b54c2017-09-27 17:22:32 -070093java_library {
94 name: "core-oj",
95 defaults: ["libcore_java_defaults"],
Colin Crossbb180be2017-10-09 14:54:53 -070096 hostdex: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -070097
98 srcs: [":openjdk_java_files"],
99 java_resource_dirs: core_resource_dirs,
100 libs: ["core-all"],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700101 system_modules: "core-all-system-modules",
102 openjdk9: {
103 javacflags: ["--patch-module=java.base=."],
104 },
Pete Gillin7a7a6d22017-12-19 14:56:03 +0000105 jacoco: {
Pete Gillin27ca0582018-01-10 17:04:17 +0000106 exclude_filter: [
Pete Gillin3f59bad2018-01-30 11:20:29 +0000107 "java.lang.Class",
108 "java.lang.Long",
109 "java.lang.Number",
110 "java.lang.Object",
111 "java.lang.String",
112 "java.lang.invoke.MethodHandle",
113 "java.lang.ref.Reference",
114 "java.lang.reflect.Proxy",
Pete Gillinb1868ada2018-01-17 11:03:10 +0000115 "java.util.AbstractMap",
Pete Gillin3f59bad2018-01-30 11:20:29 +0000116 "java.util.HashMap",
117 "java.util.HashMap$Node",
Pete Gillinb1868ada2018-01-17 11:03:10 +0000118 "java.util.Map",
Pete Gillin7a7a6d22017-12-19 14:56:03 +0000119 ],
120 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700121
122 notice: "ojluni/NOTICE",
123
124 required: [
125 "tzdata",
126 "tzlookup.xml",
127 ],
Colin Crossbb180be2017-10-09 14:54:53 -0700128
Colin Crossaf0b54c2017-09-27 17:22:32 -0700129}
130
131// Definitions to make the core library.
132java_library {
133 name: "core-libart",
134 defaults: ["libcore_java_defaults"],
Colin Crossbb180be2017-10-09 14:54:53 -0700135 hostdex: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700136
137 srcs: [
138 ":non_openjdk_java_files",
139 ":android_icu4j_src_files",
140 ],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700141 java_resources: [":android_icu4j_resources"],
Colin Crossaf0b54c2017-09-27 17:22:32 -0700142
143 libs: ["core-all"],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700144 system_modules: "core-all-system-modules",
145 openjdk9: {
146 javacflags: ["--patch-module=java.base=."],
147 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700148
149 required: [
150 "tzdata",
151 "tzlookup.xml",
152 ],
153}
154
Colin Cross3c6c2e22017-10-18 13:24:52 -0700155// A guaranteed unstripped version of core-oj and core-libart.
156// The build system may or may not strip the core-oj and core-libart jars,
157// but these will not be stripped. See b/24535627.
158java_library {
159 name: "core-oj-testdex",
160 static_libs: ["core-oj"],
161 no_standard_libs: true,
162 libs: ["core-all"],
163 system_modules: "core-all-system-modules",
164 dxflags: ["--core-library"],
Colin Cross485ed362017-12-05 17:24:22 -0800165 dex_preopt: {
166 enabled: false,
167 },
Colin Cross3c6c2e22017-10-18 13:24:52 -0700168 notice: "ojluni/NOTICE",
169 required: [
170 "tzdata",
171 "tzlookup.xml",
172 ],
173}
174
175java_library {
176 name: "core-libart-testdex",
177 static_libs: ["core-libart"],
178 no_standard_libs: true,
179 libs: ["core-all"],
180 system_modules: "core-all-system-modules",
181 dxflags: ["--core-library"],
Colin Cross485ed362017-12-05 17:24:22 -0800182 dex_preopt: {
183 enabled: false,
184 },
Colin Cross3c6c2e22017-10-18 13:24:52 -0700185 notice: "ojluni/NOTICE",
186 required: [
187 "tzdata",
188 "tzlookup.xml",
189 ],
190}
191
Colin Crossaf0b54c2017-09-27 17:22:32 -0700192// A library that exists to satisfy javac when
193// compiling source code that contains lambdas.
194java_library {
195 name: "core-lambda-stubs",
196 defaults: ["libcore_java_defaults"],
197
198 srcs: [
199 ":openjdk_lambda_stub_files",
200 ":openjdk_lambda_duplicate_stub_files",
201 ],
202
203 libs: ["core-all"],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700204 system_modules: "core-all-system-modules",
205 openjdk9: {
206 javacflags: ["--patch-module=java.base=."],
207 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700208
209 notice: "ojluni/NOTICE",
210
211 installable: false,
212 include_srcs: true,
213}
Colin Crossa4d9fc42017-09-29 18:04:37 -0700214
215java_system_modules {
216 name: "core-system-modules",
217 libs: [
218 "core-oj",
219 "core-libart",
220 "core-lambda-stubs",
221 ],
222}
Colin Cross3c6c2e22017-10-18 13:24:52 -0700223
224// Build libcore test rules
225java_library_static {
226 name: "core-test-rules",
227 hostdex: true,
228 no_framework_libs: true,
229 srcs: [
230 "dalvik/test-rules/src/main/**/*.java",
231 "test-rules/src/main/**/*.java",
232 ],
233 static_libs: ["junit"],
234}
235
236// Make the core-tests-support library.
237java_library_static {
238 name: "core-tests-support",
239 hostdex: true,
240 no_framework_libs: true,
241 srcs: ["support/src/test/java/**/*.java"],
242 libs: [
243 "junit",
244 "bouncycastle",
245 ],
246 static_libs: [
247 "bouncycastle-bcpkix",
248 "bouncycastle-ocsp",
249 ],
250}
251
252// Make the jsr166-tests library.
253java_library_static {
254 name: "jsr166-tests",
255 srcs: ["jsr166-tests/src/test/java/**/*.java"],
256 no_framework_libs: true,
257 libs: [
258 "junit",
259 ],
260}