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 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 53 | defaults: [ |
| 54 | "core_native_default_flags", |
| 55 | "core_native_default_libs", |
| 56 | ], |
| 57 | srcs: [ |
| 58 | ":luni_native_srcs", |
Logan Chien | 568c0bc | 2018-02-27 16:03:04 +0800 | [diff] [blame] | 59 | "dalvik/src/main/native/org_apache_harmony_dalvik_NativeTestTarget.cpp", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 60 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 61 | shared_libs: [ |
Pete Bentley | c2d7164 | 2019-02-22 17:20:03 +0000 | [diff] [blame] | 62 | "libandroidio", |
Vladimir Marko | 26a4cb8 | 2018-06-07 14:57:30 +0000 | [diff] [blame] | 63 | "libbase", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 64 | "libcrypto", |
| 65 | "libexpat", |
| 66 | "libicuuc", |
| 67 | "libicui18n", |
| 68 | "libnativehelper", |
Dan Willemsen | 82553c7 | 2017-09-27 16:22:54 -0700 | [diff] [blame] | 69 | "libz", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 70 | ], |
| 71 | static_libs: [ |
Neil Fuller | 514286e | 2019-06-12 13:52:19 +0100 | [diff] [blame] | 72 | "libandroidicuinit", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 73 | "libziparchive", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 74 | ], |
Victor Chang | e05511a | 2018-11-26 17:26:39 +0000 | [diff] [blame] | 75 | target: { |
| 76 | android: { |
| 77 | cflags: [ |
| 78 | // -DANDROID_LINK_SHARED_ICU4C to enable access to the full ICU4C. |
| 79 | // See external/icu/android_icu4c/include/uconfig_local.h |
| 80 | // for more information. |
| 81 | "-DANDROID_LINK_SHARED_ICU4C", |
| 82 | ], |
| 83 | }, |
| 84 | }, |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 85 | } |
| 86 | |
Pete Bentley | c2d7164 | 2019-02-22 17:20:03 +0000 | [diff] [blame] | 87 | cc_library_shared { |
| 88 | name: "libandroidio", |
Paul Duffin | c241d6a | 2019-06-25 15:40:29 +0100 | [diff] [blame] | 89 | visibility: [ |
| 90 | "//art/build/apex", |
| 91 | ], |
Pete Bentley | c2d7164 | 2019-02-22 17:20:03 +0000 | [diff] [blame] | 92 | defaults: [ |
| 93 | "core_native_default_flags", |
| 94 | ], |
| 95 | shared_libs: [ |
| 96 | "liblog", |
| 97 | ], |
| 98 | srcs: [ |
| 99 | ":libandroidio_srcs", |
| 100 | ], |
| 101 | stubs: { |
| 102 | symbol_file: "libandroidio.map.txt", |
| 103 | versions: ["1"], |
| 104 | }, |
| 105 | } |
| 106 | |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 107 | cc_defaults { |
| 108 | name: "libopenjdk_native_defaults", |
| 109 | defaults: [ |
| 110 | "core_native_default_flags", |
| 111 | "core_native_default_libs", |
| 112 | ], |
| 113 | srcs: [":libopenjdk_native_srcs"], |
Paul Duffin | d96f57e | 2019-07-12 16:12:49 +0100 | [diff] [blame] | 114 | local_include_dirs: [ |
| 115 | "luni/src/main/native", |
Pete Bentley | dfc8ce0 | 2019-02-06 10:58:56 +0000 | [diff] [blame] | 116 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 117 | cflags: [ |
| 118 | // TODO(narayan): Prune down this list of exclusions once the underlying |
| 119 | // issues have been fixed. Most of these are small changes except for |
| 120 | // -Wunused-parameter. |
| 121 | "-Wno-unused-parameter", |
| 122 | "-Wno-unused-variable", |
| 123 | "-Wno-parentheses-equality", |
| 124 | "-Wno-constant-logical-operand", |
| 125 | "-Wno-sometimes-uninitialized", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 126 | ], |
| 127 | |
| 128 | shared_libs: [ |
Pete Bentley | c2d7164 | 2019-02-22 17:20:03 +0000 | [diff] [blame] | 129 | "libandroidio", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 130 | "libcrypto", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 131 | "libnativehelper", |
Pete Bentley | dfc8ce0 | 2019-02-06 10:58:56 +0000 | [diff] [blame] | 132 | "libz", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 133 | ], |
| 134 | static_libs: ["libfdlibm"], |
| 135 | |
| 136 | target: { |
Dan Willemsen | 7f7768f | 2017-10-02 10:41:10 -0700 | [diff] [blame] | 137 | linux_glibc: { |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 138 | cflags: [ // Sigh. |
| 139 | "-D_LARGEFILE64_SOURCE", |
| 140 | "-D_GNU_SOURCE", |
| 141 | "-DLINUX", |
| 142 | "-D__GLIBC__", |
| 143 | ], |
| 144 | }, |
Victor Chang | e05511a | 2018-11-26 17:26:39 +0000 | [diff] [blame] | 145 | android: { |
dimitry | 4f59904 | 2019-03-20 13:25:28 +0100 | [diff] [blame] | 146 | shared_libs: [ |
Victor Chang | 8f37b14 | 2019-10-04 17:15:18 +0100 | [diff] [blame^] | 147 | "libandroidicu", |
dimitry | 4f59904 | 2019-03-20 13:25:28 +0100 | [diff] [blame] | 148 | "libdl_android", |
| 149 | ], |
Victor Chang | e05511a | 2018-11-26 17:26:39 +0000 | [diff] [blame] | 150 | }, |
Victor Chang | 8f37b14 | 2019-10-04 17:15:18 +0100 | [diff] [blame^] | 151 | host: { |
| 152 | shared_libs: [ |
| 153 | "libicuuc", |
| 154 | ], |
| 155 | }, |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 156 | }, |
| 157 | |
| 158 | notice: "ojluni/NOTICE", |
| 159 | } |
| 160 | |
| 161 | cc_library_shared { |
| 162 | name: "libopenjdk", |
Paul Duffin | c241d6a | 2019-06-25 15:40:29 +0100 | [diff] [blame] | 163 | visibility: [ |
| 164 | "//art/build/apex", |
| 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 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 178 | defaults: ["libopenjdk_native_defaults"], |
| 179 | shared_libs: [ |
| 180 | "libopenjdkjvmd", |
| 181 | ], |
| 182 | } |
| 183 | |
| 184 | // Test JNI library. |
| 185 | cc_library_shared { |
| 186 | name: "libjavacoretests", |
Paul Duffin | c241d6a | 2019-06-25 15:40:29 +0100 | [diff] [blame] | 187 | visibility: [ |
| 188 | "//cts/tests/libcore/luni", |
| 189 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 190 | defaults: ["core_native_default_flags"], |
Logan Chien | 568c0bc | 2018-02-27 16:03:04 +0800 | [diff] [blame] | 191 | host_supported: true, |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 192 | |
| 193 | srcs: [ |
Tobias Thierer | d430cc7 | 2017-11-01 14:35:40 +0000 | [diff] [blame] | 194 | "luni/src/test/native/libcore_dalvik_system_JniTest.cpp", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 195 | "luni/src/test/native/libcore_java_io_FileTest.cpp", |
| 196 | "luni/src/test/native/libcore_java_lang_ThreadTest.cpp", |
| 197 | "luni/src/test/native/libcore_java_nio_BufferTest.cpp", |
Tobias Thierer | d430cc7 | 2017-11-01 14:35:40 +0000 | [diff] [blame] | 198 | "luni/src/test/native/libcore_libcore_util_NativeAllocationRegistryTest.cpp", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 199 | ], |
| 200 | target: { |
| 201 | android: { |
| 202 | shared_libs: ["libnativehelper_compat_libc++"], |
| 203 | }, |
| 204 | host: { |
| 205 | shared_libs: ["libnativehelper"], |
| 206 | }, |
| 207 | }, |
| 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"], |
| 222 | srcs: ["luni/src/test/native/libcore_io_Memory_test.cpp"], |
| 223 | |
| 224 | shared_libs: ["libnativehelper"], |
| 225 | } |
| 226 | |
| 227 | // Set of benchmarks for libjavacore functions. |
| 228 | cc_benchmark { |
| 229 | name: "libjavacore-benchmarks", |
| 230 | defaults: ["core_native_default_flags"], |
| 231 | |
| 232 | srcs: ["luni/src/benchmark/native/libcore_io_Memory_bench.cpp"], |
| 233 | test_suites: ["device-tests"], |
| 234 | |
| 235 | shared_libs: ["libnativehelper"], |
| 236 | } |