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