blob: a27fa74821ed99016b17ed9b5a401bd54ae22edc [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 ],
Colin Cross09975c32017-08-29 15:01:05 -070053 defaults: [
54 "core_native_default_flags",
55 "core_native_default_libs",
56 ],
57 srcs: [
58 ":luni_native_srcs",
Logan Chien568c0bc2018-02-27 16:03:04 +080059 "dalvik/src/main/native/org_apache_harmony_dalvik_NativeTestTarget.cpp",
Colin Cross09975c32017-08-29 15:01:05 -070060 ],
Colin Cross09975c32017-08-29 15:01:05 -070061 shared_libs: [
Pete Bentleyc2d71642019-02-22 17:20:03 +000062 "libandroidio",
Vladimir Marko26a4cb82018-06-07 14:57:30 +000063 "libbase",
Colin Cross09975c32017-08-29 15:01:05 -070064 "libcrypto",
65 "libexpat",
66 "libicuuc",
67 "libicui18n",
68 "libnativehelper",
Dan Willemsen82553c72017-09-27 16:22:54 -070069 "libz",
Colin Cross09975c32017-08-29 15:01:05 -070070 ],
71 static_libs: [
Neil Fuller514286e2019-06-12 13:52:19 +010072 "libandroidicuinit",
Colin Cross09975c32017-08-29 15:01:05 -070073 "libziparchive",
Colin Cross09975c32017-08-29 15:01:05 -070074 ],
Victor Change05511a2018-11-26 17:26:39 +000075 target: {
76 android: {
77 cflags: [
78 // -DANDROID_LINK_SHARED_ICU4C to enable access to the full ICU4C.
79 // See external/icu/android_icu4c/include/uconfig_local.h
80 // for more information.
81 "-DANDROID_LINK_SHARED_ICU4C",
82 ],
83 },
84 },
Colin Cross09975c32017-08-29 15:01:05 -070085}
86
Pete Bentleyc2d71642019-02-22 17:20:03 +000087cc_library_shared {
88 name: "libandroidio",
Paul Duffinc241d6a2019-06-25 15:40:29 +010089 visibility: [
90 "//art/build/apex",
91 ],
Pete Bentleyc2d71642019-02-22 17:20:03 +000092 defaults: [
93 "core_native_default_flags",
94 ],
95 shared_libs: [
96 "liblog",
97 ],
98 srcs: [
99 ":libandroidio_srcs",
100 ],
101 stubs: {
102 symbol_file: "libandroidio.map.txt",
103 versions: ["1"],
104 },
105}
106
Colin Cross09975c32017-08-29 15:01:05 -0700107cc_defaults {
108 name: "libopenjdk_native_defaults",
109 defaults: [
110 "core_native_default_flags",
111 "core_native_default_libs",
112 ],
113 srcs: [":libopenjdk_native_srcs"],
Paul Duffind96f57e2019-07-12 16:12:49 +0100114 local_include_dirs: [
115 "luni/src/main/native",
Pete Bentleydfc8ce02019-02-06 10:58:56 +0000116 ],
Colin Cross09975c32017-08-29 15:01:05 -0700117 cflags: [
118 // TODO(narayan): Prune down this list of exclusions once the underlying
119 // issues have been fixed. Most of these are small changes except for
120 // -Wunused-parameter.
121 "-Wno-unused-parameter",
122 "-Wno-unused-variable",
123 "-Wno-parentheses-equality",
124 "-Wno-constant-logical-operand",
125 "-Wno-sometimes-uninitialized",
Colin Cross09975c32017-08-29 15:01:05 -0700126 ],
127
128 shared_libs: [
Pete Bentleyc2d71642019-02-22 17:20:03 +0000129 "libandroidio",
Colin Cross09975c32017-08-29 15:01:05 -0700130 "libcrypto",
131 "libicuuc",
Colin Cross09975c32017-08-29 15:01:05 -0700132 "libnativehelper",
Pete Bentleydfc8ce02019-02-06 10:58:56 +0000133 "libz",
Colin Cross09975c32017-08-29 15:01:05 -0700134 ],
135 static_libs: ["libfdlibm"],
136
137 target: {
Dan Willemsen7f7768f2017-10-02 10:41:10 -0700138 linux_glibc: {
Colin Cross09975c32017-08-29 15:01:05 -0700139 cflags: [ // Sigh.
140 "-D_LARGEFILE64_SOURCE",
141 "-D_GNU_SOURCE",
142 "-DLINUX",
143 "-D__GLIBC__",
144 ],
145 },
Victor Change05511a2018-11-26 17:26:39 +0000146 android: {
147 cflags: [
148 // -DANDROID_LINK_SHARED_ICU4C to enable access to the full ICU4C.
149 // See external/icu/android_icu4c/include/uconfig_local.h
150 // for more information.
151 "-DANDROID_LINK_SHARED_ICU4C",
152 ],
dimitry4f599042019-03-20 13:25:28 +0100153 shared_libs: [
154 "libdl_android",
155 ],
Victor Change05511a2018-11-26 17:26:39 +0000156 },
Colin Cross09975c32017-08-29 15:01:05 -0700157 },
158
159 notice: "ojluni/NOTICE",
160}
161
162cc_library_shared {
163 name: "libopenjdk",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100164 visibility: [
165 "//art/build/apex",
166 ],
Colin Cross09975c32017-08-29 15:01:05 -0700167 defaults: ["libopenjdk_native_defaults"],
168 shared_libs: [
169 "libopenjdkjvm",
170 ],
171}
172
173// Debug version of libopenjdk. Depends on libopenjdkjvmd.
174cc_library_shared {
175 name: "libopenjdkd",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100176 visibility: [
177 "//art/build/apex",
178 ],
Colin Cross09975c32017-08-29 15:01:05 -0700179 defaults: ["libopenjdk_native_defaults"],
180 shared_libs: [
181 "libopenjdkjvmd",
182 ],
183}
184
185// Test JNI library.
186cc_library_shared {
187 name: "libjavacoretests",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100188 visibility: [
189 "//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 ],
201 target: {
202 android: {
203 shared_libs: ["libnativehelper_compat_libc++"],
204 },
205 host: {
206 shared_libs: ["libnativehelper"],
207 },
208 },
209
210 strip: {
211 keep_symbols: true,
212 },
213}
214
215// Set of gtest unit tests.
216cc_test {
217 name: "libjavacore-unit-tests",
218 defaults: ["core_native_default_flags"],
219
220 // Add -fno-builtin so that the compiler doesn't attempt to inline
221 // memcpy calls that are not really aligned.
222 cflags: ["-fno-builtin"],
223 srcs: ["luni/src/test/native/libcore_io_Memory_test.cpp"],
224
225 shared_libs: ["libnativehelper"],
226}
227
228// Set of benchmarks for libjavacore functions.
229cc_benchmark {
230 name: "libjavacore-benchmarks",
231 defaults: ["core_native_default_flags"],
232
233 srcs: ["luni/src/benchmark/native/libcore_io_Memory_bench.cpp"],
234 test_suites: ["device-tests"],
235
236 shared_libs: ["libnativehelper"],
237}