blob: 8b1a2d9b6bf61d7b183f9aa7972be58d267b913c [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: {
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",
Colin Cross09975c32017-08-29 15:01:05 -0700143 ],
144 },
Colin Cross74f5a592021-09-14 10:57:21 -0700145 glibc: {
146 cflags: ["-D__GLIBC__"],
147 },
Victor Change05511a2018-11-26 17:26:39 +0000148 android: {
Victor Chang8f37b142019-10-04 17:15:18 +0100149 shared_libs: [
vichangf52da6d2019-10-08 10:36:13 +0000150 "libdl_android",
Victor Chang8f37b142019-10-04 17:15:18 +0100151 ],
152 },
Colin Cross09975c32017-08-29 15:01:05 -0700153 },
154
155 notice: "ojluni/NOTICE",
156}
157
158cc_library_shared {
159 name: "libopenjdk",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100160 visibility: [
161 "//art/build/apex",
162 ],
Jiyong Parkb916cac2019-12-19 02:12:09 +0000163 apex_available: [
Martin Stjernholmfe8feb62020-10-12 15:11:14 +0100164 "com.android.art",
Jiyong Parkb916cac2019-12-19 02:12:09 +0000165 "com.android.art.debug",
166 ],
Colin Cross09975c32017-08-29 15:01:05 -0700167 defaults: ["libopenjdk_native_defaults"],
168 shared_libs: [
169 "libopenjdkjvm",
170 ],
171}
172
173// Debug version of libopenjdk. Depends on libopenjdkjvmd.
174cc_library_shared {
175 name: "libopenjdkd",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100176 visibility: [
177 "//art/build/apex",
178 ],
Jiyong Parkb916cac2019-12-19 02:12:09 +0000179 apex_available: [
180 "com.android.art.debug",
181 ],
Colin Cross09975c32017-08-29 15:01:05 -0700182 defaults: ["libopenjdk_native_defaults"],
183 shared_libs: [
184 "libopenjdkjvmd",
185 ],
186}
187
188// Test JNI library.
189cc_library_shared {
190 name: "libjavacoretests",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100191 visibility: [
Paul Duffin86abe9e2020-01-16 16:55:36 +0000192 "//art/build/sdk",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100193 "//cts/tests/libcore/luni",
194 ],
Colin Cross09975c32017-08-29 15:01:05 -0700195 defaults: ["core_native_default_flags"],
Logan Chien568c0bc2018-02-27 16:03:04 +0800196 host_supported: true,
Colin Cross09975c32017-08-29 15:01:05 -0700197
198 srcs: [
Tobias Thiererd430cc72017-11-01 14:35:40 +0000199 "luni/src/test/native/libcore_dalvik_system_JniTest.cpp",
Colin Cross09975c32017-08-29 15:01:05 -0700200 "luni/src/test/native/libcore_java_io_FileTest.cpp",
201 "luni/src/test/native/libcore_java_lang_ThreadTest.cpp",
202 "luni/src/test/native/libcore_java_nio_BufferTest.cpp",
Almaz Mingaleev0a4a1ed2021-09-09 10:57:57 +0100203 "luni/src/test/native/libcore_java_time_BionicTzdbConsistencyTest.cpp",
Tobias Thiererd430cc72017-11-01 14:35:40 +0000204 "luni/src/test/native/libcore_libcore_util_NativeAllocationRegistryTest.cpp",
Colin Cross09975c32017-08-29 15:01:05 -0700205 ],
Victor Chang67b3fa62020-03-04 18:01:08 +0000206 shared_libs: [
Victor Chang67b3fa62020-03-04 18:01:08 +0000207 "liblog",
Orion Hodson6272f2d2020-04-28 14:25:16 +0100208 "libnativehelper",
Victor Chang67b3fa62020-03-04 18:01:08 +0000209 ],
Colin Cross09975c32017-08-29 15:01:05 -0700210}
211
212// Set of gtest unit tests.
213cc_test {
214 name: "libjavacore-unit-tests",
215 defaults: ["core_native_default_flags"],
216
Martin Stjernholm7abd1e12021-05-10 20:39:21 +0100217 // TODO(b/172480617): Fix this source dependency from
218 // platform_testing/build/tasks/tests/native_test_list.mk.
219 enabled: true,
220
Colin Cross09975c32017-08-29 15:01:05 -0700221 // Add -fno-builtin so that the compiler doesn't attempt to inline
222 // memcpy calls that are not really aligned.
223 cflags: ["-fno-builtin"],
Orion Hodson73caf182020-09-22 17:42:30 +0100224 srcs: [
225 "luni/src/test/native/libcore_io_Memory_test.cpp",
226 // libcore_io_Memory_test.cpp includes libcore_io_Memory.cpp which
227 // depends on JniConstants.cpp (but these are not used in the tests).
228 "luni/src/main/native/JniConstants.cpp",
229 ],
Colin Cross09975c32017-08-29 15:01:05 -0700230
Orion Hodson73caf182020-09-22 17:42:30 +0100231 shared_libs: [
232 "liblog",
233 "libnativehelper",
234 ],
Orion Hodson13f17b92021-05-20 21:46:51 +0100235
236 static_libs: ["libnativehelper_compat_libc++"],
Colin Cross09975c32017-08-29 15:01:05 -0700237}
238
239// Set of benchmarks for libjavacore functions.
240cc_benchmark {
241 name: "libjavacore-benchmarks",
242 defaults: ["core_native_default_flags"],
243
Martin Stjernholm7abd1e12021-05-10 20:39:21 +0100244 // TODO(b/172480617): Fix this source dependency from
245 // platform_testing/build/tasks/tests/native_metric_test_list.mk.
246 enabled: true,
247
Orion Hodson73caf182020-09-22 17:42:30 +0100248 srcs: [
249 "luni/src/benchmark/native/libcore_io_Memory_bench.cpp",
250 // libcore_io_Memory_bench.cpp includes libcore_io_Memory.cpp which
251 // depends on JniConstants.cpp (but these are not used in the benchmark).
252 "luni/src/main/native/JniConstants.cpp",
253 ],
Colin Cross09975c32017-08-29 15:01:05 -0700254 test_suites: ["device-tests"],
255
Orion Hodson73caf182020-09-22 17:42:30 +0100256 shared_libs: [
257 "liblog",
258 "libnativehelper",
259 ],
Colin Cross09975c32017-08-29 15:01:05 -0700260}