blob: 2db70196d78309f23549ee289c58c7ff310eef98 [file] [log] [blame]
// Copyright (C) 2007 The Android Open Source Project
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Definitions for building the native code needed for the core library.
//
// Defaults that apply to all of the modules
cc_defaults {
name: "core_native_default_flags",
defaults: ["art_module_source_build_defaults"],
host_supported: true,
cflags: [
"-Wall",
"-Wextra",
"-Werror",
],
cppflags: ["-DU_USING_ICU_NAMESPACE=0"],
target: {
darwin: {
enabled: false,
},
},
min_sdk_version: "S",
}
cc_defaults {
name: "core_native_default_libs",
header_libs: ["jni_headers"],
shared_libs: [
"libbase",
"liblog",
"libnativehelper",
],
static_libs: ["libnativehelper_compat_libc++"],
}
cc_library_shared {
name: "libjavacore",
visibility: [
"//art/build/apex",
"//art/runtime",
],
apex_available: [
"com.android.art",
"com.android.art.debug",
],
defaults: [
"core_native_default_flags",
"core_native_default_libs",
],
srcs: [
":luni_native_srcs",
],
shared_libs: [
"libandroidio",
"libcrypto",
"libicu",
"libexpat",
"libz",
],
static_libs: [
"libziparchive",
],
}
cc_library_shared {
name: "libandroidio",
visibility: [
"//art/build/apex",
"//art/build/sdk",
"//external/conscrypt",
],
apex_available: [
"com.android.art",
"com.android.art.debug",
],
defaults: [
"core_native_default_flags",
],
shared_libs: [
"liblog",
],
srcs: [
":libandroidio_srcs",
],
stubs: {
symbol_file: "libandroidio.map.txt",
versions: ["1"],
},
}
cc_defaults {
name: "libopenjdk_native_defaults",
defaults: [
"core_native_default_flags",
"core_native_default_libs",
],
srcs: [":libopenjdk_native_srcs"],
local_include_dirs: [
"luni/src/main/native",
],
cflags: [
// TODO(narayan): Prune down this list of exclusions once the underlying
// issues have been fixed. Most of these are small changes except for
// -Wunused-parameter.
"-Wno-unused-parameter",
"-Wno-unused-variable",
"-Wno-parentheses-equality",
"-Wno-constant-logical-operand",
"-Wno-sometimes-uninitialized",
],
shared_libs: [
"libandroidio",
"libcrypto",
"libicu",
"libz",
],
static_libs: [
"libfdlibm",
],
target: {
musl: {
cflags: [
// Sigh.
"-D_LARGEFILE64_SOURCE",
"-D_GNU_SOURCE",
"-DLINUX",
],
},
glibc: {
cflags: [
"-D__GLIBC__",
// Sigh.
"-D_LARGEFILE64_SOURCE",
"-D_GNU_SOURCE",
"-DLINUX",
],
},
android: {
shared_libs: [
"libdl_android",
],
},
},
notice: "ojluni/NOTICE",
}
cc_library_shared {
name: "libopenjdk",
visibility: [
"//art/build/apex",
],
apex_available: [
"com.android.art",
"com.android.art.debug",
],
defaults: ["libopenjdk_native_defaults"],
shared_libs: [
"libopenjdkjvm",
],
}
// Debug version of libopenjdk. Depends on libopenjdkjvmd.
cc_library_shared {
name: "libopenjdkd",
visibility: [
"//art/build/apex",
],
apex_available: [
"com.android.art.debug",
],
defaults: ["libopenjdk_native_defaults"],
shared_libs: [
"libopenjdkjvmd",
],
}
// Test JNI library.
cc_library_shared {
name: "libjavacoretests",
visibility: [
"//art/build/sdk",
"//cts/tests/libcore/luni",
],
defaults: ["core_native_default_flags"],
host_supported: true,
srcs: [
"luni/src/test/native/libcore_dalvik_system_JniTest.cpp",
"luni/src/test/native/libcore_java_io_FileTest.cpp",
"luni/src/test/native/libcore_java_lang_ThreadTest.cpp",
"luni/src/test/native/libcore_java_nio_BufferTest.cpp",
"luni/src/test/native/libcore_java_time_BionicTzdbConsistencyTest.cpp",
"luni/src/test/native/libcore_libcore_util_NativeAllocationRegistryTest.cpp",
],
shared_libs: [
"liblog",
"libnativehelper",
],
}
// Set of gtest unit tests.
cc_test {
name: "libjavacore-unit-tests",
defaults: ["core_native_default_flags"],
// TODO(b/172480617): Fix this source dependency from
// platform_testing/build/tasks/tests/native_test_list.mk.
enabled: true,
// Add -fno-builtin so that the compiler doesn't attempt to inline
// memcpy calls that are not really aligned.
cflags: ["-fno-builtin"],
srcs: [
"luni/src/test/native/libcore_io_Memory_test.cpp",
// libcore_io_Memory_test.cpp includes libcore_io_Memory.cpp which
// depends on JniConstants.cpp (but these are not used in the tests).
"luni/src/main/native/JniConstants.cpp",
],
shared_libs: [
"liblog",
"libnativehelper",
],
static_libs: ["libnativehelper_compat_libc++"],
}
// Set of benchmarks for libjavacore functions.
cc_benchmark {
name: "libjavacore-benchmarks",
defaults: ["core_native_default_flags"],
// TODO(b/172480617): Fix this source dependency from
// platform_testing/build/tasks/tests/native_metric_test_list.mk.
enabled: true,
srcs: [
"luni/src/benchmark/native/libcore_io_Memory_bench.cpp",
// libcore_io_Memory_bench.cpp includes libcore_io_Memory.cpp which
// depends on JniConstants.cpp (but these are not used in the benchmark).
"luni/src/main/native/JniConstants.cpp",
],
test_suites: ["device-tests"],
shared_libs: [
"liblog",
"libnativehelper",
],
}