blob: 1ac607ad68c5eaac08fdbf0aab3df39f82559641 [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",
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",
Victor Chang4ab33ea2020-09-22 21:45:30 +010069 "libicu",
Colin Cross09975c32017-08-29 15:01:05 -070070 "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: [
Martin Stjernholmfe8feb62020-10-12 15:11:14 +010087 "com.android.art",
Jiyong Parkb916cac2019-12-19 02:12:09 +000088 "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",
Victor Chang4ab33ea2020-09-22 21:45:30 +0100133 "libicu",
Colin Cross09975c32017-08-29 15:01:05 -0700134 "libnativehelper",
Pete Bentleydfc8ce02019-02-06 10:58:56 +0000135 "libz",
Colin Cross09975c32017-08-29 15:01:05 -0700136 ],
137 static_libs: ["libfdlibm"],
138
139 target: {
Dan Willemsen7f7768f2017-10-02 10:41:10 -0700140 linux_glibc: {
Colin Cross09975c32017-08-29 15:01:05 -0700141 cflags: [ // Sigh.
142 "-D_LARGEFILE64_SOURCE",
143 "-D_GNU_SOURCE",
144 "-DLINUX",
145 "-D__GLIBC__",
146 ],
147 },
Victor Change05511a2018-11-26 17:26:39 +0000148 android: {
Victor Chang8f37b142019-10-04 17:15:18 +0100149 shared_libs: [
vichangf52da6d2019-10-08 10:36:13 +0000150 "libdl_android",
Victor Chang8f37b142019-10-04 17:15:18 +0100151 ],
152 },
Colin Cross09975c32017-08-29 15:01:05 -0700153 },
154
155 notice: "ojluni/NOTICE",
156}
157
158cc_library_shared {
159 name: "libopenjdk",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100160 visibility: [
161 "//art/build/apex",
162 ],
Jiyong Parkb916cac2019-12-19 02:12:09 +0000163 apex_available: [
Martin Stjernholmfe8feb62020-10-12 15:11:14 +0100164 "com.android.art",
Jiyong Parkb916cac2019-12-19 02:12:09 +0000165 "com.android.art.debug",
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 ],
Jiyong Parkb916cac2019-12-19 02:12:09 +0000179 apex_available: [
180 "com.android.art.debug",
181 ],
Colin Cross09975c32017-08-29 15:01:05 -0700182 defaults: ["libopenjdk_native_defaults"],
183 shared_libs: [
184 "libopenjdkjvmd",
185 ],
186}
187
188// Test JNI library.
189cc_library_shared {
190 name: "libjavacoretests",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100191 visibility: [
Paul Duffin86abe9e2020-01-16 16:55:36 +0000192 "//art/build/sdk",
Paul Duffinc241d6a2019-06-25 15:40:29 +0100193 "//cts/tests/libcore/luni",
194 ],
Colin Cross09975c32017-08-29 15:01:05 -0700195 defaults: ["core_native_default_flags"],
Logan Chien568c0bc2018-02-27 16:03:04 +0800196 host_supported: true,
Colin Cross09975c32017-08-29 15:01:05 -0700197
198 srcs: [
Tobias Thiererd430cc72017-11-01 14:35:40 +0000199 "luni/src/test/native/libcore_dalvik_system_JniTest.cpp",
Colin Cross09975c32017-08-29 15:01:05 -0700200 "luni/src/test/native/libcore_java_io_FileTest.cpp",
201 "luni/src/test/native/libcore_java_lang_ThreadTest.cpp",
202 "luni/src/test/native/libcore_java_nio_BufferTest.cpp",
Tobias Thiererd430cc72017-11-01 14:35:40 +0000203 "luni/src/test/native/libcore_libcore_util_NativeAllocationRegistryTest.cpp",
Colin Cross09975c32017-08-29 15:01:05 -0700204 ],
Victor Chang67b3fa62020-03-04 18:01:08 +0000205 shared_libs: [
Victor Chang67b3fa62020-03-04 18:01:08 +0000206 "liblog",
Orion Hodson6272f2d2020-04-28 14:25:16 +0100207 "libnativehelper",
Victor Chang67b3fa62020-03-04 18:01:08 +0000208 ],
Colin Cross09975c32017-08-29 15:01:05 -0700209
Victor Chang67b3fa62020-03-04 18:01:08 +0000210 cflags: [
211 // -DANDROID_LINK_SHARED_ICU4C to enable access to the full ICU4C.
212 // See external/icu/android_icu4c/include/uconfig_local.h
213 // for more information.
214 "-DANDROID_LINK_SHARED_ICU4C",
215 ],
216
Colin Cross09975c32017-08-29 15:01:05 -0700217 strip: {
218 keep_symbols: true,
219 },
220}
221
222// Set of gtest unit tests.
223cc_test {
224 name: "libjavacore-unit-tests",
225 defaults: ["core_native_default_flags"],
226
227 // Add -fno-builtin so that the compiler doesn't attempt to inline
228 // memcpy calls that are not really aligned.
229 cflags: ["-fno-builtin"],
Orion Hodson73caf182020-09-22 17:42:30 +0100230 srcs: [
231 "luni/src/test/native/libcore_io_Memory_test.cpp",
232 // libcore_io_Memory_test.cpp includes libcore_io_Memory.cpp which
233 // depends on JniConstants.cpp (but these are not used in the tests).
234 "luni/src/main/native/JniConstants.cpp",
235 ],
Colin Cross09975c32017-08-29 15:01:05 -0700236
Orion Hodson73caf182020-09-22 17:42:30 +0100237 shared_libs: [
238 "liblog",
239 "libnativehelper",
240 ],
Colin Cross09975c32017-08-29 15:01:05 -0700241}
242
243// Set of benchmarks for libjavacore functions.
244cc_benchmark {
245 name: "libjavacore-benchmarks",
246 defaults: ["core_native_default_flags"],
247
Orion Hodson73caf182020-09-22 17:42:30 +0100248 srcs: [
249 "luni/src/benchmark/native/libcore_io_Memory_bench.cpp",
250 // libcore_io_Memory_bench.cpp includes libcore_io_Memory.cpp which
251 // depends on JniConstants.cpp (but these are not used in the benchmark).
252 "luni/src/main/native/JniConstants.cpp",
253 ],
Colin Cross09975c32017-08-29 15:01:05 -0700254 test_suites: ["device-tests"],
255
Orion Hodson73caf182020-09-22 17:42:30 +0100256 shared_libs: [
257 "liblog",
258 "libnativehelper",
259 ],
Colin Cross09975c32017-08-29 15:01:05 -0700260}