blob: 9619420c20855fdc14afdf1413e4001133a8b409 [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",
Colin Cross09975c32017-08-29 15:01:05 -070040
41 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: [
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",
69 "libexpat",
70 "libicuuc",
71 "libicui18n",
72 "libnativehelper",
Dan Willemsen82553c72017-09-27 16:22:54 -070073 "libz",
Colin Cross09975c32017-08-29 15:01:05 -070074 ],
75 static_libs: [
Neil Fuller514286e2019-06-12 13:52:19 +010076 "libandroidicuinit",
Colin Cross09975c32017-08-29 15:01:05 -070077 "libziparchive",
Colin Cross09975c32017-08-29 15:01:05 -070078 ],
Victor Change05511a2018-11-26 17:26:39 +000079 target: {
80 android: {
81 cflags: [
82 // -DANDROID_LINK_SHARED_ICU4C to enable access to the full ICU4C.
83 // See external/icu/android_icu4c/include/uconfig_local.h
84 // for more information.
85 "-DANDROID_LINK_SHARED_ICU4C",
86 ],
87 },
88 },
Colin Cross09975c32017-08-29 15:01:05 -070089}
90
Pete Bentleyc2d71642019-02-22 17:20:03 +000091cc_library_shared {
92 name: "libandroidio",
Paul Duffinc241d6a2019-06-25 15:40:29 +010093 visibility: [
94 "//art/build/apex",
Jooyung Han826f28e2019-12-16 23:36:50 +090095 "//external/conscrypt",
Paul Duffinc241d6a2019-06-25 15:40:29 +010096 ],
Jiyong Parkb916cac2019-12-19 02:12:09 +000097 apex_available: [
98 "com.android.art.release",
99 "com.android.art.debug",
Jiyong Park76671312020-01-15 15:49:01 +0900100 // TODO(b/147813447) remove this. This is currently due to the 'runtime_libs'
101 // dependency from libjavacrypto in the conscrypt APEX.
102 "com.android.conscrypt",
103 "test_com.android.conscrypt",
Jiyong Parkb916cac2019-12-19 02:12:09 +0000104 ],
Pete Bentleyc2d71642019-02-22 17:20:03 +0000105 defaults: [
106 "core_native_default_flags",
107 ],
108 shared_libs: [
109 "liblog",
110 ],
111 srcs: [
112 ":libandroidio_srcs",
113 ],
114 stubs: {
115 symbol_file: "libandroidio.map.txt",
116 versions: ["1"],
117 },
118}
119
Colin Cross09975c32017-08-29 15:01:05 -0700120cc_defaults {
121 name: "libopenjdk_native_defaults",
122 defaults: [
123 "core_native_default_flags",
124 "core_native_default_libs",
125 ],
126 srcs: [":libopenjdk_native_srcs"],
Paul Duffind96f57e2019-07-12 16:12:49 +0100127 local_include_dirs: [
128 "luni/src/main/native",
Pete Bentleydfc8ce02019-02-06 10:58:56 +0000129 ],
Colin Cross09975c32017-08-29 15:01:05 -0700130 cflags: [
131 // TODO(narayan): Prune down this list of exclusions once the underlying
132 // issues have been fixed. Most of these are small changes except for
133 // -Wunused-parameter.
134 "-Wno-unused-parameter",
135 "-Wno-unused-variable",
136 "-Wno-parentheses-equality",
137 "-Wno-constant-logical-operand",
138 "-Wno-sometimes-uninitialized",
Colin Cross09975c32017-08-29 15:01:05 -0700139 ],
140
141 shared_libs: [
Pete Bentleyc2d71642019-02-22 17:20:03 +0000142 "libandroidio",
Colin Cross09975c32017-08-29 15:01:05 -0700143 "libcrypto",
vichangf52da6d2019-10-08 10:36:13 +0000144 "libicuuc",
Colin Cross09975c32017-08-29 15:01:05 -0700145 "libnativehelper",
Pete Bentleydfc8ce02019-02-06 10:58:56 +0000146 "libz",
Colin Cross09975c32017-08-29 15:01:05 -0700147 ],
148 static_libs: ["libfdlibm"],
149
150 target: {
Dan Willemsen7f7768f2017-10-02 10:41:10 -0700151 linux_glibc: {
Colin Cross09975c32017-08-29 15:01:05 -0700152 cflags: [ // Sigh.
153 "-D_LARGEFILE64_SOURCE",
154 "-D_GNU_SOURCE",
155 "-DLINUX",
156 "-D__GLIBC__",
157 ],
158 },
Victor Change05511a2018-11-26 17:26:39 +0000159 android: {
vichangf52da6d2019-10-08 10:36:13 +0000160 cflags: [
161 // -DANDROID_LINK_SHARED_ICU4C to enable access to the full ICU4C.
162 // See external/icu/android_icu4c/include/uconfig_local.h
163 // for more information.
164 "-DANDROID_LINK_SHARED_ICU4C",
dimitry4f599042019-03-20 13:25:28 +0100165 ],
Victor Chang8f37b142019-10-04 17:15:18 +0100166 shared_libs: [
vichangf52da6d2019-10-08 10:36:13 +0000167 "libdl_android",
Victor Chang8f37b142019-10-04 17:15:18 +0100168 ],
169 },
Colin Cross09975c32017-08-29 15:01:05 -0700170 },
171
172 notice: "ojluni/NOTICE",
173}
174
175cc_library_shared {
176 name: "libopenjdk",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100177 visibility: [
178 "//art/build/apex",
179 ],
Jiyong Parkb916cac2019-12-19 02:12:09 +0000180 apex_available: [
181 "com.android.art.release",
182 "com.android.art.debug",
183 ],
Colin Cross09975c32017-08-29 15:01:05 -0700184 defaults: ["libopenjdk_native_defaults"],
185 shared_libs: [
186 "libopenjdkjvm",
187 ],
188}
189
190// Debug version of libopenjdk. Depends on libopenjdkjvmd.
191cc_library_shared {
192 name: "libopenjdkd",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100193 visibility: [
194 "//art/build/apex",
195 ],
Jiyong Parkb916cac2019-12-19 02:12:09 +0000196 apex_available: [
197 "com.android.art.debug",
198 ],
Colin Cross09975c32017-08-29 15:01:05 -0700199 defaults: ["libopenjdk_native_defaults"],
200 shared_libs: [
201 "libopenjdkjvmd",
202 ],
203}
204
205// Test JNI library.
206cc_library_shared {
207 name: "libjavacoretests",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100208 visibility: [
Paul Duffin86abe9e2020-01-16 16:55:36 +0000209 "//art/build/sdk",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100210 "//cts/tests/libcore/luni",
211 ],
Colin Cross09975c32017-08-29 15:01:05 -0700212 defaults: ["core_native_default_flags"],
Logan Chien568c0bc2018-02-27 16:03:04 +0800213 host_supported: true,
Colin Cross09975c32017-08-29 15:01:05 -0700214
215 srcs: [
Tobias Thiererd430cc72017-11-01 14:35:40 +0000216 "luni/src/test/native/libcore_dalvik_system_JniTest.cpp",
Colin Cross09975c32017-08-29 15:01:05 -0700217 "luni/src/test/native/libcore_java_io_FileTest.cpp",
218 "luni/src/test/native/libcore_java_lang_ThreadTest.cpp",
219 "luni/src/test/native/libcore_java_nio_BufferTest.cpp",
Tobias Thiererd430cc72017-11-01 14:35:40 +0000220 "luni/src/test/native/libcore_libcore_util_NativeAllocationRegistryTest.cpp",
Colin Cross09975c32017-08-29 15:01:05 -0700221 ],
222 target: {
223 android: {
224 shared_libs: ["libnativehelper_compat_libc++"],
225 },
226 host: {
227 shared_libs: ["libnativehelper"],
228 },
229 },
230
231 strip: {
232 keep_symbols: true,
233 },
234}
235
236// Set of gtest unit tests.
237cc_test {
238 name: "libjavacore-unit-tests",
239 defaults: ["core_native_default_flags"],
240
241 // Add -fno-builtin so that the compiler doesn't attempt to inline
242 // memcpy calls that are not really aligned.
243 cflags: ["-fno-builtin"],
244 srcs: ["luni/src/test/native/libcore_io_Memory_test.cpp"],
245
246 shared_libs: ["libnativehelper"],
247}
248
249// Set of benchmarks for libjavacore functions.
250cc_benchmark {
251 name: "libjavacore-benchmarks",
252 defaults: ["core_native_default_flags"],
253
254 srcs: ["luni/src/benchmark/native/libcore_io_Memory_bench.cpp"],
255 test_suites: ["device-tests"],
256
257 shared_libs: ["libnativehelper"],
258}