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", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 40 | |
| 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: [ |
| 54 | "com.android.art.release", |
| 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", |
| 69 | "libexpat", |
| 70 | "libicuuc", |
| 71 | "libicui18n", |
| 72 | "libnativehelper", |
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: [ |
Neil Fuller | 514286e | 2019-06-12 13:52:19 +0100 | [diff] [blame] | 76 | "libandroidicuinit", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 77 | "libziparchive", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 78 | ], |
Victor Chang | e05511a | 2018-11-26 17:26:39 +0000 | [diff] [blame] | 79 | target: { |
| 80 | android: { |
| 81 | cflags: [ |
| 82 | // -DANDROID_LINK_SHARED_ICU4C to enable access to the full ICU4C. |
| 83 | // See external/icu/android_icu4c/include/uconfig_local.h |
| 84 | // for more information. |
| 85 | "-DANDROID_LINK_SHARED_ICU4C", |
| 86 | ], |
| 87 | }, |
| 88 | }, |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 89 | } |
| 90 | |
Pete Bentley | c2d7164 | 2019-02-22 17:20:03 +0000 | [diff] [blame] | 91 | cc_library_shared { |
| 92 | name: "libandroidio", |
Paul Duffin | c241d6a | 2019-06-25 15:40:29 +0100 | [diff] [blame] | 93 | visibility: [ |
| 94 | "//art/build/apex", |
Jooyung Han | 826f28e | 2019-12-16 23:36:50 +0900 | [diff] [blame] | 95 | "//external/conscrypt", |
Paul Duffin | c241d6a | 2019-06-25 15:40:29 +0100 | [diff] [blame] | 96 | ], |
Jiyong Park | b916cac | 2019-12-19 02:12:09 +0000 | [diff] [blame] | 97 | apex_available: [ |
| 98 | "com.android.art.release", |
| 99 | "com.android.art.debug", |
| 100 | ], |
Pete Bentley | c2d7164 | 2019-02-22 17:20:03 +0000 | [diff] [blame] | 101 | defaults: [ |
| 102 | "core_native_default_flags", |
| 103 | ], |
| 104 | shared_libs: [ |
| 105 | "liblog", |
| 106 | ], |
| 107 | srcs: [ |
| 108 | ":libandroidio_srcs", |
| 109 | ], |
| 110 | stubs: { |
| 111 | symbol_file: "libandroidio.map.txt", |
| 112 | versions: ["1"], |
| 113 | }, |
| 114 | } |
| 115 | |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 116 | cc_defaults { |
| 117 | name: "libopenjdk_native_defaults", |
| 118 | defaults: [ |
| 119 | "core_native_default_flags", |
| 120 | "core_native_default_libs", |
| 121 | ], |
| 122 | srcs: [":libopenjdk_native_srcs"], |
Paul Duffin | d96f57e | 2019-07-12 16:12:49 +0100 | [diff] [blame] | 123 | local_include_dirs: [ |
| 124 | "luni/src/main/native", |
Pete Bentley | dfc8ce0 | 2019-02-06 10:58:56 +0000 | [diff] [blame] | 125 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 126 | cflags: [ |
| 127 | // TODO(narayan): Prune down this list of exclusions once the underlying |
| 128 | // issues have been fixed. Most of these are small changes except for |
| 129 | // -Wunused-parameter. |
| 130 | "-Wno-unused-parameter", |
| 131 | "-Wno-unused-variable", |
| 132 | "-Wno-parentheses-equality", |
| 133 | "-Wno-constant-logical-operand", |
| 134 | "-Wno-sometimes-uninitialized", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 135 | ], |
| 136 | |
| 137 | shared_libs: [ |
Pete Bentley | c2d7164 | 2019-02-22 17:20:03 +0000 | [diff] [blame] | 138 | "libandroidio", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 139 | "libcrypto", |
vichang | f52da6d | 2019-10-08 10:36:13 +0000 | [diff] [blame] | 140 | "libicuuc", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 141 | "libnativehelper", |
Pete Bentley | dfc8ce0 | 2019-02-06 10:58:56 +0000 | [diff] [blame] | 142 | "libz", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 143 | ], |
| 144 | static_libs: ["libfdlibm"], |
| 145 | |
| 146 | target: { |
Dan Willemsen | 7f7768f | 2017-10-02 10:41:10 -0700 | [diff] [blame] | 147 | linux_glibc: { |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 148 | cflags: [ // Sigh. |
| 149 | "-D_LARGEFILE64_SOURCE", |
| 150 | "-D_GNU_SOURCE", |
| 151 | "-DLINUX", |
| 152 | "-D__GLIBC__", |
| 153 | ], |
| 154 | }, |
Victor Chang | e05511a | 2018-11-26 17:26:39 +0000 | [diff] [blame] | 155 | android: { |
vichang | f52da6d | 2019-10-08 10:36:13 +0000 | [diff] [blame] | 156 | cflags: [ |
| 157 | // -DANDROID_LINK_SHARED_ICU4C to enable access to the full ICU4C. |
| 158 | // See external/icu/android_icu4c/include/uconfig_local.h |
| 159 | // for more information. |
| 160 | "-DANDROID_LINK_SHARED_ICU4C", |
dimitry | 4f59904 | 2019-03-20 13:25:28 +0100 | [diff] [blame] | 161 | ], |
Victor Chang | 8f37b14 | 2019-10-04 17:15:18 +0100 | [diff] [blame] | 162 | shared_libs: [ |
vichang | f52da6d | 2019-10-08 10:36:13 +0000 | [diff] [blame] | 163 | "libdl_android", |
Victor Chang | 8f37b14 | 2019-10-04 17:15:18 +0100 | [diff] [blame] | 164 | ], |
| 165 | }, |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 166 | }, |
| 167 | |
| 168 | notice: "ojluni/NOTICE", |
| 169 | } |
| 170 | |
| 171 | cc_library_shared { |
| 172 | name: "libopenjdk", |
Paul Duffin | c241d6a | 2019-06-25 15:40:29 +0100 | [diff] [blame] | 173 | visibility: [ |
| 174 | "//art/build/apex", |
| 175 | ], |
Jiyong Park | b916cac | 2019-12-19 02:12:09 +0000 | [diff] [blame] | 176 | apex_available: [ |
| 177 | "com.android.art.release", |
| 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 | "libopenjdkjvm", |
| 183 | ], |
| 184 | } |
| 185 | |
| 186 | // Debug version of libopenjdk. Depends on libopenjdkjvmd. |
| 187 | cc_library_shared { |
| 188 | name: "libopenjdkd", |
Paul Duffin | c241d6a | 2019-06-25 15:40:29 +0100 | [diff] [blame] | 189 | visibility: [ |
| 190 | "//art/build/apex", |
| 191 | ], |
Jiyong Park | b916cac | 2019-12-19 02:12:09 +0000 | [diff] [blame] | 192 | apex_available: [ |
| 193 | "com.android.art.debug", |
| 194 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 195 | defaults: ["libopenjdk_native_defaults"], |
| 196 | shared_libs: [ |
| 197 | "libopenjdkjvmd", |
| 198 | ], |
| 199 | } |
| 200 | |
| 201 | // Test JNI library. |
| 202 | cc_library_shared { |
| 203 | name: "libjavacoretests", |
Paul Duffin | c241d6a | 2019-06-25 15:40:29 +0100 | [diff] [blame] | 204 | visibility: [ |
Paul Duffin | 86abe9e | 2020-01-16 16:55:36 +0000 | [diff] [blame^] | 205 | "//art/build/sdk", |
Paul Duffin | c241d6a | 2019-06-25 15:40:29 +0100 | [diff] [blame] | 206 | "//cts/tests/libcore/luni", |
| 207 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 208 | defaults: ["core_native_default_flags"], |
Logan Chien | 568c0bc | 2018-02-27 16:03:04 +0800 | [diff] [blame] | 209 | host_supported: true, |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 210 | |
| 211 | srcs: [ |
Tobias Thierer | d430cc7 | 2017-11-01 14:35:40 +0000 | [diff] [blame] | 212 | "luni/src/test/native/libcore_dalvik_system_JniTest.cpp", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 213 | "luni/src/test/native/libcore_java_io_FileTest.cpp", |
| 214 | "luni/src/test/native/libcore_java_lang_ThreadTest.cpp", |
| 215 | "luni/src/test/native/libcore_java_nio_BufferTest.cpp", |
Tobias Thierer | d430cc7 | 2017-11-01 14:35:40 +0000 | [diff] [blame] | 216 | "luni/src/test/native/libcore_libcore_util_NativeAllocationRegistryTest.cpp", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 217 | ], |
| 218 | target: { |
| 219 | android: { |
| 220 | shared_libs: ["libnativehelper_compat_libc++"], |
| 221 | }, |
| 222 | host: { |
| 223 | shared_libs: ["libnativehelper"], |
| 224 | }, |
| 225 | }, |
| 226 | |
| 227 | strip: { |
| 228 | keep_symbols: true, |
| 229 | }, |
| 230 | } |
| 231 | |
| 232 | // Set of gtest unit tests. |
| 233 | cc_test { |
| 234 | name: "libjavacore-unit-tests", |
| 235 | defaults: ["core_native_default_flags"], |
| 236 | |
| 237 | // Add -fno-builtin so that the compiler doesn't attempt to inline |
| 238 | // memcpy calls that are not really aligned. |
| 239 | cflags: ["-fno-builtin"], |
| 240 | srcs: ["luni/src/test/native/libcore_io_Memory_test.cpp"], |
| 241 | |
| 242 | shared_libs: ["libnativehelper"], |
| 243 | } |
| 244 | |
| 245 | // Set of benchmarks for libjavacore functions. |
| 246 | cc_benchmark { |
| 247 | name: "libjavacore-benchmarks", |
| 248 | defaults: ["core_native_default_flags"], |
| 249 | |
| 250 | srcs: ["luni/src/benchmark/native/libcore_io_Memory_bench.cpp"], |
| 251 | test_suites: ["device-tests"], |
| 252 | |
| 253 | shared_libs: ["libnativehelper"], |
| 254 | } |