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