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 21cc_defaults { 22 name: "core_native_default_flags", 23 defaults: ["art_module_source_build_defaults"], 24 host_supported: true, 25 cflags: [ 26 "-Wall", 27 "-Wextra", 28 "-Werror", 29 ], 30 cppflags: ["-DU_USING_ICU_NAMESPACE=0"], 31 32 target: { 33 darwin: { 34 enabled: false, 35 }, 36 }, 37 min_sdk_version: "S", 38} 39 40cc_defaults { 41 name: "core_native_default_libs", 42 header_libs: ["jni_headers"], 43 shared_libs: [ 44 "libbase", 45 "liblog", 46 "libnativehelper", 47 ], 48 static_libs: ["libnativehelper_compat_libc++"], 49} 50 51cc_library_shared { 52 name: "libjavacore", 53 visibility: [ 54 "//art/build/apex", 55 "//art/runtime", 56 ], 57 apex_available: [ 58 "com.android.art", 59 "com.android.art.debug", 60 ], 61 defaults: [ 62 "core_native_default_flags", 63 "core_native_default_libs", 64 ], 65 srcs: [ 66 ":luni_native_srcs", 67 ], 68 shared_libs: [ 69 "libandroidio", 70 "libcrypto", 71 "libicu", 72 "libexpat", 73 "libz", 74 ], 75 static_libs: [ 76 "libziparchive", 77 ], 78} 79 80cc_library_shared { 81 name: "libandroidio", 82 visibility: [ 83 "//art/build/apex", 84 "//art/build/sdk", 85 "//external/conscrypt", 86 ], 87 apex_available: [ 88 "com.android.art", 89 "com.android.art.debug", 90 ], 91 defaults: [ 92 "core_native_default_flags", 93 ], 94 shared_libs: [ 95 "liblog", 96 ], 97 srcs: [ 98 ":libandroidio_srcs", 99 ], 100 stubs: { 101 symbol_file: "libandroidio.map.txt", 102 versions: ["1"], 103 }, 104} 105 106cc_defaults { 107 name: "libopenjdk_native_defaults", 108 defaults: [ 109 "core_native_default_flags", 110 "core_native_default_libs", 111 ], 112 srcs: [":libopenjdk_native_srcs"], 113 local_include_dirs: [ 114 "luni/src/main/native", 115 ], 116 cflags: [ 117 // TODO(narayan): Prune down this list of exclusions once the underlying 118 // issues have been fixed. Most of these are small changes except for 119 // -Wunused-parameter. 120 "-Wno-unused-parameter", 121 "-Wno-unused-variable", 122 "-Wno-parentheses-equality", 123 "-Wno-constant-logical-operand", 124 "-Wno-sometimes-uninitialized", 125 ], 126 127 shared_libs: [ 128 "libandroidio", 129 "libcrypto", 130 "libicu", 131 "libz", 132 ], 133 static_libs: [ 134 "libfdlibm", 135 ], 136 137 target: { 138 linux_glibc: { 139 cflags: [ // Sigh. 140 "-D_LARGEFILE64_SOURCE", 141 "-D_GNU_SOURCE", 142 "-DLINUX", 143 "-D__GLIBC__", 144 ], 145 }, 146 android: { 147 shared_libs: [ 148 "libdl_android", 149 ], 150 }, 151 }, 152 153 notice: "ojluni/NOTICE", 154} 155 156cc_library_shared { 157 name: "libopenjdk", 158 visibility: [ 159 "//art/build/apex", 160 ], 161 apex_available: [ 162 "com.android.art", 163 "com.android.art.debug", 164 ], 165 defaults: ["libopenjdk_native_defaults"], 166 shared_libs: [ 167 "libopenjdkjvm", 168 ], 169} 170 171// Debug version of libopenjdk. Depends on libopenjdkjvmd. 172cc_library_shared { 173 name: "libopenjdkd", 174 visibility: [ 175 "//art/build/apex", 176 ], 177 apex_available: [ 178 "com.android.art.debug", 179 ], 180 defaults: ["libopenjdk_native_defaults"], 181 shared_libs: [ 182 "libopenjdkjvmd", 183 ], 184} 185 186// Test JNI library. 187cc_library_shared { 188 name: "libjavacoretests", 189 visibility: [ 190 "//art/build/sdk", 191 "//cts/tests/libcore/luni", 192 ], 193 defaults: ["core_native_default_flags"], 194 host_supported: true, 195 196 srcs: [ 197 "luni/src/test/native/libcore_dalvik_system_JniTest.cpp", 198 "luni/src/test/native/libcore_java_io_FileTest.cpp", 199 "luni/src/test/native/libcore_java_lang_ThreadTest.cpp", 200 "luni/src/test/native/libcore_java_nio_BufferTest.cpp", 201 "luni/src/test/native/libcore_libcore_util_NativeAllocationRegistryTest.cpp", 202 ], 203 shared_libs: [ 204 "liblog", 205 "libnativehelper", 206 ], 207 208 strip: { 209 keep_symbols: true, 210 }, 211} 212 213// Set of gtest unit tests. 214cc_test { 215 name: "libjavacore-unit-tests", 216 defaults: ["core_native_default_flags"], 217 218 // TODO(b/172480617): Fix this source dependency from 219 // platform_testing/build/tasks/tests/native_test_list.mk. 220 enabled: true, 221 222 // Add -fno-builtin so that the compiler doesn't attempt to inline 223 // memcpy calls that are not really aligned. 224 cflags: ["-fno-builtin"], 225 srcs: [ 226 "luni/src/test/native/libcore_io_Memory_test.cpp", 227 // libcore_io_Memory_test.cpp includes libcore_io_Memory.cpp which 228 // depends on JniConstants.cpp (but these are not used in the tests). 229 "luni/src/main/native/JniConstants.cpp", 230 ], 231 232 shared_libs: [ 233 "liblog", 234 "libnativehelper", 235 ], 236 237 static_libs: ["libnativehelper_compat_libc++"], 238} 239 240// Set of benchmarks for libjavacore functions. 241cc_benchmark { 242 name: "libjavacore-benchmarks", 243 defaults: ["core_native_default_flags"], 244 245 // TODO(b/172480617): Fix this source dependency from 246 // platform_testing/build/tasks/tests/native_metric_test_list.mk. 247 enabled: true, 248 249 srcs: [ 250 "luni/src/benchmark/native/libcore_io_Memory_bench.cpp", 251 // libcore_io_Memory_bench.cpp includes libcore_io_Memory.cpp which 252 // depends on JniConstants.cpp (but these are not used in the benchmark). 253 "luni/src/main/native/JniConstants.cpp", 254 ], 255 test_suites: ["device-tests"], 256 257 shared_libs: [ 258 "liblog", 259 "libnativehelper", 260 ], 261} 262