blob: 75c0c90aab55e33b92762a2ef7b07fbb8652268f [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 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700105
106 notice: "ojluni/NOTICE",
107
108 required: [
109 "tzdata",
110 "tzlookup.xml",
111 ],
Colin Crossbb180be2017-10-09 14:54:53 -0700112
Colin Crossaf0b54c2017-09-27 17:22:32 -0700113}
114
115// Definitions to make the core library.
116java_library {
117 name: "core-libart",
118 defaults: ["libcore_java_defaults"],
Colin Crossbb180be2017-10-09 14:54:53 -0700119 hostdex: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700120
121 srcs: [
122 ":non_openjdk_java_files",
123 ":android_icu4j_src_files",
124 ],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700125 java_resources: [":android_icu4j_resources"],
Colin Crossaf0b54c2017-09-27 17:22:32 -0700126
127 libs: ["core-all"],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700128 system_modules: "core-all-system-modules",
129 openjdk9: {
130 javacflags: ["--patch-module=java.base=."],
131 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700132
133 required: [
134 "tzdata",
135 "tzlookup.xml",
136 ],
137}
138
Colin Cross3c6c2e22017-10-18 13:24:52 -0700139// A guaranteed unstripped version of core-oj and core-libart.
140// The build system may or may not strip the core-oj and core-libart jars,
141// but these will not be stripped. See b/24535627.
142java_library {
143 name: "core-oj-testdex",
144 static_libs: ["core-oj"],
145 no_standard_libs: true,
146 libs: ["core-all"],
147 system_modules: "core-all-system-modules",
148 dxflags: ["--core-library"],
Colin Cross485ed362017-12-05 17:24:22 -0800149 dex_preopt: {
150 enabled: false,
151 },
Colin Cross3c6c2e22017-10-18 13:24:52 -0700152 notice: "ojluni/NOTICE",
153 required: [
154 "tzdata",
155 "tzlookup.xml",
156 ],
157}
158
159java_library {
160 name: "core-libart-testdex",
161 static_libs: ["core-libart"],
162 no_standard_libs: true,
163 libs: ["core-all"],
164 system_modules: "core-all-system-modules",
165 dxflags: ["--core-library"],
Colin Cross485ed362017-12-05 17:24:22 -0800166 dex_preopt: {
167 enabled: false,
168 },
Colin Cross3c6c2e22017-10-18 13:24:52 -0700169 notice: "ojluni/NOTICE",
170 required: [
171 "tzdata",
172 "tzlookup.xml",
173 ],
174}
175
Colin Crossaf0b54c2017-09-27 17:22:32 -0700176// A library that exists to satisfy javac when
177// compiling source code that contains lambdas.
178java_library {
179 name: "core-lambda-stubs",
180 defaults: ["libcore_java_defaults"],
181
182 srcs: [
183 ":openjdk_lambda_stub_files",
184 ":openjdk_lambda_duplicate_stub_files",
185 ],
186
187 libs: ["core-all"],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700188 system_modules: "core-all-system-modules",
189 openjdk9: {
190 javacflags: ["--patch-module=java.base=."],
191 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700192
193 notice: "ojluni/NOTICE",
194
195 installable: false,
196 include_srcs: true,
197}
Colin Crossa4d9fc42017-09-29 18:04:37 -0700198
199java_system_modules {
200 name: "core-system-modules",
201 libs: [
202 "core-oj",
203 "core-libart",
204 "core-lambda-stubs",
205 ],
206}
Colin Cross3c6c2e22017-10-18 13:24:52 -0700207
208// Build libcore test rules
209java_library_static {
210 name: "core-test-rules",
211 hostdex: true,
212 no_framework_libs: true,
213 srcs: [
214 "dalvik/test-rules/src/main/**/*.java",
215 "test-rules/src/main/**/*.java",
216 ],
217 static_libs: ["junit"],
218}
219
220// Make the core-tests-support library.
221java_library_static {
222 name: "core-tests-support",
223 hostdex: true,
224 no_framework_libs: true,
225 srcs: ["support/src/test/java/**/*.java"],
226 libs: [
227 "junit",
228 "bouncycastle",
229 ],
230 static_libs: [
231 "bouncycastle-bcpkix",
232 "bouncycastle-ocsp",
233 ],
234}
235
236// Make the jsr166-tests library.
237java_library_static {
238 name: "jsr166-tests",
239 srcs: ["jsr166-tests/src/test/java/**/*.java"],
240 no_framework_libs: true,
241 libs: [
242 "junit",
243 ],
244}