blob: dac23872ec227f3d10ce104fe50574b5ca95cc5d [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",
23 host_supported: true,
Colin Cross09975c32017-08-29 15:01:05 -070024 cflags: [
25 "-Wall",
26 "-Wextra",
27 "-Werror",
28 ],
Logan Chien568c0bc2018-02-27 16:03:04 +080029 cppflags: ["-DU_USING_ICU_NAMESPACE=0"],
Colin Cross09975c32017-08-29 15:01:05 -070030
31 target: {
32 darwin: {
33 enabled: false,
34 },
35 },
Nicolas Geoffray83f47302021-03-03 22:00:47 +000036 min_sdk_version: "S",
Colin Cross09975c32017-08-29 15:01:05 -070037}
38
39cc_defaults {
40 name: "core_native_default_libs",
Orion Hodson15981542020-04-03 06:47:08 +010041 header_libs: ["jni_headers"],
Colin Cross09975c32017-08-29 15:01:05 -070042 shared_libs: [
Vladimir Marko26a4cb82018-06-07 14:57:30 +000043 "libbase",
Colin Cross09975c32017-08-29 15:01:05 -070044 "liblog",
45 "libnativehelper",
46 ],
47}
48
49cc_library_shared {
50 name: "libjavacore",
Paul Duffinc241d6a2019-06-25 15:40:29 +010051 visibility: [
52 "//art/build/apex",
53 ],
Jiyong Parkb916cac2019-12-19 02:12:09 +000054 apex_available: [
Martin Stjernholmfe8feb62020-10-12 15:11:14 +010055 "com.android.art",
Jiyong Parkb916cac2019-12-19 02:12:09 +000056 "com.android.art.debug",
57 ],
Colin Cross09975c32017-08-29 15:01:05 -070058 defaults: [
59 "core_native_default_flags",
60 "core_native_default_libs",
61 ],
62 srcs: [
63 ":luni_native_srcs",
Colin Cross09975c32017-08-29 15:01:05 -070064 ],
Colin Cross09975c32017-08-29 15:01:05 -070065 shared_libs: [
Pete Bentleyc2d71642019-02-22 17:20:03 +000066 "libandroidio",
Vladimir Marko26a4cb82018-06-07 14:57:30 +000067 "libbase",
Colin Cross09975c32017-08-29 15:01:05 -070068 "libcrypto",
Victor Chang4ab33ea2020-09-22 21:45:30 +010069 "libicu",
Colin Cross09975c32017-08-29 15:01:05 -070070 "libexpat",
Colin Cross09975c32017-08-29 15:01:05 -070071 "libnativehelper",
Dan Willemsen82553c72017-09-27 16:22:54 -070072 "libz",
Colin Cross09975c32017-08-29 15:01:05 -070073 ],
74 static_libs: [
75 "libziparchive",
Colin Cross09975c32017-08-29 15:01:05 -070076 ],
Colin Cross09975c32017-08-29 15:01:05 -070077}
78
Pete Bentleyc2d71642019-02-22 17:20:03 +000079cc_library_shared {
80 name: "libandroidio",
Paul Duffinc241d6a2019-06-25 15:40:29 +010081 visibility: [
82 "//art/build/apex",
Paul Duffin8aadfc22020-03-05 08:37:41 +000083 "//art/build/sdk",
Jooyung Han826f28e2019-12-16 23:36:50 +090084 "//external/conscrypt",
Paul Duffinc241d6a2019-06-25 15:40:29 +010085 ],
Jiyong Parkb916cac2019-12-19 02:12:09 +000086 apex_available: [
Martin Stjernholmfe8feb62020-10-12 15:11:14 +010087 "com.android.art",
Jiyong Parkb916cac2019-12-19 02:12:09 +000088 "com.android.art.debug",
89 ],
Pete Bentleyc2d71642019-02-22 17:20:03 +000090 defaults: [
91 "core_native_default_flags",
92 ],
93 shared_libs: [
94 "liblog",
95 ],
96 srcs: [
97 ":libandroidio_srcs",
98 ],
99 stubs: {
100 symbol_file: "libandroidio.map.txt",
101 versions: ["1"],
102 },
103}
104
Colin Cross09975c32017-08-29 15:01:05 -0700105cc_defaults {
106 name: "libopenjdk_native_defaults",
107 defaults: [
108 "core_native_default_flags",
109 "core_native_default_libs",
110 ],
111 srcs: [":libopenjdk_native_srcs"],
Paul Duffind96f57e2019-07-12 16:12:49 +0100112 local_include_dirs: [
113 "luni/src/main/native",
Pete Bentleydfc8ce02019-02-06 10:58:56 +0000114 ],
Colin Cross09975c32017-08-29 15:01:05 -0700115 cflags: [
116 // TODO(narayan): Prune down this list of exclusions once the underlying
117 // issues have been fixed. Most of these are small changes except for
118 // -Wunused-parameter.
119 "-Wno-unused-parameter",
120 "-Wno-unused-variable",
121 "-Wno-parentheses-equality",
122 "-Wno-constant-logical-operand",
123 "-Wno-sometimes-uninitialized",
Colin Cross09975c32017-08-29 15:01:05 -0700124 ],
125
126 shared_libs: [
Pete Bentleyc2d71642019-02-22 17:20:03 +0000127 "libandroidio",
Colin Cross09975c32017-08-29 15:01:05 -0700128 "libcrypto",
Victor Chang4ab33ea2020-09-22 21:45:30 +0100129 "libicu",
Colin Cross09975c32017-08-29 15:01:05 -0700130 "libnativehelper",
Pete Bentleydfc8ce02019-02-06 10:58:56 +0000131 "libz",
Colin Cross09975c32017-08-29 15:01:05 -0700132 ],
133 static_libs: ["libfdlibm"],
134
135 target: {
Dan Willemsen7f7768f2017-10-02 10:41:10 -0700136 linux_glibc: {
Colin Cross09975c32017-08-29 15:01:05 -0700137 cflags: [ // Sigh.
138 "-D_LARGEFILE64_SOURCE",
139 "-D_GNU_SOURCE",
140 "-DLINUX",
141 "-D__GLIBC__",
142 ],
143 },
Victor Change05511a2018-11-26 17:26:39 +0000144 android: {
Victor Chang8f37b142019-10-04 17:15:18 +0100145 shared_libs: [
vichangf52da6d2019-10-08 10:36:13 +0000146 "libdl_android",
Victor Chang8f37b142019-10-04 17:15:18 +0100147 ],
148 },
Colin Cross09975c32017-08-29 15:01:05 -0700149 },
150
151 notice: "ojluni/NOTICE",
152}
153
154cc_library_shared {
155 name: "libopenjdk",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100156 visibility: [
157 "//art/build/apex",
158 ],
Jiyong Parkb916cac2019-12-19 02:12:09 +0000159 apex_available: [
Martin Stjernholmfe8feb62020-10-12 15:11:14 +0100160 "com.android.art",
Jiyong Parkb916cac2019-12-19 02:12:09 +0000161 "com.android.art.debug",
162 ],
Colin Cross09975c32017-08-29 15:01:05 -0700163 defaults: ["libopenjdk_native_defaults"],
164 shared_libs: [
165 "libopenjdkjvm",
166 ],
167}
168
169// Debug version of libopenjdk. Depends on libopenjdkjvmd.
170cc_library_shared {
171 name: "libopenjdkd",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100172 visibility: [
173 "//art/build/apex",
174 ],
Jiyong Parkb916cac2019-12-19 02:12:09 +0000175 apex_available: [
176 "com.android.art.debug",
177 ],
Colin Cross09975c32017-08-29 15:01:05 -0700178 defaults: ["libopenjdk_native_defaults"],
179 shared_libs: [
180 "libopenjdkjvmd",
181 ],
182}
183
184// Test JNI library.
185cc_library_shared {
186 name: "libjavacoretests",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100187 visibility: [
Paul Duffin86abe9e2020-01-16 16:55:36 +0000188 "//art/build/sdk",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100189 "//cts/tests/libcore/luni",
190 ],
Colin Cross09975c32017-08-29 15:01:05 -0700191 defaults: ["core_native_default_flags"],
Logan Chien568c0bc2018-02-27 16:03:04 +0800192 host_supported: true,
Colin Cross09975c32017-08-29 15:01:05 -0700193
194 srcs: [
Tobias Thiererd430cc72017-11-01 14:35:40 +0000195 "luni/src/test/native/libcore_dalvik_system_JniTest.cpp",
Colin Cross09975c32017-08-29 15:01:05 -0700196 "luni/src/test/native/libcore_java_io_FileTest.cpp",
197 "luni/src/test/native/libcore_java_lang_ThreadTest.cpp",
198 "luni/src/test/native/libcore_java_nio_BufferTest.cpp",
Tobias Thiererd430cc72017-11-01 14:35:40 +0000199 "luni/src/test/native/libcore_libcore_util_NativeAllocationRegistryTest.cpp",
Colin Cross09975c32017-08-29 15:01:05 -0700200 ],
Victor Chang67b3fa62020-03-04 18:01:08 +0000201 shared_libs: [
Victor Chang67b3fa62020-03-04 18:01:08 +0000202 "liblog",
Orion Hodson6272f2d2020-04-28 14:25:16 +0100203 "libnativehelper",
Victor Chang67b3fa62020-03-04 18:01:08 +0000204 ],
Colin Cross09975c32017-08-29 15:01:05 -0700205
206 strip: {
207 keep_symbols: true,
208 },
209}
210
211// Set of gtest unit tests.
212cc_test {
213 name: "libjavacore-unit-tests",
214 defaults: ["core_native_default_flags"],
215
216 // Add -fno-builtin so that the compiler doesn't attempt to inline
217 // memcpy calls that are not really aligned.
218 cflags: ["-fno-builtin"],
Orion Hodson73caf182020-09-22 17:42:30 +0100219 srcs: [
220 "luni/src/test/native/libcore_io_Memory_test.cpp",
221 // libcore_io_Memory_test.cpp includes libcore_io_Memory.cpp which
222 // depends on JniConstants.cpp (but these are not used in the tests).
223 "luni/src/main/native/JniConstants.cpp",
224 ],
Colin Cross09975c32017-08-29 15:01:05 -0700225
Orion Hodson73caf182020-09-22 17:42:30 +0100226 shared_libs: [
227 "liblog",
228 "libnativehelper",
229 ],
Colin Cross09975c32017-08-29 15:01:05 -0700230}
231
232// Set of benchmarks for libjavacore functions.
233cc_benchmark {
234 name: "libjavacore-benchmarks",
235 defaults: ["core_native_default_flags"],
236
Orion Hodson73caf182020-09-22 17:42:30 +0100237 srcs: [
238 "luni/src/benchmark/native/libcore_io_Memory_bench.cpp",
239 // libcore_io_Memory_bench.cpp includes libcore_io_Memory.cpp which
240 // depends on JniConstants.cpp (but these are not used in the benchmark).
241 "luni/src/main/native/JniConstants.cpp",
242 ],
Colin Cross09975c32017-08-29 15:01:05 -0700243 test_suites: ["device-tests"],
244
Orion Hodson73caf182020-09-22 17:42:30 +0100245 shared_libs: [
246 "liblog",
247 "libnativehelper",
248 ],
Colin Cross09975c32017-08-29 15:01:05 -0700249}