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: { |
Dan Willemsen | 7f7768f | 2017-10-02 10:41:10 -0700 | [diff] [blame] | 138 | linux_glibc: { |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 139 | cflags: [ // Sigh. |
| 140 | "-D_LARGEFILE64_SOURCE", |
| 141 | "-D_GNU_SOURCE", |
| 142 | "-DLINUX", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 143 | ], |
| 144 | }, |
Colin Cross | 74f5a59 | 2021-09-14 10:57:21 -0700 | [diff] [blame] | 145 | glibc: { |
| 146 | cflags: ["-D__GLIBC__"], |
| 147 | }, |
Victor Chang | e05511a | 2018-11-26 17:26:39 +0000 | [diff] [blame] | 148 | android: { |
Victor Chang | 8f37b14 | 2019-10-04 17:15:18 +0100 | [diff] [blame] | 149 | shared_libs: [ |
vichang | f52da6d | 2019-10-08 10:36:13 +0000 | [diff] [blame] | 150 | "libdl_android", |
Victor Chang | 8f37b14 | 2019-10-04 17:15:18 +0100 | [diff] [blame] | 151 | ], |
| 152 | }, |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 153 | }, |
| 154 | |
| 155 | notice: "ojluni/NOTICE", |
| 156 | } |
| 157 | |
| 158 | cc_library_shared { |
| 159 | name: "libopenjdk", |
Paul Duffin | c241d6a | 2019-06-25 15:40:29 +0100 | [diff] [blame] | 160 | visibility: [ |
| 161 | "//art/build/apex", |
| 162 | ], |
Jiyong Park | b916cac | 2019-12-19 02:12:09 +0000 | [diff] [blame] | 163 | apex_available: [ |
Martin Stjernholm | fe8feb6 | 2020-10-12 15:11:14 +0100 | [diff] [blame] | 164 | "com.android.art", |
Jiyong Park | b916cac | 2019-12-19 02:12:09 +0000 | [diff] [blame] | 165 | "com.android.art.debug", |
| 166 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 167 | defaults: ["libopenjdk_native_defaults"], |
| 168 | shared_libs: [ |
| 169 | "libopenjdkjvm", |
| 170 | ], |
| 171 | } |
| 172 | |
| 173 | // Debug version of libopenjdk. Depends on libopenjdkjvmd. |
| 174 | cc_library_shared { |
| 175 | name: "libopenjdkd", |
Paul Duffin | c241d6a | 2019-06-25 15:40:29 +0100 | [diff] [blame] | 176 | visibility: [ |
| 177 | "//art/build/apex", |
| 178 | ], |
Jiyong Park | b916cac | 2019-12-19 02:12:09 +0000 | [diff] [blame] | 179 | apex_available: [ |
| 180 | "com.android.art.debug", |
| 181 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 182 | defaults: ["libopenjdk_native_defaults"], |
| 183 | shared_libs: [ |
| 184 | "libopenjdkjvmd", |
| 185 | ], |
| 186 | } |
| 187 | |
| 188 | // Test JNI library. |
| 189 | cc_library_shared { |
| 190 | name: "libjavacoretests", |
Paul Duffin | c241d6a | 2019-06-25 15:40:29 +0100 | [diff] [blame] | 191 | visibility: [ |
Paul Duffin | 86abe9e | 2020-01-16 16:55:36 +0000 | [diff] [blame] | 192 | "//art/build/sdk", |
Paul Duffin | c241d6a | 2019-06-25 15:40:29 +0100 | [diff] [blame] | 193 | "//cts/tests/libcore/luni", |
| 194 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 195 | defaults: ["core_native_default_flags"], |
Logan Chien | 568c0bc | 2018-02-27 16:03:04 +0800 | [diff] [blame] | 196 | host_supported: true, |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 197 | |
| 198 | srcs: [ |
Tobias Thierer | d430cc7 | 2017-11-01 14:35:40 +0000 | [diff] [blame] | 199 | "luni/src/test/native/libcore_dalvik_system_JniTest.cpp", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 200 | "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", |
Almaz Mingaleev | 0a4a1ed | 2021-09-09 10:57:57 +0100 | [diff] [blame] | 203 | "luni/src/test/native/libcore_java_time_BionicTzdbConsistencyTest.cpp", |
Tobias Thierer | d430cc7 | 2017-11-01 14:35:40 +0000 | [diff] [blame] | 204 | "luni/src/test/native/libcore_libcore_util_NativeAllocationRegistryTest.cpp", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 205 | ], |
Victor Chang | 67b3fa6 | 2020-03-04 18:01:08 +0000 | [diff] [blame] | 206 | shared_libs: [ |
Victor Chang | 67b3fa6 | 2020-03-04 18:01:08 +0000 | [diff] [blame] | 207 | "liblog", |
Orion Hodson | 6272f2d | 2020-04-28 14:25:16 +0100 | [diff] [blame] | 208 | "libnativehelper", |
Victor Chang | 67b3fa6 | 2020-03-04 18:01:08 +0000 | [diff] [blame] | 209 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 210 | } |
| 211 | |
| 212 | // Set of gtest unit tests. |
| 213 | cc_test { |
| 214 | name: "libjavacore-unit-tests", |
| 215 | defaults: ["core_native_default_flags"], |
| 216 | |
Martin Stjernholm | 7abd1e1 | 2021-05-10 20:39:21 +0100 | [diff] [blame] | 217 | // TODO(b/172480617): Fix this source dependency from |
| 218 | // platform_testing/build/tasks/tests/native_test_list.mk. |
| 219 | enabled: true, |
| 220 | |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 221 | // Add -fno-builtin so that the compiler doesn't attempt to inline |
| 222 | // memcpy calls that are not really aligned. |
| 223 | cflags: ["-fno-builtin"], |
Orion Hodson | 73caf18 | 2020-09-22 17:42:30 +0100 | [diff] [blame] | 224 | srcs: [ |
| 225 | "luni/src/test/native/libcore_io_Memory_test.cpp", |
| 226 | // libcore_io_Memory_test.cpp includes libcore_io_Memory.cpp which |
| 227 | // depends on JniConstants.cpp (but these are not used in the tests). |
| 228 | "luni/src/main/native/JniConstants.cpp", |
| 229 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 230 | |
Orion Hodson | 73caf18 | 2020-09-22 17:42:30 +0100 | [diff] [blame] | 231 | shared_libs: [ |
| 232 | "liblog", |
| 233 | "libnativehelper", |
| 234 | ], |
Orion Hodson | 13f17b9 | 2021-05-20 21:46:51 +0100 | [diff] [blame] | 235 | |
| 236 | static_libs: ["libnativehelper_compat_libc++"], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 237 | } |
| 238 | |
| 239 | // Set of benchmarks for libjavacore functions. |
| 240 | cc_benchmark { |
| 241 | name: "libjavacore-benchmarks", |
| 242 | defaults: ["core_native_default_flags"], |
| 243 | |
Martin Stjernholm | 7abd1e1 | 2021-05-10 20:39:21 +0100 | [diff] [blame] | 244 | // TODO(b/172480617): Fix this source dependency from |
| 245 | // platform_testing/build/tasks/tests/native_metric_test_list.mk. |
| 246 | enabled: true, |
| 247 | |
Orion Hodson | 73caf18 | 2020-09-22 17:42:30 +0100 | [diff] [blame] | 248 | 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 Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 254 | test_suites: ["device-tests"], |
| 255 | |
Orion Hodson | 73caf18 | 2020-09-22 17:42:30 +0100 | [diff] [blame] | 256 | shared_libs: [ |
| 257 | "liblog", |
| 258 | "libnativehelper", |
| 259 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 260 | } |