blob: 0661664aed5e4cacc0af8b036bcbe8c150f5050c [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: [
54 "com.android.art.release",
55 "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",
Logan Chien568c0bc2018-02-27 16:03:04 +080063 "dalvik/src/main/native/org_apache_harmony_dalvik_NativeTestTarget.cpp",
Colin Cross09975c32017-08-29 15:01:05 -070064 ],
Colin Cross09975c32017-08-29 15:01:05 -070065 shared_libs: [
Victor Chang29c53852020-04-03 19:03:29 +010066 "libandroidicu",
Pete Bentleyc2d71642019-02-22 17:20:03 +000067 "libandroidio",
Vladimir Marko26a4cb82018-06-07 14:57:30 +000068 "libbase",
Colin Cross09975c32017-08-29 15:01:05 -070069 "libcrypto",
70 "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: [
87 "com.android.art.release",
88 "com.android.art.debug",
Jiyong Park76671312020-01-15 15:49:01 +090089 // TODO(b/147813447) remove this. This is currently due to the 'runtime_libs'
90 // dependency from libjavacrypto in the conscrypt APEX.
91 "com.android.conscrypt",
92 "test_com.android.conscrypt",
Jiyong Parkb916cac2019-12-19 02:12:09 +000093 ],
Pete Bentleyc2d71642019-02-22 17:20:03 +000094 defaults: [
95 "core_native_default_flags",
96 ],
97 shared_libs: [
98 "liblog",
99 ],
100 srcs: [
101 ":libandroidio_srcs",
102 ],
103 stubs: {
104 symbol_file: "libandroidio.map.txt",
105 versions: ["1"],
106 },
107}
108
Colin Cross09975c32017-08-29 15:01:05 -0700109cc_defaults {
110 name: "libopenjdk_native_defaults",
111 defaults: [
112 "core_native_default_flags",
113 "core_native_default_libs",
114 ],
115 srcs: [":libopenjdk_native_srcs"],
Paul Duffind96f57e2019-07-12 16:12:49 +0100116 local_include_dirs: [
117 "luni/src/main/native",
Pete Bentleydfc8ce02019-02-06 10:58:56 +0000118 ],
Colin Cross09975c32017-08-29 15:01:05 -0700119 cflags: [
120 // TODO(narayan): Prune down this list of exclusions once the underlying
121 // issues have been fixed. Most of these are small changes except for
122 // -Wunused-parameter.
123 "-Wno-unused-parameter",
124 "-Wno-unused-variable",
125 "-Wno-parentheses-equality",
126 "-Wno-constant-logical-operand",
127 "-Wno-sometimes-uninitialized",
Colin Cross09975c32017-08-29 15:01:05 -0700128 ],
129
130 shared_libs: [
Pete Bentleyc2d71642019-02-22 17:20:03 +0000131 "libandroidio",
Colin Cross09975c32017-08-29 15:01:05 -0700132 "libcrypto",
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: [
Victor Changd3e02b92020-03-10 23:35:27 +0000149 "libandroidicu",
vichangf52da6d2019-10-08 10:36:13 +0000150 "libdl_android",
Victor Chang8f37b142019-10-04 17:15:18 +0100151 ],
152 },
Victor Changd3e02b92020-03-10 23:35:27 +0000153 host: {
154 shared_libs: [
155 "libicuuc",
156 ],
157 },
Colin Cross09975c32017-08-29 15:01:05 -0700158 },
159
160 notice: "ojluni/NOTICE",
161}
162
163cc_library_shared {
164 name: "libopenjdk",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100165 visibility: [
166 "//art/build/apex",
167 ],
Jiyong Parkb916cac2019-12-19 02:12:09 +0000168 apex_available: [
169 "com.android.art.release",
170 "com.android.art.debug",
171 ],
Colin Cross09975c32017-08-29 15:01:05 -0700172 defaults: ["libopenjdk_native_defaults"],
173 shared_libs: [
174 "libopenjdkjvm",
175 ],
176}
177
178// Debug version of libopenjdk. Depends on libopenjdkjvmd.
179cc_library_shared {
180 name: "libopenjdkd",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100181 visibility: [
182 "//art/build/apex",
183 ],
Jiyong Parkb916cac2019-12-19 02:12:09 +0000184 apex_available: [
185 "com.android.art.debug",
186 ],
Colin Cross09975c32017-08-29 15:01:05 -0700187 defaults: ["libopenjdk_native_defaults"],
188 shared_libs: [
189 "libopenjdkjvmd",
190 ],
191}
192
193// Test JNI library.
194cc_library_shared {
195 name: "libjavacoretests",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100196 visibility: [
Paul Duffin86abe9e2020-01-16 16:55:36 +0000197 "//art/build/sdk",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100198 "//cts/tests/libcore/luni",
199 ],
Colin Cross09975c32017-08-29 15:01:05 -0700200 defaults: ["core_native_default_flags"],
Logan Chien568c0bc2018-02-27 16:03:04 +0800201 host_supported: true,
Colin Cross09975c32017-08-29 15:01:05 -0700202
203 srcs: [
Tobias Thiererd430cc72017-11-01 14:35:40 +0000204 "luni/src/test/native/libcore_dalvik_system_JniTest.cpp",
Colin Cross09975c32017-08-29 15:01:05 -0700205 "luni/src/test/native/libcore_java_io_FileTest.cpp",
206 "luni/src/test/native/libcore_java_lang_ThreadTest.cpp",
207 "luni/src/test/native/libcore_java_nio_BufferTest.cpp",
Tobias Thiererd430cc72017-11-01 14:35:40 +0000208 "luni/src/test/native/libcore_libcore_util_NativeAllocationRegistryTest.cpp",
Colin Cross09975c32017-08-29 15:01:05 -0700209 ],
Victor Chang67b3fa62020-03-04 18:01:08 +0000210 shared_libs: [
Victor Chang67b3fa62020-03-04 18:01:08 +0000211 "liblog",
Orion Hodson6272f2d2020-04-28 14:25:16 +0100212 "libnativehelper",
Victor Chang67b3fa62020-03-04 18:01:08 +0000213 ],
Colin Cross09975c32017-08-29 15:01:05 -0700214
Victor Chang67b3fa62020-03-04 18:01:08 +0000215 cflags: [
216 // -DANDROID_LINK_SHARED_ICU4C to enable access to the full ICU4C.
217 // See external/icu/android_icu4c/include/uconfig_local.h
218 // for more information.
219 "-DANDROID_LINK_SHARED_ICU4C",
220 ],
221
Colin Cross09975c32017-08-29 15:01:05 -0700222 strip: {
223 keep_symbols: true,
224 },
225}
226
227// Set of gtest unit tests.
228cc_test {
229 name: "libjavacore-unit-tests",
230 defaults: ["core_native_default_flags"],
231
232 // Add -fno-builtin so that the compiler doesn't attempt to inline
233 // memcpy calls that are not really aligned.
234 cflags: ["-fno-builtin"],
235 srcs: ["luni/src/test/native/libcore_io_Memory_test.cpp"],
236
237 shared_libs: ["libnativehelper"],
238}
239
240// Set of benchmarks for libjavacore functions.
241cc_benchmark {
242 name: "libjavacore-benchmarks",
243 defaults: ["core_native_default_flags"],
244
245 srcs: ["luni/src/benchmark/native/libcore_io_Memory_bench.cpp"],
246 test_suites: ["device-tests"],
247
248 shared_libs: ["libnativehelper"],
249}