blob: 5d1361567c133e0f16874e66f10ab544ea57eb4e [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",
38]
39
40// The Java files and their associated resources.
41core_resource_dirs = [
42 "luni/src/main/java",
43 "ojluni/src/main/resources/",
44]
45
46java_defaults {
47 name: "libcore_java_defaults",
48 javacflags: [
49 //"-Xlint:all",
50 //"-Xlint:-serial,-deprecation,-unchecked",
51 ],
52 dxflags: ["--core-library"],
53 no_standard_libs: true,
54
55 // For user / userdebug builds, strip the local variable table and the local variable
56 // type table. This has no bearing on stack traces, but will leave less information
57 // available via JDWP.
58 //
59 // TODO: Should this be conditioned on a PRODUCT_ flag or should we just turn this
60 // on for all builds. Also, name of the flag TBD.
61 // TODO(ccross): PRODUCT_MINIMIZE_JAVA_DEBUG_INFO
62 // local_javac_flags += ["-g:source,lines"]
63}
64
65//
66// Build for the target (device).
67//
68
69java_library {
70 name: "core-all",
71 defaults: ["libcore_java_defaults"],
72
73 srcs: [
74 ":openjdk_java_files",
75 ":non_openjdk_java_files",
76 ":android_icu4j_src_files",
77 ":openjdk_lambda_stub_files",
78 ],
Colin Crossa4d9fc42017-09-29 18:04:37 -070079 openjdk9: {
80 srcs: ["luni/src/module/java/module-info.java"],
81 javacflags: ["--patch-module=java.base=."],
82 },
Colin Crossaf0b54c2017-09-27 17:22:32 -070083 java_resource_dirs: core_resource_dirs,
Colin Crossa4d9fc42017-09-29 18:04:37 -070084 java_resources: [":android_icu4j_resources"],
Colin Crossaf0b54c2017-09-27 17:22:32 -070085
86 required: [
87 "tzdata",
88 "tzlookup.xml",
89 ],
90
Colin Crossa4d9fc42017-09-29 18:04:37 -070091 system_modules: "none",
92
Colin Crossaf0b54c2017-09-27 17:22:32 -070093 installable: false,
94}
95
Colin Crossa4d9fc42017-09-29 18:04:37 -070096java_system_modules {
97 name: "core-all-system-modules",
98 libs: ["core-all"],
99}
100
Colin Crossaf0b54c2017-09-27 17:22:32 -0700101java_library {
102 name: "core-oj",
103 defaults: ["libcore_java_defaults"],
Colin Crossbb180be2017-10-09 14:54:53 -0700104 hostdex: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700105
106 srcs: [":openjdk_java_files"],
107 java_resource_dirs: core_resource_dirs,
108 libs: ["core-all"],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700109 system_modules: "core-all-system-modules",
110 openjdk9: {
111 javacflags: ["--patch-module=java.base=."],
112 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700113
114 notice: "ojluni/NOTICE",
115
116 required: [
117 "tzdata",
118 "tzlookup.xml",
119 ],
Colin Crossbb180be2017-10-09 14:54:53 -0700120
Colin Crossaf0b54c2017-09-27 17:22:32 -0700121}
122
123// Definitions to make the core library.
124java_library {
125 name: "core-libart",
126 defaults: ["libcore_java_defaults"],
Colin Crossbb180be2017-10-09 14:54:53 -0700127 hostdex: true,
Colin Crossaf0b54c2017-09-27 17:22:32 -0700128
129 srcs: [
130 ":non_openjdk_java_files",
131 ":android_icu4j_src_files",
132 ],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700133 java_resources: [":android_icu4j_resources"],
Colin Crossaf0b54c2017-09-27 17:22:32 -0700134
135 libs: ["core-all"],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700136 system_modules: "core-all-system-modules",
137 openjdk9: {
138 javacflags: ["--patch-module=java.base=."],
139 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700140
141 required: [
142 "tzdata",
143 "tzlookup.xml",
144 ],
145}
146
Colin Cross3c6c2e22017-10-18 13:24:52 -0700147// A guaranteed unstripped version of core-oj and core-libart.
148// The build system may or may not strip the core-oj and core-libart jars,
149// but these will not be stripped. See b/24535627.
150java_library {
151 name: "core-oj-testdex",
152 static_libs: ["core-oj"],
153 no_standard_libs: true,
154 libs: ["core-all"],
155 system_modules: "core-all-system-modules",
156 dxflags: ["--core-library"],
157 dex_preopt: false,
158 notice: "ojluni/NOTICE",
159 required: [
160 "tzdata",
161 "tzlookup.xml",
162 ],
163}
164
165java_library {
166 name: "core-libart-testdex",
167 static_libs: ["core-libart"],
168 no_standard_libs: true,
169 libs: ["core-all"],
170 system_modules: "core-all-system-modules",
171 dxflags: ["--core-library"],
172 dex_preopt: false,
173 notice: "ojluni/NOTICE",
174 required: [
175 "tzdata",
176 "tzlookup.xml",
177 ],
178}
179
Colin Crossaf0b54c2017-09-27 17:22:32 -0700180// A library that exists to satisfy javac when
181// compiling source code that contains lambdas.
182java_library {
183 name: "core-lambda-stubs",
184 defaults: ["libcore_java_defaults"],
185
186 srcs: [
187 ":openjdk_lambda_stub_files",
188 ":openjdk_lambda_duplicate_stub_files",
189 ],
190
191 libs: ["core-all"],
Colin Crossa4d9fc42017-09-29 18:04:37 -0700192 system_modules: "core-all-system-modules",
193 openjdk9: {
194 javacflags: ["--patch-module=java.base=."],
195 },
Colin Crossaf0b54c2017-09-27 17:22:32 -0700196
197 notice: "ojluni/NOTICE",
198
199 installable: false,
200 include_srcs: true,
201}
Colin Crossa4d9fc42017-09-29 18:04:37 -0700202
203java_system_modules {
204 name: "core-system-modules",
205 libs: [
206 "core-oj",
207 "core-libart",
208 "core-lambda-stubs",
209 ],
210}
Colin Cross3c6c2e22017-10-18 13:24:52 -0700211
212// Build libcore test rules
213java_library_static {
214 name: "core-test-rules",
215 hostdex: true,
216 no_framework_libs: true,
217 srcs: [
218 "dalvik/test-rules/src/main/**/*.java",
219 "test-rules/src/main/**/*.java",
220 ],
221 static_libs: ["junit"],
222}
223
224// Make the core-tests-support library.
225java_library_static {
226 name: "core-tests-support",
227 hostdex: true,
228 no_framework_libs: true,
229 srcs: ["support/src/test/java/**/*.java"],
230 libs: [
231 "junit",
232 "bouncycastle",
233 ],
234 static_libs: [
235 "bouncycastle-bcpkix",
236 "bouncycastle-ocsp",
237 ],
238}
239
240// Make the jsr166-tests library.
241java_library_static {
242 name: "jsr166-tests",
243 srcs: ["jsr166-tests/src/test/java/**/*.java"],
244 no_framework_libs: true,
245 libs: [
246 "junit",
247 ],
248}