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", |
| 23 | host_supported: true, |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 24 | cflags: [ |
| 25 | "-Wall", |
| 26 | "-Wextra", |
| 27 | "-Werror", |
| 28 | ], |
Logan Chien | 568c0bc | 2018-02-27 16:03:04 +0800 | [diff] [blame] | 29 | cppflags: ["-DU_USING_ICU_NAMESPACE=0"], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 30 | |
| 31 | target: { |
| 32 | darwin: { |
| 33 | enabled: false, |
| 34 | }, |
| 35 | }, |
| 36 | } |
| 37 | |
| 38 | cc_defaults { |
| 39 | name: "core_native_default_libs", |
Orion Hodson | 1598154 | 2020-04-03 06:47:08 +0100 | [diff] [blame] | 40 | header_libs: ["jni_headers"], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 41 | shared_libs: [ |
Vladimir Marko | 26a4cb8 | 2018-06-07 14:57:30 +0000 | [diff] [blame] | 42 | "libbase", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 43 | "liblog", |
| 44 | "libnativehelper", |
| 45 | ], |
| 46 | } |
| 47 | |
| 48 | cc_library_shared { |
| 49 | name: "libjavacore", |
Paul Duffin | c241d6a | 2019-06-25 15:40:29 +0100 | [diff] [blame] | 50 | visibility: [ |
| 51 | "//art/build/apex", |
| 52 | ], |
Jiyong Park | b916cac | 2019-12-19 02:12:09 +0000 | [diff] [blame] | 53 | apex_available: [ |
Martin Stjernholm | fe8feb6 | 2020-10-12 15:11:14 +0100 | [diff] [blame^] | 54 | "com.android.art", |
Jiyong Park | b916cac | 2019-12-19 02:12:09 +0000 | [diff] [blame] | 55 | "com.android.art.debug", |
| 56 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 57 | defaults: [ |
| 58 | "core_native_default_flags", |
| 59 | "core_native_default_libs", |
| 60 | ], |
| 61 | srcs: [ |
| 62 | ":luni_native_srcs", |
Logan Chien | 568c0bc | 2018-02-27 16:03:04 +0800 | [diff] [blame] | 63 | "dalvik/src/main/native/org_apache_harmony_dalvik_NativeTestTarget.cpp", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 64 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 65 | shared_libs: [ |
Pete Bentley | c2d7164 | 2019-02-22 17:20:03 +0000 | [diff] [blame] | 66 | "libandroidio", |
Vladimir Marko | 26a4cb8 | 2018-06-07 14:57:30 +0000 | [diff] [blame] | 67 | "libbase", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 68 | "libcrypto", |
Victor Chang | 4ab33ea | 2020-09-22 21:45:30 +0100 | [diff] [blame] | 69 | "libicu", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 70 | "libexpat", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 71 | "libnativehelper", |
Dan Willemsen | 82553c7 | 2017-09-27 16:22:54 -0700 | [diff] [blame] | 72 | "libz", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 73 | ], |
| 74 | static_libs: [ |
| 75 | "libziparchive", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 76 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 77 | } |
| 78 | |
Pete Bentley | c2d7164 | 2019-02-22 17:20:03 +0000 | [diff] [blame] | 79 | cc_library_shared { |
| 80 | name: "libandroidio", |
Paul Duffin | c241d6a | 2019-06-25 15:40:29 +0100 | [diff] [blame] | 81 | visibility: [ |
| 82 | "//art/build/apex", |
Paul Duffin | 8aadfc2 | 2020-03-05 08:37:41 +0000 | [diff] [blame] | 83 | "//art/build/sdk", |
Jooyung Han | 826f28e | 2019-12-16 23:36:50 +0900 | [diff] [blame] | 84 | "//external/conscrypt", |
Paul Duffin | c241d6a | 2019-06-25 15:40:29 +0100 | [diff] [blame] | 85 | ], |
Jiyong Park | b916cac | 2019-12-19 02:12:09 +0000 | [diff] [blame] | 86 | apex_available: [ |
Martin Stjernholm | fe8feb6 | 2020-10-12 15:11:14 +0100 | [diff] [blame^] | 87 | "com.android.art", |
Jiyong Park | b916cac | 2019-12-19 02:12:09 +0000 | [diff] [blame] | 88 | "com.android.art.debug", |
Jiyong Park | 7667131 | 2020-01-15 15:49:01 +0900 | [diff] [blame] | 89 | // 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 Park | b916cac | 2019-12-19 02:12:09 +0000 | [diff] [blame] | 93 | ], |
Pete Bentley | c2d7164 | 2019-02-22 17:20:03 +0000 | [diff] [blame] | 94 | 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 Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 109 | cc_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 Duffin | d96f57e | 2019-07-12 16:12:49 +0100 | [diff] [blame] | 116 | local_include_dirs: [ |
| 117 | "luni/src/main/native", |
Pete Bentley | dfc8ce0 | 2019-02-06 10:58:56 +0000 | [diff] [blame] | 118 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 119 | 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 Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 128 | ], |
| 129 | |
| 130 | shared_libs: [ |
Pete Bentley | c2d7164 | 2019-02-22 17:20:03 +0000 | [diff] [blame] | 131 | "libandroidio", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 132 | "libcrypto", |
Victor Chang | 4ab33ea | 2020-09-22 21:45:30 +0100 | [diff] [blame] | 133 | "libicu", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 134 | "libnativehelper", |
Pete Bentley | dfc8ce0 | 2019-02-06 10:58:56 +0000 | [diff] [blame] | 135 | "libz", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 136 | ], |
| 137 | static_libs: ["libfdlibm"], |
| 138 | |
| 139 | target: { |
Dan Willemsen | 7f7768f | 2017-10-02 10:41:10 -0700 | [diff] [blame] | 140 | linux_glibc: { |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 141 | cflags: [ // Sigh. |
| 142 | "-D_LARGEFILE64_SOURCE", |
| 143 | "-D_GNU_SOURCE", |
| 144 | "-DLINUX", |
| 145 | "-D__GLIBC__", |
| 146 | ], |
| 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", |
Tobias Thierer | d430cc7 | 2017-11-01 14:35:40 +0000 | [diff] [blame] | 203 | "luni/src/test/native/libcore_libcore_util_NativeAllocationRegistryTest.cpp", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 204 | ], |
Victor Chang | 67b3fa6 | 2020-03-04 18:01:08 +0000 | [diff] [blame] | 205 | shared_libs: [ |
Victor Chang | 67b3fa6 | 2020-03-04 18:01:08 +0000 | [diff] [blame] | 206 | "liblog", |
Orion Hodson | 6272f2d | 2020-04-28 14:25:16 +0100 | [diff] [blame] | 207 | "libnativehelper", |
Victor Chang | 67b3fa6 | 2020-03-04 18:01:08 +0000 | [diff] [blame] | 208 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 209 | |
Victor Chang | 67b3fa6 | 2020-03-04 18:01:08 +0000 | [diff] [blame] | 210 | 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 Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 217 | strip: { |
| 218 | keep_symbols: true, |
| 219 | }, |
| 220 | } |
| 221 | |
| 222 | // Set of gtest unit tests. |
| 223 | cc_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 Hodson | 73caf18 | 2020-09-22 17:42:30 +0100 | [diff] [blame] | 230 | 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 Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 236 | |
Orion Hodson | 73caf18 | 2020-09-22 17:42:30 +0100 | [diff] [blame] | 237 | shared_libs: [ |
| 238 | "liblog", |
| 239 | "libnativehelper", |
| 240 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 241 | } |
| 242 | |
| 243 | // Set of benchmarks for libjavacore functions. |
| 244 | cc_benchmark { |
| 245 | name: "libjavacore-benchmarks", |
| 246 | defaults: ["core_native_default_flags"], |
| 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 | } |