blob: 5bfb49b04dd46520e39fe023a943c654e5361939 [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 },
36}
37
38cc_defaults {
39 name: "core_native_default_libs",
Orion Hodson15981542020-04-03 06:47:08 +010040 header_libs: ["jni_headers"],
Colin Cross09975c32017-08-29 15:01:05 -070041 shared_libs: [
Vladimir Marko26a4cb82018-06-07 14:57:30 +000042 "libbase",
Colin Cross09975c32017-08-29 15:01:05 -070043 "liblog",
44 "libnativehelper",
45 ],
46}
47
48cc_library_shared {
49 name: "libjavacore",
Paul Duffinc241d6a2019-06-25 15:40:29 +010050 visibility: [
51 "//art/build/apex",
52 ],
Jiyong Parkb916cac2019-12-19 02:12:09 +000053 apex_available: [
Martin Stjernholmfe8feb62020-10-12 15:11:14 +010054 "com.android.art",
Jiyong Parkb916cac2019-12-19 02:12:09 +000055 "com.android.art.debug",
56 ],
Colin Cross09975c32017-08-29 15:01:05 -070057 defaults: [
58 "core_native_default_flags",
59 "core_native_default_libs",
60 ],
61 srcs: [
62 ":luni_native_srcs",
Colin Cross09975c32017-08-29 15:01:05 -070063 ],
Colin Cross09975c32017-08-29 15:01:05 -070064 shared_libs: [
Pete Bentleyc2d71642019-02-22 17:20:03 +000065 "libandroidio",
Vladimir Marko26a4cb82018-06-07 14:57:30 +000066 "libbase",
Colin Cross09975c32017-08-29 15:01:05 -070067 "libcrypto",
Victor Chang4ab33ea2020-09-22 21:45:30 +010068 "libicu",
Colin Cross09975c32017-08-29 15:01:05 -070069 "libexpat",
Colin Cross09975c32017-08-29 15:01:05 -070070 "libnativehelper",
Dan Willemsen82553c72017-09-27 16:22:54 -070071 "libz",
Colin Cross09975c32017-08-29 15:01:05 -070072 ],
73 static_libs: [
74 "libziparchive",
Colin Cross09975c32017-08-29 15:01:05 -070075 ],
Colin Cross09975c32017-08-29 15:01:05 -070076}
77
Pete Bentleyc2d71642019-02-22 17:20:03 +000078cc_library_shared {
79 name: "libandroidio",
Paul Duffinc241d6a2019-06-25 15:40:29 +010080 visibility: [
81 "//art/build/apex",
Paul Duffin8aadfc22020-03-05 08:37:41 +000082 "//art/build/sdk",
Jooyung Han826f28e2019-12-16 23:36:50 +090083 "//external/conscrypt",
Paul Duffinc241d6a2019-06-25 15:40:29 +010084 ],
Jiyong Parkb916cac2019-12-19 02:12:09 +000085 apex_available: [
Martin Stjernholmfe8feb62020-10-12 15:11:14 +010086 "com.android.art",
Jiyong Parkb916cac2019-12-19 02:12:09 +000087 "com.android.art.debug",
Jiyong Park76671312020-01-15 15:49:01 +090088 // TODO(b/147813447) remove this. This is currently due to the 'runtime_libs'
89 // dependency from libjavacrypto in the conscrypt APEX.
90 "com.android.conscrypt",
91 "test_com.android.conscrypt",
Jiyong Parkb916cac2019-12-19 02:12:09 +000092 ],
Pete Bentleyc2d71642019-02-22 17:20:03 +000093 defaults: [
94 "core_native_default_flags",
95 ],
96 shared_libs: [
97 "liblog",
98 ],
99 srcs: [
100 ":libandroidio_srcs",
101 ],
102 stubs: {
103 symbol_file: "libandroidio.map.txt",
104 versions: ["1"],
105 },
106}
107
Colin Cross09975c32017-08-29 15:01:05 -0700108cc_defaults {
109 name: "libopenjdk_native_defaults",
110 defaults: [
111 "core_native_default_flags",
112 "core_native_default_libs",
113 ],
114 srcs: [":libopenjdk_native_srcs"],
Paul Duffind96f57e2019-07-12 16:12:49 +0100115 local_include_dirs: [
116 "luni/src/main/native",
Pete Bentleydfc8ce02019-02-06 10:58:56 +0000117 ],
Colin Cross09975c32017-08-29 15:01:05 -0700118 cflags: [
119 // TODO(narayan): Prune down this list of exclusions once the underlying
120 // issues have been fixed. Most of these are small changes except for
121 // -Wunused-parameter.
122 "-Wno-unused-parameter",
123 "-Wno-unused-variable",
124 "-Wno-parentheses-equality",
125 "-Wno-constant-logical-operand",
126 "-Wno-sometimes-uninitialized",
Colin Cross09975c32017-08-29 15:01:05 -0700127 ],
128
129 shared_libs: [
Pete Bentleyc2d71642019-02-22 17:20:03 +0000130 "libandroidio",
Colin Cross09975c32017-08-29 15:01:05 -0700131 "libcrypto",
Victor Chang4ab33ea2020-09-22 21:45:30 +0100132 "libicu",
Colin Cross09975c32017-08-29 15:01:05 -0700133 "libnativehelper",
Pete Bentleydfc8ce02019-02-06 10:58:56 +0000134 "libz",
Colin Cross09975c32017-08-29 15:01:05 -0700135 ],
136 static_libs: ["libfdlibm"],
137
138 target: {
Dan Willemsen7f7768f2017-10-02 10:41:10 -0700139 linux_glibc: {
Colin Cross09975c32017-08-29 15:01:05 -0700140 cflags: [ // Sigh.
141 "-D_LARGEFILE64_SOURCE",
142 "-D_GNU_SOURCE",
143 "-DLINUX",
144 "-D__GLIBC__",
145 ],
146 },
Victor Change05511a2018-11-26 17:26:39 +0000147 android: {
Victor Chang8f37b142019-10-04 17:15:18 +0100148 shared_libs: [
vichangf52da6d2019-10-08 10:36:13 +0000149 "libdl_android",
Victor Chang8f37b142019-10-04 17:15:18 +0100150 ],
151 },
Colin Cross09975c32017-08-29 15:01:05 -0700152 },
153
154 notice: "ojluni/NOTICE",
155}
156
157cc_library_shared {
158 name: "libopenjdk",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100159 visibility: [
160 "//art/build/apex",
161 ],
Jiyong Parkb916cac2019-12-19 02:12:09 +0000162 apex_available: [
Martin Stjernholmfe8feb62020-10-12 15:11:14 +0100163 "com.android.art",
Jiyong Parkb916cac2019-12-19 02:12:09 +0000164 "com.android.art.debug",
165 ],
Colin Cross09975c32017-08-29 15:01:05 -0700166 defaults: ["libopenjdk_native_defaults"],
167 shared_libs: [
168 "libopenjdkjvm",
169 ],
170}
171
172// Debug version of libopenjdk. Depends on libopenjdkjvmd.
173cc_library_shared {
174 name: "libopenjdkd",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100175 visibility: [
176 "//art/build/apex",
177 ],
Jiyong Parkb916cac2019-12-19 02:12:09 +0000178 apex_available: [
179 "com.android.art.debug",
180 ],
Colin Cross09975c32017-08-29 15:01:05 -0700181 defaults: ["libopenjdk_native_defaults"],
182 shared_libs: [
183 "libopenjdkjvmd",
184 ],
185}
186
187// Test JNI library.
188cc_library_shared {
189 name: "libjavacoretests",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100190 visibility: [
Paul Duffin86abe9e2020-01-16 16:55:36 +0000191 "//art/build/sdk",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100192 "//cts/tests/libcore/luni",
193 ],
Colin Cross09975c32017-08-29 15:01:05 -0700194 defaults: ["core_native_default_flags"],
Logan Chien568c0bc2018-02-27 16:03:04 +0800195 host_supported: true,
Colin Cross09975c32017-08-29 15:01:05 -0700196
197 srcs: [
Tobias Thiererd430cc72017-11-01 14:35:40 +0000198 "luni/src/test/native/libcore_dalvik_system_JniTest.cpp",
Colin Cross09975c32017-08-29 15:01:05 -0700199 "luni/src/test/native/libcore_java_io_FileTest.cpp",
200 "luni/src/test/native/libcore_java_lang_ThreadTest.cpp",
201 "luni/src/test/native/libcore_java_nio_BufferTest.cpp",
Tobias Thiererd430cc72017-11-01 14:35:40 +0000202 "luni/src/test/native/libcore_libcore_util_NativeAllocationRegistryTest.cpp",
Colin Cross09975c32017-08-29 15:01:05 -0700203 ],
Victor Chang67b3fa62020-03-04 18:01:08 +0000204 shared_libs: [
Victor Chang67b3fa62020-03-04 18:01:08 +0000205 "liblog",
Orion Hodson6272f2d2020-04-28 14:25:16 +0100206 "libnativehelper",
Victor Chang67b3fa62020-03-04 18:01:08 +0000207 ],
Colin Cross09975c32017-08-29 15:01:05 -0700208
209 strip: {
210 keep_symbols: true,
211 },
212}
213
214// Set of gtest unit tests.
215cc_test {
216 name: "libjavacore-unit-tests",
217 defaults: ["core_native_default_flags"],
218
219 // Add -fno-builtin so that the compiler doesn't attempt to inline
220 // memcpy calls that are not really aligned.
221 cflags: ["-fno-builtin"],
Orion Hodson73caf182020-09-22 17:42:30 +0100222 srcs: [
223 "luni/src/test/native/libcore_io_Memory_test.cpp",
224 // libcore_io_Memory_test.cpp includes libcore_io_Memory.cpp which
225 // depends on JniConstants.cpp (but these are not used in the tests).
226 "luni/src/main/native/JniConstants.cpp",
227 ],
Colin Cross09975c32017-08-29 15:01:05 -0700228
Orion Hodson73caf182020-09-22 17:42:30 +0100229 shared_libs: [
230 "liblog",
231 "libnativehelper",
232 ],
Colin Cross09975c32017-08-29 15:01:05 -0700233}
234
235// Set of benchmarks for libjavacore functions.
236cc_benchmark {
237 name: "libjavacore-benchmarks",
238 defaults: ["core_native_default_flags"],
239
Orion Hodson73caf182020-09-22 17:42:30 +0100240 srcs: [
241 "luni/src/benchmark/native/libcore_io_Memory_bench.cpp",
242 // libcore_io_Memory_bench.cpp includes libcore_io_Memory.cpp which
243 // depends on JniConstants.cpp (but these are not used in the benchmark).
244 "luni/src/main/native/JniConstants.cpp",
245 ],
Colin Cross09975c32017-08-29 15:01:05 -0700246 test_suites: ["device-tests"],
247
Orion Hodson73caf182020-09-22 17:42:30 +0100248 shared_libs: [
249 "liblog",
250 "libnativehelper",
251 ],
Colin Cross09975c32017-08-29 15:01:05 -0700252}