Files
John Wu a785a1bc9e [Ravenwood] Build our own libandroid_runtime
Sometimes we need to customize how we build libandroid_runtime that is
different from layoutlib. Split out all common configurations into its
own cc_defaults and create Ravenwood's own libandroid_runtime module.

Bug: 439059387
Flag: EXEMPT HOST_MODE
Test: f/b/r/scripts/run-ravenwood-tests.sh
Change-Id: Ifb618be581560dc10f4f60eb338930b190380b17
2025-09-03 00:18:00 +00:00

636 lines
20 KiB
Plaintext

package {
// See: http://go/android-license-faq
// A large-scale-change added 'default_applicable_licenses' to import
// all of the 'license_kinds' from "frameworks_base_license"
// to get the below license kinds:
// SPDX-license-identifier-Apache-2.0
default_applicable_licenses: ["frameworks_base_license"],
// OWNER: g/ravenwood
// Bug component: 25698
default_team: "trendy_team_ravenwood",
}
filegroup {
name: "ravenwood-common-policies",
srcs: [
"texts/ravenwood-common-policies.txt",
],
visibility: [":__subpackages__"],
}
filegroup {
name: "ravenwood-services-policies",
srcs: [
"texts/ravenwood-services-policies.txt",
],
visibility: ["//visibility:private"],
}
filegroup {
name: "ravenwood-framework-policies",
srcs: [
"texts/ravenwood-framework-policies.txt",
],
visibility: ["//visibility:private"],
}
filegroup {
name: "ravenwood-standard-options",
srcs: [
"texts/ravenwood-standard-options.txt",
],
visibility: ["//visibility:private"],
}
filegroup {
name: "ravenwood-common-options",
srcs: [
"texts/ravenwood-common-options.txt",
],
visibility: [":__subpackages__"],
}
filegroup {
name: "ravenizer-standard-options",
srcs: [
"texts/ravenizer-standard-options.txt",
],
visibility: [":__subpackages__"],
}
filegroup {
name: "ravenwood-annotation-allowed-classes",
srcs: [
"texts/ravenwood-annotation-allowed-classes.txt",
],
visibility: ["//visibility:private"],
}
filegroup {
name: "ravenwood-services-jarjar-rules",
srcs: ["texts/ravenwood-services-jarjar-rules.txt"],
visibility: ["//visibility:private"],
}
filegroup {
name: "ravenwood-module-utils-jarjar-rules",
srcs: ["texts/ravenwood-module-utils-jarjar-rules.txt"],
visibility: ["//visibility:private"],
}
filegroup {
name: "ravenwood-all-text-files",
srcs: [
"texts/*",
],
visibility: [":__subpackages__"],
}
filegroup {
name: "ravenwood-all-scripts",
srcs: [
"scripts/*",
],
visibility: [":__subpackages__"],
}
// Common code that is shared across host and device.
java_library {
name: "ravenwood-common-utils",
host_supported: true,
sdk_version: "core_current",
srcs: ["common-src/**/*.java"],
static_libs: [
"junit",
"framework-annotations-lib",
"modules-utils-ravenwood",
],
visibility: ["//visibility:private"],
jarjar_rules: ":ravenwood-module-utils-jarjar-rules",
}
// libcore-fake should be explicitly built against the host JDK, so use java_library_host.
java_library_host {
name: "ravenwood-libcore.host",
srcs: ["libcore-fake/**/*.java"],
libs: [
"app-compat-annotations",
"ravenwood-common-utils",
],
visibility: ["//visibility:private"],
}
java_host_for_device {
name: "ravenwood-libcore",
libs: ["ravenwood-libcore.host"],
visibility: ["//visibility:private"],
}
// We use java_import to strip out the sdk_version of AndroidX libraries.
java_import {
name: "ravenwood-androidx",
// Put the list of all AndroidX libraries Ravenwood needs here.
jars: [
":androidx.test.monitor",
],
visibility: ["//visibility:private"],
}
java_library {
name: "ravenwood-junit-impl",
srcs: [
":framework-configinfrastructure-ravenwood-sources",
":framework-ravenwood-sources",
"junit-impl-src/**/*.java",
"junit-src/**/*.java",
],
static_libs: [
"ravenwood-androidx",
"ravenwood-common-utils",
"ravenwood-libcore",
"ow2-asm",
"ow2-asm-analysis",
"ow2-asm-commons",
"ow2-asm-tree",
"ow2-asm-util",
],
libs: [
"framework-configinfrastructure.ravenwood",
"framework-minus-apex.ravenwood",
"hoststubgen-helper-runtime",
"junit",
"ravenwood-framework",
"services.core.ravenwood",
"objenesis",
],
sdk_version: "core_current",
visibility: [":__subpackages__"],
jarjar_rules: ":ravenwood-services-jarjar-rules",
}
java_device_for_host {
name: "ravenwood-junit-for-ravenizer",
libs: [
"ravenwood-junit",
],
visibility: [":__subpackages__"],
}
// The "impl" library above is what ships inside the Ravenwood environment to actually drive any
// API access to implementation details.
java_library {
name: "ravenwood-junit",
srcs: [
"junit-src/**/*.java",
"junit-stub-src/**/*.java",
],
sdk_version: "core_current",
static_libs: ["ravenwood-common-utils"],
libs: [
"framework-minus-apex.ravenwood",
"junit",
],
visibility: ["//visibility:public"],
}
// Library used to publish a handful of `android.ravenwood` APIs into
// the Ravenwood BCP; we don't want to publish these APIs into the BCP
// on physical devices, which is why this is a separate library
java_library {
name: "ravenwood-framework",
srcs: [
"framework-src/**/*.java",
],
libs: [
"framework-minus-apex.ravenwood",
],
sdk_version: "core_current",
visibility: ["//visibility:public"],
}
cc_defaults {
name: "ravenwood_jni_defaults",
cflags: [
"-Wall",
"-Werror",
"-Wno-unused-parameter",
"-Wthread-safety",
],
static_libs: [
"libnativehelper_jvm",
],
shared_libs: [
"liblog",
],
visibility: ["//visibility:private"],
}
// We need this as a separate library because we need to overload the
// sysprop symbols before libbase is loaded into the process
cc_library_host_shared {
name: "libravenwood_initializer",
defaults: ["ravenwood_jni_defaults"],
srcs: ["runtime-jni/ravenwood_initializer.cpp"],
}
cc_library_host_shared {
name: "libravenwood_runtime",
defaults: ["ravenwood_jni_defaults"],
header_libs: ["libicuuc_headers"],
srcs: [
"runtime-jni/ravenwood_os_constants.cpp",
"runtime-jni/ravenwood_runtime.cpp",
],
shared_libs: [
"libbase",
"libcutils",
"libutils",
],
}
// For collecting the *stats.csv files in a known directory under out/host/linux-x86/testcases/.
// The "test" just shows the available stats filenames.
sh_test_host {
name: "ravenwood-stats-checker",
src: "scripts/ravenwood-stats-checker.sh",
test_suites: ["general-tests"],
device_common_data: [
":framework-minus-apex.ravenwood-stats{hoststubgen_framework-minus-apex_apis.csv}",
":framework-minus-apex.ravenwood-stats{hoststubgen_framework-minus-apex_dump.txt}",
":framework-minus-apex.ravenwood-stats{hoststubgen_framework-minus-apex_keep_all.txt}",
":services.core.ravenwood-stats{hoststubgen_services.core_apis.csv}",
":services.core.ravenwood-stats{hoststubgen_services.core_dump.txt}",
":services.core.ravenwood-stats{hoststubgen_services.core_keep_all.txt}",
":framework-configinfrastructure.ravenwood-stats{framework-configinfrastructure_apis.csv}",
":framework-configinfrastructure.ravenwood-stats{framework-configinfrastructure_dump.txt}",
":framework-configinfrastructure.ravenwood-stats{framework-configinfrastructure_keep_all.txt}",
":framework-statsd.ravenwood-stats{framework-statsd_apis.csv}",
":framework-statsd.ravenwood-stats{framework-statsd_dump.txt}",
":framework-statsd.ravenwood-stats{framework-statsd_keep_all.txt}",
":framework-graphics.ravenwood-stats{framework-graphics_apis.csv}",
":framework-graphics.ravenwood-stats{framework-graphics_dump.txt}",
":framework-graphics.ravenwood-stats{framework-graphics_keep_all.txt}",
],
}
java_library {
name: "services.fakes.ravenwood-jarjar",
installable: false,
srcs: [":services.fakes-sources"],
libs: [
"ravenwood-framework",
"services.core.ravenwood",
],
jarjar_rules: ":ravenwood-services-jarjar-rules",
visibility: ["//visibility:private"],
}
// On Ravenwood, we now use Mockito 5 throughout.
// Mockito 5 doesn't have an "inline-*" module, which only contained a "marker" file
// which would signal Mockito 4 used inline-mockito.
// Mockito 5 uses the "inline" storategy by default, so we no longer need an "inline"
// module.
// However, because we can't delete an existing jar in the runtime directory
// for b/418236847, we still keep "inline-mockito-ravenwood-prebuilt" as an empty jar.
java_import {
name: "mockito-ravenwood-prebuilt",
jars: [":mockito5-hostside-prebuilt"],
sdk_version: "core_current",
}
java_library {
name: "inline-mockito-ravenwood-prebuilt",
installable: false,
sdk_version: "core_current",
}
// We define our own version of platform_compat_config's here, because:
// - The original version (e.g. "framework-platform-compat-config) is built from
// the output file of the device side jar, rather than the host jar, meaning
// they're slow to build because they depend on D8/R8 output.
// - The original services one ("services-platform-compat-config") is built from services.jar,
// which includes service.permission, which is very slow to rebuild because of kotlin.
//
// Because we're re-defining the same compat-IDs that are defined elsewhere,
// they should all have `include_in_merged_xml: false`. Otherwise, generating
// merged_compat_config.xml would fail due to duplicate IDs.
//
// These module names must end with "compat-config" because these will be used as the filename,
// and at runtime, we only loads files that match `*compat-config.xml`.
platform_compat_config {
name: "ravenwood-framework-platform-compat-config",
src: ":framework-minus-apex-for-host",
include_in_merged_xml: false,
visibility: ["//visibility:private"],
}
platform_compat_config {
name: "ravenwood-services.core-platform-compat-config",
src: ":services.core-for-host",
include_in_merged_xml: false,
visibility: ["//visibility:private"],
}
java_library {
name: "ext-ravenwood",
installable: false,
static_libs: ["ext"],
visibility: ["//visibility:private"],
}
filegroup {
name: "ravenwood-data",
device_common_srcs: [
":framework-res",
":ravenwood-empty-res",
":ravenwood-framework-platform-compat-config",
":ravenwood-services.core-platform-compat-config",
":system-build.prop",
"texts/ravenwood-build.prop",
"texts/ravenwood-classpath.txt",
],
device_first_srcs: [
":apex_icu.dat",
],
visibility: ["//visibility:private"],
}
// Keep in sync with build/make/target/product/generic/Android.bp
filegroup {
name: "ravenwood-fonts",
device_common_srcs: [
":AndroidClock.ttf",
":CarroisGothicSC-Regular.ttf",
":ComingSoon.ttf",
":CutiveMono.ttf",
":DancingScript-Regular.ttf",
":DroidSansMono.ttf",
":NotoColorEmoji.ttf",
":NotoColorEmojiFlags.ttf",
":NotoNaskhArabic-Bold.ttf",
":NotoNaskhArabic-Regular.ttf",
":NotoNaskhArabicUI-Bold.ttf",
":NotoNaskhArabicUI-Regular.ttf",
":NotoSansAdlam-VF.ttf",
":NotoSansAhom-Regular.otf",
":NotoSansAnatolianHieroglyphs-Regular.otf",
":NotoSansArmenian-VF.ttf",
":NotoSansAvestan-Regular.ttf",
":NotoSansBalinese-Regular.ttf",
":NotoSansBamum-Regular.ttf",
":NotoSansBassaVah-Regular.otf",
":NotoSansBatak-Regular.ttf",
":NotoSansBengali-VF.ttf",
":NotoSansBengaliUI-VF.ttf",
":NotoSansBhaiksuki-Regular.otf",
":NotoSansBrahmi-Regular.ttf",
":NotoSansBuginese-Regular.ttf",
":NotoSansBuhid-Regular.ttf",
":NotoSansCJK-Regular.ttc",
":NotoSansCanadianAboriginal-Regular.ttf",
":NotoSansCarian-Regular.ttf",
":NotoSansChakma-Regular.otf",
":NotoSansCham-Bold.ttf",
":NotoSansCham-Regular.ttf",
":NotoSansCherokee-Regular.ttf",
":NotoSansCoptic-Regular.ttf",
":NotoSansCuneiform-Regular.ttf",
":NotoSansCypriot-Regular.ttf",
":NotoSansDeseret-Regular.ttf",
":NotoSansDevanagari-VF.ttf",
":NotoSansDevanagariUI-VF.ttf",
":NotoSansEgyptianHieroglyphs-Regular.ttf",
":NotoSansElbasan-Regular.otf",
":NotoSansEthiopic-VF.ttf",
":NotoSansGeorgian-VF.ttf",
":NotoSansGlagolitic-Regular.ttf",
":NotoSansGothic-Regular.ttf",
":NotoSansGrantha-Regular.ttf",
":NotoSansGujarati-Bold.ttf",
":NotoSansGujarati-Regular.ttf",
":NotoSansGujaratiUI-Bold.ttf",
":NotoSansGujaratiUI-Regular.ttf",
":NotoSansGunjalaGondi-Regular.otf",
":NotoSansGurmukhi-VF.ttf",
":NotoSansGurmukhiUI-VF.ttf",
":NotoSansHanifiRohingya-Regular.otf",
":NotoSansHanunoo-Regular.ttf",
":NotoSansHatran-Regular.otf",
":NotoSansHebrew-Bold.ttf",
":NotoSansHebrew-Regular.ttf",
":NotoSansImperialAramaic-Regular.ttf",
":NotoSansInscriptionalPahlavi-Regular.ttf",
":NotoSansInscriptionalParthian-Regular.ttf",
":NotoSansJavanese-Regular.otf",
":NotoSansKaithi-Regular.ttf",
":NotoSansKannada-VF.ttf",
":NotoSansKannadaUI-VF.ttf",
":NotoSansKayahLi-Regular.ttf",
":NotoSansKharoshthi-Regular.ttf",
":NotoSansKhmer-VF.ttf",
":NotoSansKhmerUI-Bold.ttf",
":NotoSansKhmerUI-Regular.ttf",
":NotoSansKhojki-Regular.otf",
":NotoSansLao-Bold.ttf",
":NotoSansLao-Regular.ttf",
":NotoSansLaoUI-Bold.ttf",
":NotoSansLaoUI-Regular.ttf",
":NotoSansLepcha-Regular.ttf",
":NotoSansLimbu-Regular.ttf",
":NotoSansLinearA-Regular.otf",
":NotoSansLinearB-Regular.ttf",
":NotoSansLisu-Regular.ttf",
":NotoSansLycian-Regular.ttf",
":NotoSansLydian-Regular.ttf",
":NotoSansMalayalam-VF.ttf",
":NotoSansMalayalamUI-VF.ttf",
":NotoSansMandaic-Regular.ttf",
":NotoSansManichaean-Regular.otf",
":NotoSansMarchen-Regular.otf",
":NotoSansMasaramGondi-Regular.otf",
":NotoSansMedefaidrin-VF.ttf",
":NotoSansMeeteiMayek-Regular.ttf",
":NotoSansMeroitic-Regular.otf",
":NotoSansMiao-Regular.otf",
":NotoSansModi-Regular.ttf",
":NotoSansMongolian-Regular.ttf",
":NotoSansMro-Regular.otf",
":NotoSansMultani-Regular.otf",
":NotoSansMyanmar-Bold.otf",
":NotoSansMyanmar-Medium.otf",
":NotoSansMyanmar-Regular.otf",
":NotoSansMyanmarUI-Bold.otf",
":NotoSansMyanmarUI-Medium.otf",
":NotoSansMyanmarUI-Regular.otf",
":NotoSansNKo-Regular.ttf",
":NotoSansNabataean-Regular.otf",
":NotoSansNewTaiLue-Regular.ttf",
":NotoSansNewa-Regular.otf",
":NotoSansOgham-Regular.ttf",
":NotoSansOlChiki-Regular.ttf",
":NotoSansOldItalic-Regular.ttf",
":NotoSansOldNorthArabian-Regular.otf",
":NotoSansOldPermic-Regular.otf",
":NotoSansOldPersian-Regular.ttf",
":NotoSansOldSouthArabian-Regular.ttf",
":NotoSansOldTurkic-Regular.ttf",
":NotoSansOriya-Bold.ttf",
":NotoSansOriya-Regular.ttf",
":NotoSansOriyaUI-Bold.ttf",
":NotoSansOriyaUI-Regular.ttf",
":NotoSansOsage-Regular.ttf",
":NotoSansOsmanya-Regular.ttf",
":NotoSansPahawhHmong-Regular.otf",
":NotoSansPalmyrene-Regular.otf",
":NotoSansPauCinHau-Regular.otf",
":NotoSansPhagsPa-Regular.ttf",
":NotoSansPhoenician-Regular.ttf",
":NotoSansRejang-Regular.ttf",
":NotoSansRunic-Regular.ttf",
":NotoSansSamaritan-Regular.ttf",
":NotoSansSaurashtra-Regular.ttf",
":NotoSansSharada-Regular.otf",
":NotoSansShavian-Regular.ttf",
":NotoSansSinhala-VF.ttf",
":NotoSansSinhalaUI-VF.ttf",
":NotoSansSoraSompeng-Regular.otf",
":NotoSansSoyombo-VF.ttf",
":NotoSansSundanese-Regular.ttf",
":NotoSansSylotiNagri-Regular.ttf",
":NotoSansSymbols-Regular-Subsetted.ttf",
":NotoSansSymbols-Regular-Subsetted2.ttf",
":NotoSansSyriacEastern-Regular.ttf",
":NotoSansSyriacEstrangela-Regular.ttf",
":NotoSansSyriacWestern-Regular.ttf",
":NotoSansTagalog-Regular.ttf",
":NotoSansTagbanwa-Regular.ttf",
":NotoSansTaiLe-Regular.ttf",
":NotoSansTaiTham-Regular.ttf",
":NotoSansTaiViet-Regular.ttf",
":NotoSansTakri-VF.ttf",
":NotoSansTamil-VF.ttf",
":NotoSansTamilUI-VF.ttf",
":NotoSansTelugu-VF.ttf",
":NotoSansTeluguUI-VF.ttf",
":NotoSansThaana-Bold.ttf",
":NotoSansThaana-Regular.ttf",
":NotoSansThai-Bold.ttf",
":NotoSansThai-Regular.ttf",
":NotoSansThaiUI-Bold.ttf",
":NotoSansThaiUI-Regular.ttf",
":NotoSansTifinagh-Regular.otf",
":NotoSansUgaritic-Regular.ttf",
":NotoSansVai-Regular.ttf",
":NotoSansWancho-Regular.otf",
":NotoSansWarangCiti-Regular.otf",
":NotoSansYi-Regular.ttf",
":NotoSerif-Bold.ttf",
":NotoSerif-BoldItalic.ttf",
":NotoSerif-Italic.ttf",
":NotoSerif-Regular.ttf",
":NotoSerifArmenian-VF.ttf",
":NotoSerifBengali-VF.ttf",
":NotoSerifCJK-Regular.ttc",
":NotoSerifDevanagari-VF.ttf",
":NotoSerifDogra-Regular.ttf",
":NotoSerifEthiopic-VF.ttf",
":NotoSerifGeorgian-VF.ttf",
":NotoSerifGujarati-VF.ttf",
":NotoSerifGurmukhi-VF.ttf",
":NotoSerifHebrew-Bold.ttf",
":NotoSerifHebrew-Regular.ttf",
":NotoSerifHentaigana.ttf",
":NotoSerifKannada-VF.ttf",
":NotoSerifKhmer-Bold.otf",
":NotoSerifKhmer-Regular.otf",
":NotoSerifLao-Bold.ttf",
":NotoSerifLao-Regular.ttf",
":NotoSerifMalayalam-VF.ttf",
":NotoSerifMyanmar-Bold.otf",
":NotoSerifMyanmar-Regular.otf",
":NotoSerifNyiakengPuachueHmong-VF.ttf",
":NotoSerifSinhala-VF.ttf",
":NotoSerifTamil-VF.ttf",
":NotoSerifTelugu-VF.ttf",
":NotoSerifThai-Bold.ttf",
":NotoSerifThai-Regular.ttf",
":NotoSerifTibetan-VF.ttf",
":NotoSerifYezidi-VF.ttf",
":Roboto-Regular.ttf",
":RobotoFlex-Regular.ttf",
":RobotoStatic-Regular.ttf",
":SourceSansPro-Bold.ttf",
":SourceSansPro-BoldItalic.ttf",
":SourceSansPro-Italic.ttf",
":SourceSansPro-Regular.ttf",
":SourceSansPro-SemiBold.ttf",
":SourceSansPro-SemiBoldItalic.ttf",
],
device_first_srcs: [
":font_fallback.xml",
":fonts.xml",
],
visibility: ["//visibility:private"],
}
android_ravenwood_libgroup {
name: "ravenwood-runtime",
data: [":ravenwood-data"],
fonts: [":ravenwood-fonts"],
libs: [
// The libraries listed here should be in sync with texts/ravenwood-classpath.txt.
// ravenwood-classpath.txt determines the order of the jar files in the classpath.
"framework-minus-apex.ravenwood",
"kxml2-android",
"json-prebuilt",
"ext-ravenwood",
"android.test.mock.ravenwood",
"hoststubgen-helper-runtime",
"services.core.ravenwood-jarjar",
"services.fakes.ravenwood-jarjar",
"core-icu4j-for-host.ravenwood",
"icu4j-icudata-jarjar",
"icu4j-icutzdata-jarjar",
"framework-configinfrastructure.ravenwood",
"framework-statsd.ravenwood",
"framework-graphics.ravenwood",
"junit",
"truth",
"flag-junit",
"ravenwood-framework",
"ravenwood-junit-impl",
"mockito-ravenwood-prebuilt",
"inline-mockito-ravenwood-prebuilt",
"framework-updatable-stubs-module_libs_api-for-host",
"all-updatable-modules-system-stubs-for-host",
],
jni_libs: [
// Libraries has to be loaded in the following order
"libravenwood_initializer",
"libravenwood_runtime",
"libandroid_runtime_ravenwood",
],
}
android_ravenwood_libgroup {
name: "ravenwood-utils",
libs: [
"flag-junit",
"inline-mockito-ravenwood-prebuilt",
"junit",
"mockito-ravenwood-prebuilt",
"ravenwood-framework",
"ravenwood-junit",
"truth",
],
}
build = [
"Framework.bp",
]