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", |
vichang | f52da6d | 2019-10-08 10:36:13 +0000 | [diff] [blame^] | 131 | "libicuuc", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 132 | "libnativehelper", |
Pete Bentley | dfc8ce0 | 2019-02-06 10:58:56 +0000 | [diff] [blame] | 133 | "libz", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 134 | ], |
| 135 | static_libs: ["libfdlibm"], |
| 136 | |
| 137 | target: { |
Dan Willemsen | 7f7768f | 2017-10-02 10:41:10 -0700 | [diff] [blame] | 138 | linux_glibc: { |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 139 | cflags: [ // Sigh. |
| 140 | "-D_LARGEFILE64_SOURCE", |
| 141 | "-D_GNU_SOURCE", |
| 142 | "-DLINUX", |
| 143 | "-D__GLIBC__", |
| 144 | ], |
| 145 | }, |
Victor Chang | e05511a | 2018-11-26 17:26:39 +0000 | [diff] [blame] | 146 | android: { |
vichang | f52da6d | 2019-10-08 10:36:13 +0000 | [diff] [blame^] | 147 | cflags: [ |
| 148 | // -DANDROID_LINK_SHARED_ICU4C to enable access to the full ICU4C. |
| 149 | // See external/icu/android_icu4c/include/uconfig_local.h |
| 150 | // for more information. |
| 151 | "-DANDROID_LINK_SHARED_ICU4C", |
dimitry | 4f59904 | 2019-03-20 13:25:28 +0100 | [diff] [blame] | 152 | ], |
Victor Chang | 8f37b14 | 2019-10-04 17:15:18 +0100 | [diff] [blame] | 153 | shared_libs: [ |
vichang | f52da6d | 2019-10-08 10:36:13 +0000 | [diff] [blame^] | 154 | "libdl_android", |
Victor Chang | 8f37b14 | 2019-10-04 17:15:18 +0100 | [diff] [blame] | 155 | ], |
| 156 | }, |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 157 | }, |
| 158 | |
| 159 | notice: "ojluni/NOTICE", |
| 160 | } |
| 161 | |
| 162 | cc_library_shared { |
| 163 | name: "libopenjdk", |
Paul Duffin | c241d6a | 2019-06-25 15:40:29 +0100 | [diff] [blame] | 164 | visibility: [ |
| 165 | "//art/build/apex", |
| 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 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 179 | defaults: ["libopenjdk_native_defaults"], |
| 180 | shared_libs: [ |
| 181 | "libopenjdkjvmd", |
| 182 | ], |
| 183 | } |
| 184 | |
| 185 | // Test JNI library. |
| 186 | cc_library_shared { |
| 187 | name: "libjavacoretests", |
Paul Duffin | c241d6a | 2019-06-25 15:40:29 +0100 | [diff] [blame] | 188 | visibility: [ |
| 189 | "//cts/tests/libcore/luni", |
| 190 | ], |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 191 | defaults: ["core_native_default_flags"], |
Logan Chien | 568c0bc | 2018-02-27 16:03:04 +0800 | [diff] [blame] | 192 | host_supported: true, |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 193 | |
| 194 | srcs: [ |
Tobias Thierer | d430cc7 | 2017-11-01 14:35:40 +0000 | [diff] [blame] | 195 | "luni/src/test/native/libcore_dalvik_system_JniTest.cpp", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 196 | "luni/src/test/native/libcore_java_io_FileTest.cpp", |
| 197 | "luni/src/test/native/libcore_java_lang_ThreadTest.cpp", |
| 198 | "luni/src/test/native/libcore_java_nio_BufferTest.cpp", |
Tobias Thierer | d430cc7 | 2017-11-01 14:35:40 +0000 | [diff] [blame] | 199 | "luni/src/test/native/libcore_libcore_util_NativeAllocationRegistryTest.cpp", |
Colin Cross | 09975c3 | 2017-08-29 15:01:05 -0700 | [diff] [blame] | 200 | ], |
| 201 | target: { |
| 202 | android: { |
| 203 | shared_libs: ["libnativehelper_compat_libc++"], |
| 204 | }, |
| 205 | host: { |
| 206 | shared_libs: ["libnativehelper"], |
| 207 | }, |
| 208 | }, |
| 209 | |
| 210 | strip: { |
| 211 | keep_symbols: true, |
| 212 | }, |
| 213 | } |
| 214 | |
| 215 | // Set of gtest unit tests. |
| 216 | cc_test { |
| 217 | name: "libjavacore-unit-tests", |
| 218 | defaults: ["core_native_default_flags"], |
| 219 | |
| 220 | // Add -fno-builtin so that the compiler doesn't attempt to inline |
| 221 | // memcpy calls that are not really aligned. |
| 222 | cflags: ["-fno-builtin"], |
| 223 | srcs: ["luni/src/test/native/libcore_io_Memory_test.cpp"], |
| 224 | |
| 225 | shared_libs: ["libnativehelper"], |
| 226 | } |
| 227 | |
| 228 | // Set of benchmarks for libjavacore functions. |
| 229 | cc_benchmark { |
| 230 | name: "libjavacore-benchmarks", |
| 231 | defaults: ["core_native_default_flags"], |
| 232 | |
| 233 | srcs: ["luni/src/benchmark/native/libcore_io_Memory_bench.cpp"], |
| 234 | test_suites: ["device-tests"], |
| 235 | |
| 236 | shared_libs: ["libnativehelper"], |
| 237 | } |