blob: a7f18ea990efb97d1391957b2e660051c6a02958 [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 Stjernholmcf9a2ad2021-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 Stjernholm536c1a32021-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: {
Dan Willemsen7f7768f2017-10-02 10:41:10 -0700138 linux_glibc: {
Colin Cross09975c32017-08-29 15:01:05 -0700139 cflags: [ // Sigh.
140 "-D_LARGEFILE64_SOURCE",
141 "-D_GNU_SOURCE",
142 "-DLINUX",
143 "-D__GLIBC__",
144 ],
145 },
Victor Change05511a2018-11-26 17:26:39 +0000146 android: {
Victor Chang8f37b142019-10-04 17:15:18 +0100147 shared_libs: [
vichangf52da6d2019-10-08 10:36:13 +0000148 "libdl_android",
Victor Chang8f37b142019-10-04 17:15:18 +0100149 ],
150 },
Colin Cross09975c32017-08-29 15:01:05 -0700151 },
152
153 notice: "ojluni/NOTICE",
154}
155
156cc_library_shared {
157 name: "libopenjdk",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100158 visibility: [
159 "//art/build/apex",
160 ],
Jiyong Parkb916cac2019-12-19 02:12:09 +0000161 apex_available: [
Martin Stjernholmfe8feb62020-10-12 15:11:14 +0100162 "com.android.art",
Jiyong Parkb916cac2019-12-19 02:12:09 +0000163 "com.android.art.debug",
164 ],
Colin Cross09975c32017-08-29 15:01:05 -0700165 defaults: ["libopenjdk_native_defaults"],
166 shared_libs: [
167 "libopenjdkjvm",
168 ],
169}
170
171// Debug version of libopenjdk. Depends on libopenjdkjvmd.
172cc_library_shared {
173 name: "libopenjdkd",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100174 visibility: [
175 "//art/build/apex",
176 ],
Jiyong Parkb916cac2019-12-19 02:12:09 +0000177 apex_available: [
178 "com.android.art.debug",
179 ],
Colin Cross09975c32017-08-29 15:01:05 -0700180 defaults: ["libopenjdk_native_defaults"],
181 shared_libs: [
182 "libopenjdkjvmd",
183 ],
184}
185
186// Test JNI library.
187cc_library_shared {
188 name: "libjavacoretests",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100189 visibility: [
Paul Duffin86abe9e2020-01-16 16:55:36 +0000190 "//art/build/sdk",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100191 "//cts/tests/libcore/luni",
192 ],
Colin Cross09975c32017-08-29 15:01:05 -0700193 defaults: ["core_native_default_flags"],
Logan Chien568c0bc2018-02-27 16:03:04 +0800194 host_supported: true,
Colin Cross09975c32017-08-29 15:01:05 -0700195
196 srcs: [
Tobias Thiererd430cc72017-11-01 14:35:40 +0000197 "luni/src/test/native/libcore_dalvik_system_JniTest.cpp",
Colin Cross09975c32017-08-29 15:01:05 -0700198 "luni/src/test/native/libcore_java_io_FileTest.cpp",
199 "luni/src/test/native/libcore_java_lang_ThreadTest.cpp",
200 "luni/src/test/native/libcore_java_nio_BufferTest.cpp",
Tobias Thiererd430cc72017-11-01 14:35:40 +0000201 "luni/src/test/native/libcore_libcore_util_NativeAllocationRegistryTest.cpp",
Colin Cross09975c32017-08-29 15:01:05 -0700202 ],
Victor Chang67b3fa62020-03-04 18:01:08 +0000203 shared_libs: [
Victor Chang67b3fa62020-03-04 18:01:08 +0000204 "liblog",
Orion Hodson6272f2d2020-04-28 14:25:16 +0100205 "libnativehelper",
Victor Chang67b3fa62020-03-04 18:01:08 +0000206 ],
Colin Cross09975c32017-08-29 15:01:05 -0700207
208 strip: {
209 keep_symbols: true,
210 },
211}
212
213// Set of gtest unit tests.
214cc_test {
215 name: "libjavacore-unit-tests",
216 defaults: ["core_native_default_flags"],
217
Martin Stjernholmcf9a2ad2021-05-10 20:39:21 +0100218 // TODO(b/172480617): Fix this source dependency from
219 // platform_testing/build/tasks/tests/native_test_list.mk.
220 enabled: true,
221
Colin Cross09975c32017-08-29 15:01:05 -0700222 // Add -fno-builtin so that the compiler doesn't attempt to inline
223 // memcpy calls that are not really aligned.
224 cflags: ["-fno-builtin"],
Orion Hodson73caf182020-09-22 17:42:30 +0100225 srcs: [
226 "luni/src/test/native/libcore_io_Memory_test.cpp",
227 // libcore_io_Memory_test.cpp includes libcore_io_Memory.cpp which
228 // depends on JniConstants.cpp (but these are not used in the tests).
229 "luni/src/main/native/JniConstants.cpp",
230 ],
Colin Cross09975c32017-08-29 15:01:05 -0700231
Orion Hodson73caf182020-09-22 17:42:30 +0100232 shared_libs: [
233 "liblog",
234 "libnativehelper",
235 ],
Orion Hodson13f17b92021-05-20 21:46:51 +0100236
237 static_libs: ["libnativehelper_compat_libc++"],
Colin Cross09975c32017-08-29 15:01:05 -0700238}
239
240// Set of benchmarks for libjavacore functions.
241cc_benchmark {
242 name: "libjavacore-benchmarks",
243 defaults: ["core_native_default_flags"],
244
Martin Stjernholmcf9a2ad2021-05-10 20:39:21 +0100245 // TODO(b/172480617): Fix this source dependency from
246 // platform_testing/build/tasks/tests/native_metric_test_list.mk.
247 enabled: true,
248
Orion Hodson73caf182020-09-22 17:42:30 +0100249 srcs: [
250 "luni/src/benchmark/native/libcore_io_Memory_bench.cpp",
251 // libcore_io_Memory_bench.cpp includes libcore_io_Memory.cpp which
252 // depends on JniConstants.cpp (but these are not used in the benchmark).
253 "luni/src/main/native/JniConstants.cpp",
254 ],
Colin Cross09975c32017-08-29 15:01:05 -0700255 test_suites: ["device-tests"],
256
Orion Hodson73caf182020-09-22 17:42:30 +0100257 shared_libs: [
258 "liblog",
259 "libnativehelper",
260 ],
Colin Cross09975c32017-08-29 15:01:05 -0700261}