blob: 0b9788983a809cb5c6fbb1acd59c72c8f414b9d1 [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 Java library and associated tests.
//
//
// Common definitions for host and target.
//
// libcore is divided into modules.
//
// The structure of each module is:
//
// src/
// main/ # To be shipped on every device.
// java/ # Java source for library code.
// native/ # C++ source for library code.
// resources/ # Support files.
// test/ # Built only on demand, for testing.
// java/ # Java source for tests.
// native/ # C++ source for tests (rare).
// resources/ # Support files.
//
// All subdirectories are optional
// The Java files and their associated resources.
common_core_src_files = [
"dalvik/src/main/java/**/*.java",
"dex/src/main/java/**/*.java",
"json/src/main/java/**/*.java",
"luni/src/main/java/**/*.java",
"xml/src/main/java/**/*.java",
]
core_resource_dirs = [
"dalvik/src/main/java",
"dex/src/main/java",
"json/src/main/java",
"luni/src/main/java",
"xml/src/main/java",
]
test_resource_dirs = [
"dalvik/src/test/java",
"dex/src/test/java",
"dom/src/test/java",
"harmony-tests/src/test/java",
"json/src/test/java",
"jsr166-tests/src/test/java",
"luni/src/test/java",
"support/src/test/java",
"dom/src/test/resources",
"harmony-tests/src/test/resources",
"luni/src/test/resources",
]
test_src_files = [
"dalvik/src/test/java/**/*.java",
"dom/src/test/java/**/*.java",
"harmony-tests/src/test/java/**/*.java",
"json/src/test/java/**/*.java",
"luni/src/test/java/**/*.java",
"xml/src/test/java/**/*.java",
]
// ANDROIDMK TRANSLATION ERROR: unsupported conditional
// ifeq ($(EMMA_INSTRUMENT),true)
// ANDROIDMK TRANSLATION ERROR: unsupported conditional
// ifneq ($(EMMA_INSTRUMENT_STATIC),true)
/*common_core_src_files += call all-java-files-under, ../external/emma/core ../external/emma/pregenerated
core_resource_dirs += [
"../external/emma/core/res",
"../external/emma/pregenerated/res",
]
// ANDROIDMK TRANSLATION ERROR: endif from unsupported contitional
// endif
// ANDROIDMK TRANSLATION ERROR: endif from unsupported contitional
// endif*/
libart_core_src_files = common_core_src_files + ["libart/src/main/**/*.java"]
local_javac_flags = [
"-Xmaxwarns 9999999",
]
//local_javac_flags+=-Xlint:all -Xlint:-serial,-deprecation,-unchecked
//
// ICU4J related rules.
// We compile icu4j along with core-libart because we're implementing parts of core-libart
// in terms of icu4j.
icu4j_root = "../external/icu/icu4j"
icu4j_src_files = [
icu4j_root + "/main/classes/**/*.java",
]
icu4j_exclude_src_files = [
// Filter out bits of ICU4J we don't use yet : the SPIs (which we have limited support for),
// the charset encoders and the transliterators.
icu4j_root + "/main/classes/localespi/**/*.java",
icu4j_root + "/main/classes/charset/**/*.java",
icu4j_root + "/main/classes/translit/**/*.java",
]
// Not all src dirs contain resources, some instead contain other random files
// that should not be included as resources. The ones that should be included
// can be identifed by the fact that they contain particular subdir trees.
//
icu4j_resource_dirs = [
icu4j_root + "/main/classes/*/src",
]
icu4j_exclude_resource_dirs = [
icu4j_root + "/main/classes/localespi/src",
icu4j_root + "/main/classes/charset/src",
icu4j_root + "/main/classes/translit/src",
]
// Definitions to make the core library.
java_library {
srcs: libart_core_src_files + icu4j_src_files,
exclude_srcs: icu4j_exclude_src_files,
java_resource_dirs: core_resource_dirs + icu4j_resource_dirs,
exclude_java_resource_dirs: icu4j_exclude_resource_dirs,
no_standard_libraries: true,
javacflags: local_javac_flags,
dxflags: ["--core-library"],
name: "core-libart",
host_supported: true,
jarjar_rules: "jarjar-rules.txt",
//required: ["tzdata"],
//required: ["tzdata-host"],
}
// ANDROIDMK TRANSLATION ERROR: unsupported conditional
// ifeq ($(LIBCORE_SKIP_TESTS),)
// Make the core-tests library.
// TODO: needs okhttp, bouncycastle, sqlite-jdbc, mockwebserver, nist-pkix-tests
//java_library_static {
// srcs: test_src_files,
// java_resource_dirs: test_resource_dirs,
// no_standard_libraries: true,
// java_libs: [
// "core-libart",
// "okhttp",
// "core-junit",
// "bouncycastle",
// ],
// java_static_libs: [
// "core-tests-support",
// "sqlite-jdbc",
// "mockwebserver",
// "nist-pkix-tests",
// ],
// javacflags: local_javac_flags,
// name: "core-tests",
//}
// ANDROIDMK TRANSLATION ERROR: endif from unsupported contitional
// endif
// ANDROIDMK TRANSLATION ERROR: unsupported conditional
// ifeq ($(LIBCORE_SKIP_TESTS),)
// Make the core-tests-support library.
java_library_static {
srcs: ["support/src/test/java/**/*.java"],
java_resource_dirs: test_resource_dirs,
no_standard_libraries: true,
java_libs: [
"core-libart",
"core-junit",
"bouncycastle",
],
javacflags: local_javac_flags,
name: "core-tests-support",
}
// ANDROIDMK TRANSLATION ERROR: endif from unsupported contitional
// endif
// ANDROIDMK TRANSLATION ERROR: unsupported conditional
// ifeq ($(LIBCORE_SKIP_TESTS),)
// Make the jsr166-tests library.
java_library_static {
srcs: ["jsr166-tests/src/test/java/**/*.java"],
java_resource_dirs: test_resource_dirs,
no_standard_libraries: true,
java_libs: [
"core-libart",
"core-junit",
],
javacflags: local_javac_flags,
name: "jsr166-tests",
}
// ANDROIDMK TRANSLATION ERROR: endif from unsupported contitional
// endif
//
// Build for the host.
//
java_library_host {
srcs: ["dex/src/main/java/**/*.java"],
tags: ["optional"],
name: "dex-host",
target: {
darwin: {
disabled: true,
},
},
}
//
// Local droiddoc for faster libcore testing
//
//
// Run with:
// mm -j32 libcore-docs
//
// Main output:
// ../out/target/common/docs/libcore/reference/packages.html
//
// All text for proofreading (or running tools over):
// ../out/target/common/docs/libcore-proofread.txt
//
// TODO list of missing javadoc, etc:
// ../out/target/common/docs/libcore-docs-todo.html
//
// Rerun:
// rm -rf ../out/target/common/docs/libcore-timestamp && mm -j32 libcore-docs
//
// for shared defintion of libcore_to_document
// ANDROIDMK TRANSLATION ERROR: unsupported include
// include $(LOCAL_PATH)/Docs.mk
// rerun doc generation without recompiling the java
// ANDROIDMK TRANSLATION ERROR: unsupported assignment to LOCAL_DROIDDOC_OPTIONS
// LOCAL_DROIDDOC_OPTIONS:=-offlinemode -title "libcore" -proofread $(OUT_DOCS)/$(LOCAL_MODULE)-proofread.txt -todo ../$(LOCAL_MODULE)-docs-todo.html -hdf android.whichdoc offline
// ANDROIDMK TRANSLATION ERROR: unsupported assignment to LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR
// LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR:=build/tools/droiddoc/templates-sdk
// ANDROIDMK TRANSLATION ERROR: unsupported include
// include $(BUILD_DROIDDOC)
//
// Definitions for building the native code needed for the core library.
//
cc_library_shared {
name: "libjavacore",
host_supported: true,
cflags: [
"-Wall",
"-Wextra",
"-Werror",
],
cppflags: [
"-std=gnu++11",
"-DU_USING_ICU_NAMESPACE=0",
],
srcs: [
"dalvik/src/main/native/org_apache_harmony_dalvik_NativeTestTarget.cpp",
"luni/src/main/native/AsynchronousCloseMonitor.cpp",
"luni/src/main/native/ExecStrings.cpp",
"luni/src/main/native/IcuUtilities.cpp",
"luni/src/main/native/JniException.cpp",
"luni/src/main/native/NetworkUtilities.cpp",
"luni/src/main/native/Register.cpp",
"luni/src/main/native/ZipUtilities.cpp",
"luni/src/main/native/android_system_OsConstants.cpp",
"luni/src/main/native/canonicalize_path.cpp",
"luni/src/main/native/cbigint.cpp",
"luni/src/main/native/java_io_File.cpp",
"luni/src/main/native/java_io_FileDescriptor.cpp",
"luni/src/main/native/java_io_ObjectStreamClass.cpp",
"luni/src/main/native/java_lang_Character.cpp",
"luni/src/main/native/java_lang_Double.cpp",
"luni/src/main/native/java_lang_Float.cpp",
"luni/src/main/native/java_lang_Math.cpp",
"luni/src/main/native/java_lang_ProcessManager.cpp",
"luni/src/main/native/java_lang_RealToString.cpp",
"luni/src/main/native/java_lang_StrictMath.cpp",
"luni/src/main/native/java_lang_StringToReal.cpp",
"luni/src/main/native/java_lang_System.cpp",
"luni/src/main/native/java_math_NativeBN.cpp",
"luni/src/main/native/java_nio_ByteOrder.cpp",
"luni/src/main/native/java_text_Bidi.cpp",
"luni/src/main/native/java_util_jar_StrictJarFile.cpp",
"luni/src/main/native/java_util_regex_Matcher.cpp",
"luni/src/main/native/java_util_regex_Pattern.cpp",
"luni/src/main/native/java_util_zip_Adler32.cpp",
"luni/src/main/native/java_util_zip_CRC32.cpp",
"luni/src/main/native/java_util_zip_Deflater.cpp",
"luni/src/main/native/java_util_zip_Inflater.cpp",
"luni/src/main/native/libcore_icu_AlphabeticIndex.cpp",
"luni/src/main/native/libcore_icu_ICU.cpp",
"luni/src/main/native/libcore_icu_NativeCollation.cpp",
"luni/src/main/native/libcore_icu_NativeConverter.cpp",
"luni/src/main/native/libcore_icu_NativeDecimalFormat.cpp",
"luni/src/main/native/libcore_icu_NativeIDN.cpp",
"luni/src/main/native/libcore_icu_NativeNormalizer.cpp",
"luni/src/main/native/libcore_icu_NativePluralRules.cpp",
"luni/src/main/native/libcore_icu_TimeZoneNames.cpp",
"luni/src/main/native/libcore_icu_Transliterator.cpp",
"luni/src/main/native/libcore_io_AsynchronousCloseMonitor.cpp",
"luni/src/main/native/libcore_io_Memory.cpp",
"luni/src/main/native/libcore_io_Posix.cpp",
"luni/src/main/native/org_apache_harmony_xml_ExpatParser.cpp",
"luni/src/main/native/readlink.cpp",
"luni/src/main/native/sun_misc_Unsafe.cpp",
"luni/src/main/native/valueOf.cpp",
],
static_libs: [
"libfdlibm",
],
shared_libs: [
"libexpat",
"libicuuc",
"libicui18n",
"libcrypto",
"libz",
"libziparchive",
"libbase",
],
target: {
android: {
shared_libs: [
"libdl",
"liblog",
"libnativehelper",
"libutils",
],
},
host: {
host_ldlibs: [
"-ldl",
"-lpthread",
],
static_libs: [
"libutils",
],
},
darwin: {
disabled: true,
},
},
local_include_dirs: ["include"],
stl: "libc++",
}
// Test JNI library.
// ANDROIDMK TRANSLATION ERROR: unsupported conditional
// ifeq ($(LIBCORE_SKIP_TESTS),)
cc_library_shared {
name: "libjavacoretests",
host_supported: true,
cflags: [
"-Wall",
"-Wextra",
"-Werror",
],
cppflags: [
"-std=gnu++11",
"-DU_USING_ICU_NAMESPACE=0",
],
srcs: ["luni/src/test/native/dalvik_system_JniTest.cpp"],
local_include_dirs: ["include"],
shared_libs: ["libcrypto"],
target: {
host: {
host_ldlibs: [
"-ldl",
"-lpthread",
],
},
darwin: {
disabled: true,
},
},
stl: "libc++",
}
// ANDROIDMK TRANSLATION ERROR: endif from unsupported contitional
// endif
// LIBCORE_SKIP_TESTS
// Set of gtest unit tests.
cc_test {
srcs: ["luni/src/test/native/libcore_io_Memory_test.cpp"],
local_include_dirs: ["include"],
tags: ["debug"],
name: "libjavacore-unit-tests",
stl: "libc++",
}
// Set of benchmarks for libjavacore functions.
cc_benchmark {
srcs: ["luni/src/benchmark/native/libcore_io_Memory_bench.cpp"],
local_include_dirs: ["include"],
tags: ["debug"],
name: "libjavacore-benchmarks",
stl: "libc++",
compile_multilib: "both",
multilib: {
lib32: {
suffix: "32",
},
lib64: {
suffix: "64",
},
},
}
subdirs = ["benchmarks"]