blob: 1da8b6de31ae3b4cd7d20a2f91438ee40e8ecc67 [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: {
106 include_filter: [
107 "java.sql.*",
108 ],
109 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700110
111 notice: "ojluni/NOTICE",
112
113 required: [
114 "tzdata",
115 "tzlookup.xml",
116 ],
Colin Crossbb180be2017-10-09 14:54:53 -0700117
Colin Crossaf0b54c2017-09-27 17:22:32 -0700118}
119
120// Definitions to make the core library.
121java_library {
122 name: "core-libart",
123 defaults: ["libcore_java_defaults"],
Colin Crossbb180be2017-10-09 14:54:53 -0700124 hostdex: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700125
126 srcs: [
127 ":non_openjdk_java_files",
128 ":android_icu4j_src_files",
129 ],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700130 java_resources: [":android_icu4j_resources"],
Colin Crossaf0b54c2017-09-27 17:22:32 -0700131
132 libs: ["core-all"],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700133 system_modules: "core-all-system-modules",
134 openjdk9: {
135 javacflags: ["--patch-module=java.base=."],
136 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700137
138 required: [
139 "tzdata",
140 "tzlookup.xml",
141 ],
142}
143
Colin Cross3c6c2e22017-10-18 13:24:52 -0700144// A guaranteed unstripped version of core-oj and core-libart.
145// The build system may or may not strip the core-oj and core-libart jars,
146// but these will not be stripped. See b/24535627.
147java_library {
148 name: "core-oj-testdex",
149 static_libs: ["core-oj"],
150 no_standard_libs: true,
151 libs: ["core-all"],
152 system_modules: "core-all-system-modules",
153 dxflags: ["--core-library"],
Colin Cross485ed362017-12-05 17:24:22 -0800154 dex_preopt: {
155 enabled: false,
156 },
Colin Cross3c6c2e22017-10-18 13:24:52 -0700157 notice: "ojluni/NOTICE",
158 required: [
159 "tzdata",
160 "tzlookup.xml",
161 ],
162}
163
164java_library {
165 name: "core-libart-testdex",
166 static_libs: ["core-libart"],
167 no_standard_libs: true,
168 libs: ["core-all"],
169 system_modules: "core-all-system-modules",
170 dxflags: ["--core-library"],
Colin Cross485ed362017-12-05 17:24:22 -0800171 dex_preopt: {
172 enabled: false,
173 },
Colin Cross3c6c2e22017-10-18 13:24:52 -0700174 notice: "ojluni/NOTICE",
175 required: [
176 "tzdata",
177 "tzlookup.xml",
178 ],
179}
180
Colin Crossaf0b54c2017-09-27 17:22:32 -0700181// A library that exists to satisfy javac when
182// compiling source code that contains lambdas.
183java_library {
184 name: "core-lambda-stubs",
185 defaults: ["libcore_java_defaults"],
186
187 srcs: [
188 ":openjdk_lambda_stub_files",
189 ":openjdk_lambda_duplicate_stub_files",
190 ],
191
192 libs: ["core-all"],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700193 system_modules: "core-all-system-modules",
194 openjdk9: {
195 javacflags: ["--patch-module=java.base=."],
196 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700197
198 notice: "ojluni/NOTICE",
199
200 installable: false,
201 include_srcs: true,
202}
Colin Crossa4d9fc42017-09-29 18:04:37 -0700203
204java_system_modules {
205 name: "core-system-modules",
206 libs: [
207 "core-oj",
208 "core-libart",
209 "core-lambda-stubs",
210 ],
211}
Colin Cross3c6c2e22017-10-18 13:24:52 -0700212
213// Build libcore test rules
214java_library_static {
215 name: "core-test-rules",
216 hostdex: true,
217 no_framework_libs: true,
218 srcs: [
219 "dalvik/test-rules/src/main/**/*.java",
220 "test-rules/src/main/**/*.java",
221 ],
222 static_libs: ["junit"],
223}
224
225// Make the core-tests-support library.
226java_library_static {
227 name: "core-tests-support",
228 hostdex: true,
229 no_framework_libs: true,
230 srcs: ["support/src/test/java/**/*.java"],
231 libs: [
232 "junit",
233 "bouncycastle",
234 ],
235 static_libs: [
236 "bouncycastle-bcpkix",
237 "bouncycastle-ocsp",
238 ],
239}
240
241// Make the jsr166-tests library.
242java_library_static {
243 name: "jsr166-tests",
244 srcs: ["jsr166-tests/src/test/java/**/*.java"],
245 no_framework_libs: true,
246 libs: [
247 "junit",
248 ],
249}