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