Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 1 | // 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 | |
| 21 | cc_defaults { |
| 22 | name: "core_native_default_flags", |
Martin Stjernholm | 7abd1e1 | 2021-05-10 20:39:21 +0100 | [diff] [blame] | 23 | defaults: ["art_module_source_build_defaults"], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 24 | host_supported: true, |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 25 | cflags: [ |
| 26 | "-Wall", |
| 27 | "-Wextra", |
| 28 | "-Werror", |
| 29 | ], |
Logan Chien | 568c0bc | 2018-02-27 16:03:04 +0800 | [diff] [blame] | 30 | cppflags: ["-DU_USING_ICU_NAMESPACE=0"], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 31 | |
| 32 | target: { |
| 33 | darwin: { |
| 34 | enabled: false, |
| 35 | }, |
| 36 | }, |
Nicolas Geoffray | 83f4730 | 2021-03-03 22:00:47 +0000 | [diff] [blame] | 37 | min_sdk_version: "S", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 38 | } |
| 39 | |
| 40 | cc_defaults { |
| 41 | name: "core_native_default_libs", |
Orion Hodson | 1598154 | 2020-04-03 06:47:08 +0100 | [diff] [blame] | 42 | header_libs: ["jni_headers"], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 43 | shared_libs: [ |
Vladimir Marko | 26a4cb8 | 2018-06-07 14:57:30 +0000 | [diff] [blame] | 44 | "libbase", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 45 | "liblog", |
| 46 | "libnativehelper", |
| 47 | ], |
Orion Hodson | 13f17b9 | 2021-05-20 21:46:51 +0100 | [diff] [blame] | 48 | static_libs: ["libnativehelper_compat_libc++"], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 49 | } |
| 50 | |
| 51 | cc_library_shared { |
| 52 | name: "libjavacore", |
Paul Duffin | c241d6a | 2019-06-25 15:40:29 +0100 | [diff] [blame] | 53 | visibility: [ |
| 54 | "//art/build/apex", |
Martin Stjernholm | 03033cd | 2021-06-22 13:32:00 +0100 | [diff] [blame] | 55 | "//art/runtime", |
Paul Duffin | c241d6a | 2019-06-25 15:40:29 +0100 | [diff] [blame] | 56 | ], |
Jiyong Park | b916cac | 2019-12-19 02:12:09 +0000 | [diff] [blame] | 57 | apex_available: [ |
Martin Stjernholm | fe8feb6 | 2020-10-12 15:11:14 +0100 | [diff] [blame] | 58 | "com.android.art", |
Jiyong Park | b916cac | 2019-12-19 02:12:09 +0000 | [diff] [blame] | 59 | "com.android.art.debug", |
| 60 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 61 | defaults: [ |
| 62 | "core_native_default_flags", |
| 63 | "core_native_default_libs", |
| 64 | ], |
| 65 | srcs: [ |
| 66 | ":luni_native_srcs", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 67 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 68 | shared_libs: [ |
Pete Bentley | c2d7164 | 2019-02-22 17:20:03 +0000 | [diff] [blame] | 69 | "libandroidio", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 70 | "libcrypto", |
Victor Chang | 4ab33ea | 2020-09-22 21:45:30 +0100 | [diff] [blame] | 71 | "libicu", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 72 | "libexpat", |
Dan Willemsen | 82553c7 | 2017-09-27 16:22:54 -0700 | [diff] [blame] | 73 | "libz", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 74 | ], |
| 75 | static_libs: [ |
| 76 | "libziparchive", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 77 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 78 | } |
| 79 | |
Pete Bentley | c2d7164 | 2019-02-22 17:20:03 +0000 | [diff] [blame] | 80 | cc_library_shared { |
| 81 | name: "libandroidio", |
Paul Duffin | c241d6a | 2019-06-25 15:40:29 +0100 | [diff] [blame] | 82 | visibility: [ |
| 83 | "//art/build/apex", |
Paul Duffin | 8aadfc2 | 2020-03-05 08:37:41 +0000 | [diff] [blame] | 84 | "//art/build/sdk", |
Jooyung Han | 826f28e | 2019-12-16 23:36:50 +0900 | [diff] [blame] | 85 | "//external/conscrypt", |
Paul Duffin | c241d6a | 2019-06-25 15:40:29 +0100 | [diff] [blame] | 86 | ], |
Jiyong Park | b916cac | 2019-12-19 02:12:09 +0000 | [diff] [blame] | 87 | apex_available: [ |
Martin Stjernholm | fe8feb6 | 2020-10-12 15:11:14 +0100 | [diff] [blame] | 88 | "com.android.art", |
Jiyong Park | b916cac | 2019-12-19 02:12:09 +0000 | [diff] [blame] | 89 | "com.android.art.debug", |
| 90 | ], |
Pete Bentley | c2d7164 | 2019-02-22 17:20:03 +0000 | [diff] [blame] | 91 | defaults: [ |
| 92 | "core_native_default_flags", |
| 93 | ], |
| 94 | shared_libs: [ |
| 95 | "liblog", |
| 96 | ], |
| 97 | srcs: [ |
| 98 | ":libandroidio_srcs", |
| 99 | ], |
| 100 | stubs: { |
| 101 | symbol_file: "libandroidio.map.txt", |
| 102 | versions: ["1"], |
| 103 | }, |
| 104 | } |
| 105 | |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 106 | cc_defaults { |
| 107 | name: "libopenjdk_native_defaults", |
| 108 | defaults: [ |
| 109 | "core_native_default_flags", |
| 110 | "core_native_default_libs", |
| 111 | ], |
| 112 | srcs: [":libopenjdk_native_srcs"], |
Paul Duffin | d96f57e | 2019-07-12 16:12:49 +0100 | [diff] [blame] | 113 | local_include_dirs: [ |
| 114 | "luni/src/main/native", |
Pete Bentley | dfc8ce0 | 2019-02-06 10:58:56 +0000 | [diff] [blame] | 115 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 116 | cflags: [ |
| 117 | // TODO(narayan): Prune down this list of exclusions once the underlying |
| 118 | // issues have been fixed. Most of these are small changes except for |
| 119 | // -Wunused-parameter. |
| 120 | "-Wno-unused-parameter", |
| 121 | "-Wno-unused-variable", |
| 122 | "-Wno-parentheses-equality", |
| 123 | "-Wno-constant-logical-operand", |
| 124 | "-Wno-sometimes-uninitialized", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 125 | ], |
| 126 | |
| 127 | shared_libs: [ |
Pete Bentley | c2d7164 | 2019-02-22 17:20:03 +0000 | [diff] [blame] | 128 | "libandroidio", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 129 | "libcrypto", |
Victor Chang | 4ab33ea | 2020-09-22 21:45:30 +0100 | [diff] [blame] | 130 | "libicu", |
Pete Bentley | dfc8ce0 | 2019-02-06 10:58:56 +0000 | [diff] [blame] | 131 | "libz", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 132 | ], |
Orion Hodson | 13f17b9 | 2021-05-20 21:46:51 +0100 | [diff] [blame] | 133 | static_libs: [ |
| 134 | "libfdlibm", |
Orion Hodson | 13f17b9 | 2021-05-20 21:46:51 +0100 | [diff] [blame] | 135 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 136 | |
| 137 | target: { |
Colin Cross | 3fd596f | 2022-03-24 15:45:22 -0700 | [diff] [blame] | 138 | musl: { |
| 139 | cflags: [ |
| 140 | // Sigh. |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 141 | "-D_LARGEFILE64_SOURCE", |
| 142 | "-D_GNU_SOURCE", |
| 143 | "-DLINUX", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 144 | ], |
| 145 | }, |
Colin Cross | 74f5a59 | 2021-09-14 10:57:21 -0700 | [diff] [blame] | 146 | glibc: { |
Colin Cross | 3fd596f | 2022-03-24 15:45:22 -0700 | [diff] [blame] | 147 | cflags: [ |
| 148 | "-D__GLIBC__", |
| 149 | // Sigh. |
| 150 | "-D_LARGEFILE64_SOURCE", |
| 151 | "-D_GNU_SOURCE", |
| 152 | "-DLINUX", |
| 153 | ], |
Colin Cross | 74f5a59 | 2021-09-14 10:57:21 -0700 | [diff] [blame] | 154 | }, |
Victor Chang | e05511a | 2018-11-26 17:26:39 +0000 | [diff] [blame] | 155 | android: { |
Victor Chang | 8f37b14 | 2019-10-04 17:15:18 +0100 | [diff] [blame] | 156 | shared_libs: [ |
vichang | f52da6d | 2019-10-08 10:36:13 +0000 | [diff] [blame] | 157 | "libdl_android", |
Victor Chang | 8f37b14 | 2019-10-04 17:15:18 +0100 | [diff] [blame] | 158 | ], |
| 159 | }, |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 160 | }, |
| 161 | |
| 162 | notice: "ojluni/NOTICE", |
| 163 | } |
| 164 | |
| 165 | cc_library_shared { |
| 166 | name: "libopenjdk", |
Paul Duffin | c241d6a | 2019-06-25 15:40:29 +0100 | [diff] [blame] | 167 | visibility: [ |
| 168 | "//art/build/apex", |
| 169 | ], |
Jiyong Park | b916cac | 2019-12-19 02:12:09 +0000 | [diff] [blame] | 170 | apex_available: [ |
Martin Stjernholm | fe8feb6 | 2020-10-12 15:11:14 +0100 | [diff] [blame] | 171 | "com.android.art", |
Jiyong Park | b916cac | 2019-12-19 02:12:09 +0000 | [diff] [blame] | 172 | "com.android.art.debug", |
| 173 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 174 | defaults: ["libopenjdk_native_defaults"], |
| 175 | shared_libs: [ |
| 176 | "libopenjdkjvm", |
| 177 | ], |
| 178 | } |
| 179 | |
| 180 | // Debug version of libopenjdk. Depends on libopenjdkjvmd. |
| 181 | cc_library_shared { |
| 182 | name: "libopenjdkd", |
Paul Duffin | c241d6a | 2019-06-25 15:40:29 +0100 | [diff] [blame] | 183 | visibility: [ |
| 184 | "//art/build/apex", |
| 185 | ], |
Jiyong Park | b916cac | 2019-12-19 02:12:09 +0000 | [diff] [blame] | 186 | apex_available: [ |
| 187 | "com.android.art.debug", |
| 188 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 189 | defaults: ["libopenjdk_native_defaults"], |
| 190 | shared_libs: [ |
| 191 | "libopenjdkjvmd", |
| 192 | ], |
| 193 | } |
| 194 | |
| 195 | // Test JNI library. |
| 196 | cc_library_shared { |
| 197 | name: "libjavacoretests", |
Paul Duffin | c241d6a | 2019-06-25 15:40:29 +0100 | [diff] [blame] | 198 | visibility: [ |
Paul Duffin | 86abe9e | 2020-01-16 16:55:36 +0000 | [diff] [blame] | 199 | "//art/build/sdk", |
Paul Duffin | c241d6a | 2019-06-25 15:40:29 +0100 | [diff] [blame] | 200 | "//cts/tests/libcore/luni", |
| 201 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 202 | defaults: ["core_native_default_flags"], |
Logan Chien | 568c0bc | 2018-02-27 16:03:04 +0800 | [diff] [blame] | 203 | host_supported: true, |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 204 | |
| 205 | srcs: [ |
Tobias Thierer | d430cc7 | 2017-11-01 14:35:40 +0000 | [diff] [blame] | 206 | "luni/src/test/native/libcore_dalvik_system_JniTest.cpp", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 207 | "luni/src/test/native/libcore_java_io_FileTest.cpp", |
| 208 | "luni/src/test/native/libcore_java_lang_ThreadTest.cpp", |
| 209 | "luni/src/test/native/libcore_java_nio_BufferTest.cpp", |
Almaz Mingaleev | 0a4a1ed | 2021-09-09 10:57:57 +0100 | [diff] [blame] | 210 | "luni/src/test/native/libcore_java_time_BionicTzdbConsistencyTest.cpp", |
Tobias Thierer | d430cc7 | 2017-11-01 14:35:40 +0000 | [diff] [blame] | 211 | "luni/src/test/native/libcore_libcore_util_NativeAllocationRegistryTest.cpp", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 212 | ], |
Victor Chang | 67b3fa6 | 2020-03-04 18:01:08 +0000 | [diff] [blame] | 213 | shared_libs: [ |
Victor Chang | 67b3fa6 | 2020-03-04 18:01:08 +0000 | [diff] [blame] | 214 | "liblog", |
Orion Hodson | 6272f2d | 2020-04-28 14:25:16 +0100 | [diff] [blame] | 215 | "libnativehelper", |
Victor Chang | 67b3fa6 | 2020-03-04 18:01:08 +0000 | [diff] [blame] | 216 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 217 | } |
| 218 | |
| 219 | // Set of gtest unit tests. |
| 220 | cc_test { |
| 221 | name: "libjavacore-unit-tests", |
| 222 | defaults: ["core_native_default_flags"], |
| 223 | |
Martin Stjernholm | 7abd1e1 | 2021-05-10 20:39:21 +0100 | [diff] [blame] | 224 | // TODO(b/172480617): Fix this source dependency from |
| 225 | // platform_testing/build/tasks/tests/native_test_list.mk. |
| 226 | enabled: true, |
| 227 | |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 228 | // Add -fno-builtin so that the compiler doesn't attempt to inline |
| 229 | // memcpy calls that are not really aligned. |
| 230 | cflags: ["-fno-builtin"], |
Orion Hodson | 73caf18 | 2020-09-22 17:42:30 +0100 | [diff] [blame] | 231 | srcs: [ |
| 232 | "luni/src/test/native/libcore_io_Memory_test.cpp", |
| 233 | // libcore_io_Memory_test.cpp includes libcore_io_Memory.cpp which |
| 234 | // depends on JniConstants.cpp (but these are not used in the tests). |
| 235 | "luni/src/main/native/JniConstants.cpp", |
| 236 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 237 | |
Orion Hodson | 73caf18 | 2020-09-22 17:42:30 +0100 | [diff] [blame] | 238 | shared_libs: [ |
| 239 | "liblog", |
| 240 | "libnativehelper", |
| 241 | ], |
Orion Hodson | 13f17b9 | 2021-05-20 21:46:51 +0100 | [diff] [blame] | 242 | |
| 243 | static_libs: ["libnativehelper_compat_libc++"], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 244 | } |
| 245 | |
| 246 | // Set of benchmarks for libjavacore functions. |
| 247 | cc_benchmark { |
| 248 | name: "libjavacore-benchmarks", |
| 249 | defaults: ["core_native_default_flags"], |
| 250 | |
Martin Stjernholm | 7abd1e1 | 2021-05-10 20:39:21 +0100 | [diff] [blame] | 251 | // TODO(b/172480617): Fix this source dependency from |
| 252 | // platform_testing/build/tasks/tests/native_metric_test_list.mk. |
| 253 | enabled: true, |
| 254 | |
Orion Hodson | 73caf18 | 2020-09-22 17:42:30 +0100 | [diff] [blame] | 255 | srcs: [ |
| 256 | "luni/src/benchmark/native/libcore_io_Memory_bench.cpp", |
| 257 | // libcore_io_Memory_bench.cpp includes libcore_io_Memory.cpp which |
| 258 | // depends on JniConstants.cpp (but these are not used in the benchmark). |
| 259 | "luni/src/main/native/JniConstants.cpp", |
| 260 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 261 | test_suites: ["device-tests"], |
| 262 | |
Orion Hodson | 73caf18 | 2020-09-22 17:42:30 +0100 | [diff] [blame] | 263 | shared_libs: [ |
| 264 | "liblog", |
| 265 | "libnativehelper", |
| 266 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 267 | } |