diff options
author | Colin Cross <ccross@android.com> | 2017-08-29 15:01:05 -0700 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2017-09-14 12:59:55 -0700 |
commit | 09975c31e0ac06002d8d48757e16647074a0c17f (patch) | |
tree | be7d2f01e129ae50a5d8adbed7badb9cec422d45 /NativeCode.bp | |
parent | d12aa38da99af2cf6dde428111f07c54ed0b7a85 (diff) |
Convert libcore native code to Android.bp
See build/soong/README.md for more information.
Reapplies Ibf27f08e22f544582271bbe04af17cff278bd996 with fix for
CtsLibcoreTestCases.
Test: m -j checkbuild
Test: libjavacore-unit-tests
Test: cts-tradefed run cts -m CtsLibcoreTestCases -t dalvik.system.JniTest
Change-Id: Ia4d7eb3f8ba4b97428606bb60df34dc1256eeaa1
Diffstat (limited to 'NativeCode.bp')
-rw-r--r-- | NativeCode.bp | 210 |
1 files changed, 210 insertions, 0 deletions
diff --git a/NativeCode.bp b/NativeCode.bp new file mode 100644 index 0000000000..fbba1df450 --- /dev/null +++ b/NativeCode.bp @@ -0,0 +1,210 @@ +// 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", + host_supported: true, + local_include_dirs: ["include"], + cflags: [ + "-Wall", + "-Wextra", + "-Werror", + ], + cppflags = ["-DU_USING_ICU_NAMESPACE=0"], + + target: { + darwin: { + enabled: false, + }, + }, +} + +cc_defaults { + name: "core_native_default_libs", + static_libs: [ + "libbase", + "libfdlibm", + ], + + shared_libs: [ + "liblog", + "libnativehelper", + ], +} + +cc_library_shared { + name: "libjavacore", + defaults: [ + "core_native_default_flags", + "core_native_default_libs", + ], + srcs: [ + ":luni_native_srcs", + "dalvik/src/main/native/org_apache_harmony_dalvik_NativeTestTarget.cpp" + ], + + shared_libs: [ + "libcrypto", + "libexpat", + "libicuuc", + "libicui18n", + "libnativehelper", + ], + static_libs: [ + "libziparchive", + "libbase", + ], + target: { + android: { + shared_libs: [ + "libutils", + "libz", + ], + }, + host: { + shared_libs: [ + "libz-host", + ], + }, + }, +} + +cc_defaults { + name: "libopenjdk_native_defaults", + defaults: [ + "core_native_default_flags", + "core_native_default_libs", + ], + srcs: [":libopenjdk_native_srcs"], + 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", + + // TODO(http://b/64362645): remove when upstream replaces readdir_r with readdir. + "-Wno-deprecated-declarations", + ], + + shared_libs: [ + "libcrypto", + "libicuuc", + "libssl", + + "libnativehelper", + ], + static_libs: ["libfdlibm"], + + target: { + linux: { + cflags: [ // Sigh. + "-D_LARGEFILE64_SOURCE", + "-D_GNU_SOURCE", + "-DLINUX", + "-D__GLIBC__", + ], + }, + android: { + shared_libs: ["libz"], + }, + host: { + shared_libs: ["libz-host"], + }, + }, + + notice: "ojluni/NOTICE", +} + +cc_library_shared { + name: "libopenjdk", + defaults: ["libopenjdk_native_defaults"], + shared_libs: [ + "libopenjdkjvm", + ], +} + +// Debug version of libopenjdk. Depends on libopenjdkjvmd. +cc_library_shared { + name: "libopenjdkd", + defaults: ["libopenjdk_native_defaults"], + shared_libs: [ + "libopenjdkjvmd", + ], +} + +// Test JNI library. +cc_library_shared { + name: "libjavacoretests", + defaults: ["core_native_default_flags"], + host_supported:true, + + srcs: [ + "luni/src/test/native/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_util_NativeAllocationRegistryTest.cpp", + ], + target: { + android: { + shared_libs: ["libnativehelper_compat_libc++"], + }, + host: { + shared_libs: ["libnativehelper"], + }, + }, + + strip: { + keep_symbols: true, + }, +} + +// Set of gtest unit tests. +cc_test { + name: "libjavacore-unit-tests", + defaults: ["core_native_default_flags"], + + // 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"], + + shared_libs: ["libnativehelper"], +} + +// Set of benchmarks for libjavacore functions. +cc_benchmark { + name: "libjavacore-benchmarks", + defaults: ["core_native_default_flags"], + + srcs: ["luni/src/benchmark/native/libcore_io_Memory_bench.cpp"], + test_suites: ["device-tests"], + + shared_libs: ["libnativehelper"], +} + +subdirs = [ + "luni/src/main/native", + "ojluni/src/main/native", +] |