blob: 2db70196d78309f23549ee289c58c7ff310eef98 [file] [log] [blame]
Colin Cross09975c32017-08-29 15:01:05 -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 native code needed for the core library.
17//
18
19// Defaults that apply to all of the modules
20
21cc_defaults {
22 name: "core_native_default_flags",
Martin Stjernholm7abd1e12021-05-10 20:39:21 +010023 defaults: ["art_module_source_build_defaults"],
Colin Cross09975c32017-08-29 15:01:05 -070024 host_supported: true,
Colin Cross09975c32017-08-29 15:01:05 -070025 cflags: [
26 "-Wall",
27 "-Wextra",
28 "-Werror",
29 ],
Logan Chien568c0bc2018-02-27 16:03:04 +080030 cppflags: ["-DU_USING_ICU_NAMESPACE=0"],
Colin Cross09975c32017-08-29 15:01:05 -070031
32 target: {
33 darwin: {
34 enabled: false,
35 },
36 },
Nicolas Geoffray83f47302021-03-03 22:00:47 +000037 min_sdk_version: "S",
Colin Cross09975c32017-08-29 15:01:05 -070038}
39
40cc_defaults {
41 name: "core_native_default_libs",
Orion Hodson15981542020-04-03 06:47:08 +010042 header_libs: ["jni_headers"],
Colin Cross09975c32017-08-29 15:01:05 -070043 shared_libs: [
Vladimir Marko26a4cb82018-06-07 14:57:30 +000044 "libbase",
Colin Cross09975c32017-08-29 15:01:05 -070045 "liblog",
46 "libnativehelper",
47 ],
Orion Hodson13f17b92021-05-20 21:46:51 +010048 static_libs: ["libnativehelper_compat_libc++"],
Colin Cross09975c32017-08-29 15:01:05 -070049}
50
51cc_library_shared {
52 name: "libjavacore",
Paul Duffinc241d6a2019-06-25 15:40:29 +010053 visibility: [
54 "//art/build/apex",
Martin Stjernholm03033cd2021-06-22 13:32:00 +010055 "//art/runtime",
Paul Duffinc241d6a2019-06-25 15:40:29 +010056 ],
Jiyong Parkb916cac2019-12-19 02:12:09 +000057 apex_available: [
Martin Stjernholmfe8feb62020-10-12 15:11:14 +010058 "com.android.art",
Jiyong Parkb916cac2019-12-19 02:12:09 +000059 "com.android.art.debug",
60 ],
Colin Cross09975c32017-08-29 15:01:05 -070061 defaults: [
62 "core_native_default_flags",
63 "core_native_default_libs",
64 ],
65 srcs: [
66 ":luni_native_srcs",
Colin Cross09975c32017-08-29 15:01:05 -070067 ],
Colin Cross09975c32017-08-29 15:01:05 -070068 shared_libs: [
Pete Bentleyc2d71642019-02-22 17:20:03 +000069 "libandroidio",
Colin Cross09975c32017-08-29 15:01:05 -070070 "libcrypto",
Victor Chang4ab33ea2020-09-22 21:45:30 +010071 "libicu",
Colin Cross09975c32017-08-29 15:01:05 -070072 "libexpat",
Dan Willemsen82553c72017-09-27 16:22:54 -070073 "libz",
Colin Cross09975c32017-08-29 15:01:05 -070074 ],
75 static_libs: [
76 "libziparchive",
Colin Cross09975c32017-08-29 15:01:05 -070077 ],
Colin Cross09975c32017-08-29 15:01:05 -070078}
79
Pete Bentleyc2d71642019-02-22 17:20:03 +000080cc_library_shared {
81 name: "libandroidio",
Paul Duffinc241d6a2019-06-25 15:40:29 +010082 visibility: [
83 "//art/build/apex",
Paul Duffin8aadfc22020-03-05 08:37:41 +000084 "//art/build/sdk",
Jooyung Han826f28e2019-12-16 23:36:50 +090085 "//external/conscrypt",
Paul Duffinc241d6a2019-06-25 15:40:29 +010086 ],
Jiyong Parkb916cac2019-12-19 02:12:09 +000087 apex_available: [
Martin Stjernholmfe8feb62020-10-12 15:11:14 +010088 "com.android.art",
Jiyong Parkb916cac2019-12-19 02:12:09 +000089 "com.android.art.debug",
90 ],
Pete Bentleyc2d71642019-02-22 17:20:03 +000091 defaults: [
92 "core_native_default_flags",
93 ],
94 shared_libs: [
95 "liblog",
96 ],
97 srcs: [
98 ":libandroidio_srcs",
99 ],
100 stubs: {
101 symbol_file: "libandroidio.map.txt",
102 versions: ["1"],
103 },
104}
105
Colin Cross09975c32017-08-29 15:01:05 -0700106cc_defaults {
107 name: "libopenjdk_native_defaults",
108 defaults: [
109 "core_native_default_flags",
110 "core_native_default_libs",
111 ],
112 srcs: [":libopenjdk_native_srcs"],
Paul Duffind96f57e2019-07-12 16:12:49 +0100113 local_include_dirs: [
114 "luni/src/main/native",
Pete Bentleydfc8ce02019-02-06 10:58:56 +0000115 ],
Colin Cross09975c32017-08-29 15:01:05 -0700116 cflags: [
117 // TODO(narayan): Prune down this list of exclusions once the underlying
118 // issues have been fixed. Most of these are small changes except for
119 // -Wunused-parameter.
120 "-Wno-unused-parameter",
121 "-Wno-unused-variable",
122 "-Wno-parentheses-equality",
123 "-Wno-constant-logical-operand",
124 "-Wno-sometimes-uninitialized",
Colin Cross09975c32017-08-29 15:01:05 -0700125 ],
126
127 shared_libs: [
Pete Bentleyc2d71642019-02-22 17:20:03 +0000128 "libandroidio",
Colin Cross09975c32017-08-29 15:01:05 -0700129 "libcrypto",
Victor Chang4ab33ea2020-09-22 21:45:30 +0100130 "libicu",
Pete Bentleydfc8ce02019-02-06 10:58:56 +0000131 "libz",
Colin Cross09975c32017-08-29 15:01:05 -0700132 ],
Orion Hodson13f17b92021-05-20 21:46:51 +0100133 static_libs: [
134 "libfdlibm",
Orion Hodson13f17b92021-05-20 21:46:51 +0100135 ],
Colin Cross09975c32017-08-29 15:01:05 -0700136
137 target: {
Colin Cross3fd596f2022-03-24 15:45:22 -0700138 musl: {
139 cflags: [
140 // Sigh.
Colin Cross09975c32017-08-29 15:01:05 -0700141 "-D_LARGEFILE64_SOURCE",
142 "-D_GNU_SOURCE",
143 "-DLINUX",
Colin Cross09975c32017-08-29 15:01:05 -0700144 ],
145 },
Colin Cross74f5a592021-09-14 10:57:21 -0700146 glibc: {
Colin Cross3fd596f2022-03-24 15:45:22 -0700147 cflags: [
148 "-D__GLIBC__",
149 // Sigh.
150 "-D_LARGEFILE64_SOURCE",
151 "-D_GNU_SOURCE",
152 "-DLINUX",
153 ],
Colin Cross74f5a592021-09-14 10:57:21 -0700154 },
Victor Change05511a2018-11-26 17:26:39 +0000155 android: {
Victor Chang8f37b142019-10-04 17:15:18 +0100156 shared_libs: [
vichangf52da6d2019-10-08 10:36:13 +0000157 "libdl_android",
Victor Chang8f37b142019-10-04 17:15:18 +0100158 ],
159 },
Colin Cross09975c32017-08-29 15:01:05 -0700160 },
161
162 notice: "ojluni/NOTICE",
163}
164
165cc_library_shared {
166 name: "libopenjdk",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100167 visibility: [
168 "//art/build/apex",
169 ],
Jiyong Parkb916cac2019-12-19 02:12:09 +0000170 apex_available: [
Martin Stjernholmfe8feb62020-10-12 15:11:14 +0100171 "com.android.art",
Jiyong Parkb916cac2019-12-19 02:12:09 +0000172 "com.android.art.debug",
173 ],
Colin Cross09975c32017-08-29 15:01:05 -0700174 defaults: ["libopenjdk_native_defaults"],
175 shared_libs: [
176 "libopenjdkjvm",
177 ],
178}
179
180// Debug version of libopenjdk. Depends on libopenjdkjvmd.
181cc_library_shared {
182 name: "libopenjdkd",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100183 visibility: [
184 "//art/build/apex",
185 ],
Jiyong Parkb916cac2019-12-19 02:12:09 +0000186 apex_available: [
187 "com.android.art.debug",
188 ],
Colin Cross09975c32017-08-29 15:01:05 -0700189 defaults: ["libopenjdk_native_defaults"],
190 shared_libs: [
191 "libopenjdkjvmd",
192 ],
193}
194
195// Test JNI library.
196cc_library_shared {
197 name: "libjavacoretests",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100198 visibility: [
Paul Duffin86abe9e2020-01-16 16:55:36 +0000199 "//art/build/sdk",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100200 "//cts/tests/libcore/luni",
201 ],
Colin Cross09975c32017-08-29 15:01:05 -0700202 defaults: ["core_native_default_flags"],
Logan Chien568c0bc2018-02-27 16:03:04 +0800203 host_supported: true,
Colin Cross09975c32017-08-29 15:01:05 -0700204
205 srcs: [
Tobias Thiererd430cc72017-11-01 14:35:40 +0000206 "luni/src/test/native/libcore_dalvik_system_JniTest.cpp",
Colin Cross09975c32017-08-29 15:01:05 -0700207 "luni/src/test/native/libcore_java_io_FileTest.cpp",
208 "luni/src/test/native/libcore_java_lang_ThreadTest.cpp",
209 "luni/src/test/native/libcore_java_nio_BufferTest.cpp",
Almaz Mingaleev0a4a1ed2021-09-09 10:57:57 +0100210 "luni/src/test/native/libcore_java_time_BionicTzdbConsistencyTest.cpp",
Tobias Thiererd430cc72017-11-01 14:35:40 +0000211 "luni/src/test/native/libcore_libcore_util_NativeAllocationRegistryTest.cpp",
Colin Cross09975c32017-08-29 15:01:05 -0700212 ],
Victor Chang67b3fa62020-03-04 18:01:08 +0000213 shared_libs: [
Victor Chang67b3fa62020-03-04 18:01:08 +0000214 "liblog",
Orion Hodson6272f2d2020-04-28 14:25:16 +0100215 "libnativehelper",
Victor Chang67b3fa62020-03-04 18:01:08 +0000216 ],
Colin Cross09975c32017-08-29 15:01:05 -0700217}
218
219// Set of gtest unit tests.
220cc_test {
221 name: "libjavacore-unit-tests",
222 defaults: ["core_native_default_flags"],
223
Martin Stjernholm7abd1e12021-05-10 20:39:21 +0100224 // TODO(b/172480617): Fix this source dependency from
225 // platform_testing/build/tasks/tests/native_test_list.mk.
226 enabled: true,
227
Colin Cross09975c32017-08-29 15:01:05 -0700228 // Add -fno-builtin so that the compiler doesn't attempt to inline
229 // memcpy calls that are not really aligned.
230 cflags: ["-fno-builtin"],
Orion Hodson73caf182020-09-22 17:42:30 +0100231 srcs: [
232 "luni/src/test/native/libcore_io_Memory_test.cpp",
233 // libcore_io_Memory_test.cpp includes libcore_io_Memory.cpp which
234 // depends on JniConstants.cpp (but these are not used in the tests).
235 "luni/src/main/native/JniConstants.cpp",
236 ],
Colin Cross09975c32017-08-29 15:01:05 -0700237
Orion Hodson73caf182020-09-22 17:42:30 +0100238 shared_libs: [
239 "liblog",
240 "libnativehelper",
241 ],
Orion Hodson13f17b92021-05-20 21:46:51 +0100242
243 static_libs: ["libnativehelper_compat_libc++"],
Colin Cross09975c32017-08-29 15:01:05 -0700244}
245
246// Set of benchmarks for libjavacore functions.
247cc_benchmark {
248 name: "libjavacore-benchmarks",
249 defaults: ["core_native_default_flags"],
250
Martin Stjernholm7abd1e12021-05-10 20:39:21 +0100251 // TODO(b/172480617): Fix this source dependency from
252 // platform_testing/build/tasks/tests/native_metric_test_list.mk.
253 enabled: true,
254
Orion Hodson73caf182020-09-22 17:42:30 +0100255 srcs: [
256 "luni/src/benchmark/native/libcore_io_Memory_bench.cpp",
257 // libcore_io_Memory_bench.cpp includes libcore_io_Memory.cpp which
258 // depends on JniConstants.cpp (but these are not used in the benchmark).
259 "luni/src/main/native/JniConstants.cpp",
260 ],
Colin Cross09975c32017-08-29 15:01:05 -0700261 test_suites: ["device-tests"],
262
Orion Hodson73caf182020-09-22 17:42:30 +0100263 shared_libs: [
264 "liblog",
265 "libnativehelper",
266 ],
Colin Cross09975c32017-08-29 15:01:05 -0700267}