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