blob: 25c128b18137166b3af580e0e9a0d1566987b9fb [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",
100 ],
Pete Bentleyc2d71642019-02-22 17:20:03 +0000101 defaults: [
102 "core_native_default_flags",
103 ],
104 shared_libs: [
105 "liblog",
106 ],
107 srcs: [
108 ":libandroidio_srcs",
109 ],
110 stubs: {
111 symbol_file: "libandroidio.map.txt",
112 versions: ["1"],
113 },
114}
115
Colin Cross09975c32017-08-29 15:01:05 -0700116cc_defaults {
117 name: "libopenjdk_native_defaults",
118 defaults: [
119 "core_native_default_flags",
120 "core_native_default_libs",
121 ],
122 srcs: [":libopenjdk_native_srcs"],
Paul Duffind96f57e2019-07-12 16:12:49 +0100123 local_include_dirs: [
124 "luni/src/main/native",
Pete Bentleydfc8ce02019-02-06 10:58:56 +0000125 ],
Colin Cross09975c32017-08-29 15:01:05 -0700126 cflags: [
127 // TODO(narayan): Prune down this list of exclusions once the underlying
128 // issues have been fixed. Most of these are small changes except for
129 // -Wunused-parameter.
130 "-Wno-unused-parameter",
131 "-Wno-unused-variable",
132 "-Wno-parentheses-equality",
133 "-Wno-constant-logical-operand",
134 "-Wno-sometimes-uninitialized",
Colin Cross09975c32017-08-29 15:01:05 -0700135 ],
136
137 shared_libs: [
Pete Bentleyc2d71642019-02-22 17:20:03 +0000138 "libandroidio",
Colin Cross09975c32017-08-29 15:01:05 -0700139 "libcrypto",
vichangf52da6d2019-10-08 10:36:13 +0000140 "libicuuc",
Colin Cross09975c32017-08-29 15:01:05 -0700141 "libnativehelper",
Pete Bentleydfc8ce02019-02-06 10:58:56 +0000142 "libz",
Colin Cross09975c32017-08-29 15:01:05 -0700143 ],
144 static_libs: ["libfdlibm"],
145
146 target: {
Dan Willemsen7f7768f2017-10-02 10:41:10 -0700147 linux_glibc: {
Colin Cross09975c32017-08-29 15:01:05 -0700148 cflags: [ // Sigh.
149 "-D_LARGEFILE64_SOURCE",
150 "-D_GNU_SOURCE",
151 "-DLINUX",
152 "-D__GLIBC__",
153 ],
154 },
Victor Change05511a2018-11-26 17:26:39 +0000155 android: {
vichangf52da6d2019-10-08 10:36:13 +0000156 cflags: [
157 // -DANDROID_LINK_SHARED_ICU4C to enable access to the full ICU4C.
158 // See external/icu/android_icu4c/include/uconfig_local.h
159 // for more information.
160 "-DANDROID_LINK_SHARED_ICU4C",
dimitry4f599042019-03-20 13:25:28 +0100161 ],
Victor Chang8f37b142019-10-04 17:15:18 +0100162 shared_libs: [
vichangf52da6d2019-10-08 10:36:13 +0000163 "libdl_android",
Victor Chang8f37b142019-10-04 17:15:18 +0100164 ],
165 },
Colin Cross09975c32017-08-29 15:01:05 -0700166 },
167
168 notice: "ojluni/NOTICE",
169}
170
171cc_library_shared {
172 name: "libopenjdk",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100173 visibility: [
174 "//art/build/apex",
175 ],
Jiyong Parkb916cac2019-12-19 02:12:09 +0000176 apex_available: [
177 "com.android.art.release",
178 "com.android.art.debug",
179 ],
Colin Cross09975c32017-08-29 15:01:05 -0700180 defaults: ["libopenjdk_native_defaults"],
181 shared_libs: [
182 "libopenjdkjvm",
183 ],
184}
185
186// Debug version of libopenjdk. Depends on libopenjdkjvmd.
187cc_library_shared {
188 name: "libopenjdkd",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100189 visibility: [
190 "//art/build/apex",
191 ],
Jiyong Parkb916cac2019-12-19 02:12:09 +0000192 apex_available: [
193 "com.android.art.debug",
194 ],
Colin Cross09975c32017-08-29 15:01:05 -0700195 defaults: ["libopenjdk_native_defaults"],
196 shared_libs: [
197 "libopenjdkjvmd",
198 ],
199}
200
201// Test JNI library.
202cc_library_shared {
203 name: "libjavacoretests",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100204 visibility: [
205 "//cts/tests/libcore/luni",
206 ],
Colin Cross09975c32017-08-29 15:01:05 -0700207 defaults: ["core_native_default_flags"],
Logan Chien568c0bc2018-02-27 16:03:04 +0800208 host_supported: true,
Colin Cross09975c32017-08-29 15:01:05 -0700209
210 srcs: [
Tobias Thiererd430cc72017-11-01 14:35:40 +0000211 "luni/src/test/native/libcore_dalvik_system_JniTest.cpp",
Colin Cross09975c32017-08-29 15:01:05 -0700212 "luni/src/test/native/libcore_java_io_FileTest.cpp",
213 "luni/src/test/native/libcore_java_lang_ThreadTest.cpp",
214 "luni/src/test/native/libcore_java_nio_BufferTest.cpp",
Tobias Thiererd430cc72017-11-01 14:35:40 +0000215 "luni/src/test/native/libcore_libcore_util_NativeAllocationRegistryTest.cpp",
Colin Cross09975c32017-08-29 15:01:05 -0700216 ],
217 target: {
218 android: {
219 shared_libs: ["libnativehelper_compat_libc++"],
220 },
221 host: {
222 shared_libs: ["libnativehelper"],
223 },
224 },
225
226 strip: {
227 keep_symbols: true,
228 },
229}
230
231// Set of gtest unit tests.
232cc_test {
233 name: "libjavacore-unit-tests",
234 defaults: ["core_native_default_flags"],
235
236 // Add -fno-builtin so that the compiler doesn't attempt to inline
237 // memcpy calls that are not really aligned.
238 cflags: ["-fno-builtin"],
239 srcs: ["luni/src/test/native/libcore_io_Memory_test.cpp"],
240
241 shared_libs: ["libnativehelper"],
242}
243
244// Set of benchmarks for libjavacore functions.
245cc_benchmark {
246 name: "libjavacore-benchmarks",
247 defaults: ["core_native_default_flags"],
248
249 srcs: ["luni/src/benchmark/native/libcore_io_Memory_bench.cpp"],
250 test_suites: ["device-tests"],
251
252 shared_libs: ["libnativehelper"],
253}