Add an apex_contributions_defaults module to module sdk

This metadata module will contain a flattened list of all the soong
modules contributed by this module to the rest of the build. This is
supported in V and above.

Bug: 326246905
Test: m art-module-host-exports
Test: unzip -p out/soong/mainline-sdks/art-module-host-exports-current.zip Android.bp | grep -A 15 apex_contributions_defaults
apex_contributions_defaults {
    name: "art-module-host-exports.contributions",
    contents: [
        "prebuilt_art.module.api.annotations",
        "prebuilt_dex2oat",
        "prebuilt_dex2oatd",
        "prebuilt_dexdump",
        "prebuilt_hiddenapi",
        "prebuilt_oatdump",
        "prebuilt_profman",
        "prebuilt_veridex",
        "prebuilt_libartpalette",
        "prebuilt_libartbase",
    ],
}

Change-Id: Iba43a9da5430adfc0a5fd9b5dc27b5d89c5eacb8
This commit is contained in:
Spandan Das 2024-03-06 14:04:36 +00:00
parent 159b264873
commit a5e26d3cd6
11 changed files with 432 additions and 0 deletions

View file

@ -289,6 +289,8 @@ var LastWithoutModuleLibCoreSystemModules = uncheckedFinalApiLevel(31)
var ApiLevelR = uncheckedFinalApiLevel(30)
var ApiLevelUpsideDownCake = uncheckedFinalApiLevel(34)
// ReplaceFinalizedCodenames returns the API level number associated with that API level
// if the `raw` input is the codename of an API level has been finalized.
// If the input is *not* a finalized codename, the input is returned unmodified.

View file

@ -152,6 +152,11 @@ func TestSnapshotWithBootclasspathFragment_ImageName(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: [],
}
prebuilt_bootclasspath_fragment {
name: "art-bootclasspath-fragment",
prefer: false,
@ -187,6 +192,7 @@ java_import {
apex_available: ["com.android.art"],
jars: ["java_boot_libs/snapshot/jars/are/invalid/core2.jar"],
}
`),
checkAllCopyRules(`
.intermediates/art-bootclasspath-fragment/android_common/modular-hiddenapi/annotation-flags.csv -> hiddenapi/annotation-flags.csv
@ -353,6 +359,15 @@ func testSnapshotWithBootClasspathFragment_Contents(t *testing.T, sdk string, co
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: [
"prebuilt_myothersdklibrary",
"prebuilt_mysdklibrary",
"prebuilt_mycoreplatform",
],
}
prebuilt_bootclasspath_fragment {
name: "mybootclasspathfragment",
prefer: false,
@ -642,6 +657,11 @@ func TestSnapshotWithBootClasspathFragment_Fragments(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_mysdklibrary"],
}
prebuilt_bootclasspath_fragment {
name: "mybootclasspathfragment",
prefer: false,
@ -881,6 +901,14 @@ func TestSnapshotWithBootclasspathFragment_HiddenAPI(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: [
"prebuilt_mynewlibrary",
"prebuilt_mysdklibrary",
],
}
prebuilt_bootclasspath_fragment {
name: "mybootclasspathfragment",
prefer: false,
@ -1008,6 +1036,9 @@ func testSnapshotWithBootClasspathFragment_MinSdkVersion(t *testing.T, targetBui
android.FixtureMergeEnv(map[string]string{
"SOONG_SDK_SNAPSHOT_TARGET_BUILD_RELEASE": targetBuildRelease,
}),
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
variables.Platform_version_active_codenames = []string{"VanillaIceCream"}
}),
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
variables.BuildFlags = map[string]string{
@ -1226,6 +1257,9 @@ func TestSnapshotWithEmptyBootClasspathFragment(t *testing.T) {
android.FixtureMergeEnv(map[string]string{
"SOONG_SDK_SNAPSHOT_TARGET_BUILD_RELEASE": "S",
}),
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
variables.Platform_version_active_codenames = []string{"VanillaIceCream"}
}),
android.FixtureWithRootAndroidBp(`
sdk {
name: "mysdk",

View file

@ -123,6 +123,11 @@ func TestSdkCompileMultilibOverride(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_sdkmember"],
}
cc_prebuilt_library_shared {
name: "sdkmember",
prefer: false,
@ -226,6 +231,11 @@ func TestSnapshotWithObject(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_crtobj"],
}
cc_prebuilt_object {
name: "crtobj",
prefer: false,
@ -333,6 +343,11 @@ func TestSnapshotWithCcExportGeneratedHeaders(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_mynativelib"],
}
cc_prebuilt_library_shared {
name: "mynativelib",
prefer: false,
@ -406,6 +421,11 @@ func TestSnapshotWithCcSharedLibraryCommonProperties(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_mynativelib"],
}
cc_prebuilt_library_shared {
name: "mynativelib",
prefer: false,
@ -465,6 +485,11 @@ func TestSnapshotWithCcBinary(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mymodule_exports.contributions",
contents: ["prebuilt_mynativebinary"],
}
cc_prebuilt_binary {
name: "mynativebinary",
prefer: false,
@ -523,6 +548,11 @@ func TestMultipleHostOsTypesSnapshotWithCcBinary(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "myexports.contributions",
contents: ["prebuilt_mynativebinary"],
}
cc_prebuilt_binary {
name: "mynativebinary",
prefer: false,
@ -621,6 +651,14 @@ func TestSnapshotWithSingleHostOsType(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "myexports.contributions",
contents: [
"prebuilt_mynativebinary",
"prebuilt_mynativelib",
],
}
cc_prebuilt_binary {
name: "mynativebinary",
prefer: false,
@ -696,6 +734,11 @@ func TestSnapshotWithCcStaticNocrtBinary(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mymodule_exports.contributions",
contents: ["prebuilt_linker"],
}
cc_prebuilt_binary {
name: "linker",
prefer: false,
@ -755,6 +798,11 @@ func TestSnapshotWithCcSharedLibrary(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_mynativelib"],
}
cc_prebuilt_library_shared {
name: "mynativelib",
prefer: false,
@ -856,6 +904,15 @@ func TestSnapshotWithCcSharedLibrarySharedLibs(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: [
"prebuilt_mynativelib",
"prebuilt_myothernativelib",
"prebuilt_mysystemnativelib",
],
}
cc_prebuilt_library_shared {
name: "mynativelib",
prefer: false,
@ -953,6 +1010,11 @@ func TestHostSnapshotWithCcSharedLibrary(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_mynativelib"],
}
cc_prebuilt_library_shared {
name: "mynativelib",
prefer: false,
@ -1029,6 +1091,11 @@ func TestMultipleHostOsTypesSnapshotWithCcSharedLibrary(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_mynativelib"],
}
cc_prebuilt_library_shared {
name: "mynativelib",
prefer: false,
@ -1095,6 +1162,11 @@ func TestSnapshotWithCcStaticLibrary(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "myexports.contributions",
contents: ["prebuilt_mynativelib"],
}
cc_prebuilt_library_static {
name: "mynativelib",
prefer: false,
@ -1158,6 +1230,11 @@ func TestHostSnapshotWithCcStaticLibrary(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "myexports.contributions",
contents: ["prebuilt_mynativelib"],
}
cc_prebuilt_library_static {
name: "mynativelib",
prefer: false,
@ -1222,6 +1299,11 @@ func TestSnapshotWithCcLibrary(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "myexports.contributions",
contents: ["prebuilt_mynativelib"],
}
cc_prebuilt_library {
name: "mynativelib",
prefer: false,
@ -1298,6 +1380,11 @@ func TestSnapshotSameLibraryWithNativeLibsAndNativeSharedLib(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "myexports.contributions",
contents: ["prebuilt_mynativelib"],
}
cc_prebuilt_library {
name: "mynativelib",
prefer: false,
@ -1394,6 +1481,11 @@ func TestSnapshotSameLibraryWithAndroidNativeLibsAndHostNativeSharedLib(t *testi
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "myexports.contributions",
contents: ["prebuilt_mynativelib"],
}
cc_prebuilt_library {
name: "mynativelib",
prefer: false,
@ -1520,6 +1612,11 @@ func TestHostSnapshotWithMultiLib64(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "myexports.contributions",
contents: ["prebuilt_mynativelib"],
}
cc_prebuilt_library_static {
name: "mynativelib",
prefer: false,
@ -1572,6 +1669,11 @@ func TestSnapshotWithCcHeadersLibrary(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_mynativeheaders"],
}
cc_prebuilt_library_headers {
name: "mynativeheaders",
prefer: false,
@ -1594,6 +1696,9 @@ func TestSnapshotWithCcHeadersLibraryAndNativeBridgeSupport(t *testing.T) {
PrepareForTestWithSdkBuildComponents,
ccTestFs.AddToFixture(),
prepareForTestWithNativeBridgeTarget,
android.FixtureRegisterWithContext(func(ctx android.RegistrationContext) {
android.RegisterApexContributionsBuildComponents(ctx)
}),
).RunTestWithBp(t, `
sdk {
name: "mysdk",
@ -1616,6 +1721,11 @@ func TestSnapshotWithCcHeadersLibraryAndNativeBridgeSupport(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_mynativeheaders"],
}
cc_prebuilt_library_headers {
name: "mynativeheaders",
prefer: false,
@ -1679,6 +1789,9 @@ func TestSnapshotWithCcHeadersLibraryAndImageVariants(t *testing.T) {
cc.PrepareForTestWithCcDefaultModules,
PrepareForTestWithSdkBuildComponents,
ccTestFs.AddToFixture(),
android.FixtureRegisterWithContext(func(ctx android.RegistrationContext) {
android.RegisterApexContributionsBuildComponents(ctx)
}),
).RunTestWithBp(t, fmt.Sprintf(`
sdk {
name: "mysdk",
@ -1701,6 +1814,11 @@ func TestSnapshotWithCcHeadersLibraryAndImageVariants(t *testing.T) {
checkAndroidBpContents(fmt.Sprintf(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_mynativeheaders"],
}
cc_prebuilt_library_headers {
name: "mynativeheaders",
prefer: false,
@ -1750,6 +1868,11 @@ func TestHostSnapshotWithCcHeadersLibrary(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_mynativeheaders"],
}
cc_prebuilt_library_headers {
name: "mynativeheaders",
prefer: false,
@ -1807,6 +1930,11 @@ func TestDeviceAndHostSnapshotWithCcHeadersLibrary(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_mynativeheaders"],
}
cc_prebuilt_library_headers {
name: "mynativeheaders",
prefer: false,
@ -1870,6 +1998,15 @@ func TestSystemSharedLibPropagation(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: [
"prebuilt_sslnil",
"prebuilt_sslempty",
"prebuilt_sslnonempty",
],
}
cc_prebuilt_library_shared {
name: "sslnil",
prefer: false,
@ -1943,6 +2080,11 @@ cc_prebuilt_library_shared {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_sslvariants"],
}
cc_prebuilt_library_shared {
name: "sslvariants",
prefer: false,
@ -2002,6 +2144,11 @@ func TestStubsLibrary(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_stubslib"],
}
cc_prebuilt_library_shared {
name: "stubslib",
prefer: false,
@ -2056,6 +2203,11 @@ func TestDeviceAndHostSnapshotWithStubsLibrary(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_stubslib"],
}
cc_prebuilt_library_shared {
name: "stubslib",
prefer: false,
@ -2114,6 +2266,11 @@ func TestUniqueHostSoname(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_mylib"],
}
cc_prebuilt_library_shared {
name: "mylib",
prefer: false,
@ -2178,6 +2335,11 @@ func TestNoSanitizerMembers(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_mynativelib"],
}
cc_prebuilt_library_shared {
name: "mynativelib",
prefer: false,

View file

@ -36,6 +36,11 @@ func testSnapshotWithCompatConfig(t *testing.T, sdk string) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_myconfig"],
}
prebuilt_platform_compat_config {
name: "myconfig",
prefer: false,

View file

@ -46,6 +46,11 @@ func TestModuleExportsSnapshot(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "myexports.contributions",
contents: ["prebuilt_myjavalib"],
}
java_import {
name: "myjavalib",
prefer: false,

View file

@ -108,6 +108,11 @@ func TestSnapshotWithJavaHeaderLibrary(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_myjavalib"],
}
java_import {
name: "myjavalib",
prefer: false,
@ -154,6 +159,11 @@ func TestHostSnapshotWithJavaHeaderLibrary(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_myjavalib"],
}
java_import {
name: "myjavalib",
prefer: false,
@ -193,6 +203,11 @@ func TestDeviceAndHostSnapshotWithJavaHeaderLibrary(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_myjavalib"],
}
java_import {
name: "myjavalib",
prefer: false,
@ -245,6 +260,11 @@ func TestSnapshotWithJavaImplLibrary(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "myexports.contributions",
contents: ["prebuilt_myjavalib"],
}
java_import {
name: "myjavalib",
prefer: false,
@ -291,6 +311,11 @@ func TestSnapshotWithJavaBootLibrary(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: [],
}
java_import {
name: "myjavalib",
prefer: false,
@ -313,6 +338,9 @@ func TestSnapshotWithJavaBootLibrary_UpdatableMedia(t *testing.T) {
android.FixtureMergeEnv(map[string]string{
"SOONG_SDK_SNAPSHOT_TARGET_BUILD_RELEASE": targetBuildRelease,
}),
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
variables.Platform_version_active_codenames = []string{"VanillaIceCream"}
}),
).RunTestWithBp(t, `
sdk {
name: "mysdk",
@ -395,6 +423,11 @@ func TestSnapshotWithJavaLibrary_MinSdkVersion(t *testing.T) {
checkAndroidBpContents(fmt.Sprintf(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_mylib"],
}
java_import {
name: "mylib",
prefer: false,
@ -459,6 +492,11 @@ func TestSnapshotWithJavaSystemserverLibrary(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "myexports.contributions",
contents: [],
}
java_import {
name: "myjavalib",
prefer: false,
@ -504,6 +542,11 @@ func TestHostSnapshotWithJavaImplLibrary(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "myexports.contributions",
contents: ["prebuilt_myjavalib"],
}
java_import {
name: "myjavalib",
prefer: false,
@ -542,6 +585,11 @@ func TestSnapshotWithJavaTest(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "myexports.contributions",
contents: ["prebuilt_myjavatests"],
}
java_test_import {
name: "myjavatests",
prefer: false,
@ -582,6 +630,11 @@ func TestHostSnapshotWithJavaTest(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "myexports.contributions",
contents: ["prebuilt_myjavatests"],
}
java_test_import {
name: "myjavatests",
prefer: false,
@ -661,6 +714,15 @@ func TestSnapshotWithJavaSystemModules(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: [
"prebuilt_exported-system-module",
"prebuilt_myjavalib",
"prebuilt_my-system-modules",
],
}
java_import {
name: "exported-system-module",
prefer: false,
@ -790,6 +852,11 @@ func TestHostSnapshotWithJavaSystemModules(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_my-system-modules"],
}
java_import {
name: "mysdk_system-module",
prefer: false,
@ -854,6 +921,15 @@ func TestDeviceAndHostSnapshotWithOsSpecificMembers(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "myexports.contributions",
contents: [
"prebuilt_hostjavalib",
"prebuilt_androidjavalib",
"prebuilt_myjavalib",
],
}
java_import {
name: "hostjavalib",
prefer: false,
@ -920,6 +996,11 @@ func TestSnapshotWithJavaSdkLibrary(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_myjavalib"],
}
java_sdk_library_import {
name: "myjavalib",
prefer: false,
@ -993,6 +1074,11 @@ func TestSnapshotWithJavaSdkLibrary_DistStem(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_myjavalib-foo"],
}
java_sdk_library_import {
name: "myjavalib-foo",
prefer: false,
@ -1046,6 +1132,11 @@ func TestSnapshotWithJavaSdkLibrary_UseSrcJar(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_myjavalib"],
}
java_sdk_library_import {
name: "myjavalib",
prefer: false,
@ -1093,6 +1184,11 @@ func TestSnapshotWithJavaSdkLibrary_AnnotationsZip(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_myjavalib"],
}
java_sdk_library_import {
name: "myjavalib",
prefer: false,
@ -1147,6 +1243,11 @@ func TestSnapshotWithJavaSdkLibrary_AnnotationsZip_PreT(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_myjavalib"],
}
java_sdk_library_import {
name: "myjavalib",
prefer: false,
@ -1204,6 +1305,11 @@ func TestSnapshotWithJavaSdkLibrary_CompileDex(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_myjavalib"],
}
java_sdk_library_import {
name: "myjavalib",
prefer: false,
@ -1272,6 +1378,11 @@ func TestSnapshotWithJavaSdkLibrary_SdkVersion_None(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_myjavalib"],
}
java_sdk_library_import {
name: "myjavalib",
prefer: false,
@ -1320,6 +1431,11 @@ func TestSnapshotWithJavaSdkLibrary_SdkVersion_ForScope(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_myjavalib"],
}
java_sdk_library_import {
name: "myjavalib",
prefer: false,
@ -1371,6 +1487,11 @@ func TestSnapshotWithJavaSdkLibrary_ApiScopes(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_myjavalib"],
}
java_sdk_library_import {
name: "myjavalib",
prefer: false,
@ -1436,6 +1557,11 @@ func TestSnapshotWithJavaSdkLibrary_ModuleLib(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_myjavalib"],
}
java_sdk_library_import {
name: "myjavalib",
prefer: false,
@ -1509,6 +1635,11 @@ func TestSnapshotWithJavaSdkLibrary_SystemServer(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_myjavalib"],
}
java_sdk_library_import {
name: "myjavalib",
prefer: false,
@ -1569,6 +1700,11 @@ func TestSnapshotWithJavaSdkLibrary_NamingScheme(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_myjavalib"],
}
java_sdk_library_import {
name: "myjavalib",
prefer: false,
@ -1626,6 +1762,11 @@ func TestSnapshotWithJavaSdkLibrary_DoctagFiles(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_myjavalib"],
}
java_sdk_library_import {
name: "myjavalib",
prefer: false,

View file

@ -69,6 +69,11 @@ package {
default_applicable_licenses: ["Android-Apache-2.0"],
}
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_myjavalib"],
}
java_import {
name: "myjavalib",
prefer: false,

View file

@ -137,6 +137,11 @@ func TestBasicTrait_WithoutTrait(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_myjavalib"],
}
java_import {
name: "myjavalib",
prefer: false,
@ -202,6 +207,17 @@ func TestBasicTrait_MultipleTraits(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: [
"prebuilt_myjavalib",
"prebuilt_myjavalib_extra",
"prebuilt_myjavalib_special",
"prebuilt_anotherjavalib",
"prebuilt_anotherjavalib_special",
],
}
java_test_import {
name: "myjavalib",
prefer: false,

View file

@ -118,6 +118,16 @@ func TestSnapshotVisibility(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: [
"prebuilt_myjavalib",
"prebuilt_mypublicjavalib",
"prebuilt_mydefaultedjavalib",
"prebuilt_myprivatejavalib",
],
}
java_import {
name: "myjavalib",
prefer: false,
@ -398,6 +408,11 @@ func TestSnapshot_EnvConfiguration(t *testing.T) {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_myjavalib"],
}
java_import {
name: "myjavalib",
prefer: false,
@ -453,6 +468,11 @@ java_import {
checkAndroidBpContents(`
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_mysdklibrary"],
}
prebuilt_bootclasspath_fragment {
name: "mybootclasspathfragment",
prefer: false,

View file

@ -34,6 +34,9 @@ func testSnapshotWithSystemServerClasspathFragment(t *testing.T, sdk string, tar
env["SOONG_SDK_SNAPSHOT_TARGET_BUILD_RELEASE"] = targetBuildRelease
}
}),
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
variables.Platform_version_active_codenames = []string{"VanillaIceCream"}
}),
prepareForSdkTestWithApex,
android.FixtureWithRootAndroidBp(sdk+`
@ -242,6 +245,11 @@ sdk {
expectedLatestSnapshot := `
// This is auto-generated. DO NOT EDIT.
apex_contributions_defaults {
name: "mysdk.contributions",
contents: ["prebuilt_mysdklibrary"],
}
java_sdk_library_import {
name: "mysdklibrary",
prefer: false,

View file

@ -24,6 +24,7 @@ import (
"android/soong/apex"
"android/soong/cc"
"android/soong/java"
"github.com/google/blueprint"
"github.com/google/blueprint/proptools"
@ -388,6 +389,7 @@ be unnecessary as every module in the sdk already has its own licenses property.
// Create the prebuilt modules for each of the member modules.
traits := s.gatherTraits()
memberNames := []string{} // soong module names of the members. contains the prebuilt_ prefix.
for _, member := range members {
memberType := member.memberType
if !memberType.ArePrebuiltsRequired() {
@ -409,6 +411,38 @@ be unnecessary as every module in the sdk already has its own licenses property.
prebuiltModule := memberType.AddPrebuiltModule(memberCtx, member)
s.createMemberSnapshot(memberCtx, member, prebuiltModule.(*bpModule))
if member.memberType != android.LicenseModuleSdkMemberType && !builder.isInternalMember(member.name) {
// More exceptions
// 1. Skip BCP and SCCP fragments
// 2. Skip non-sdk contents of BCP and SCCP fragments
//
// The non-sdk contents of BCP/SSCP fragments should only be used for dexpreopt and hiddenapi,
// and are not available to the rest of the build.
if android.InList(member.memberType,
[]android.SdkMemberType{
// bcp
java.BootclasspathFragmentSdkMemberType,
java.JavaBootLibsSdkMemberType,
// sscp
java.SystemServerClasspathFragmentSdkMemberType,
java.JavaSystemserverLibsSdkMemberType,
},
) {
continue
}
memberNames = append(memberNames, android.PrebuiltNameFromSource(member.name))
}
}
// create an apex_contributions_defaults for this module's sdk.
// this module type is supported in V and above.
if targetApiLevel.GreaterThan(android.ApiLevelUpsideDownCake) {
ac := newModule("apex_contributions_defaults")
ac.AddProperty("name", s.Name()+".contributions")
ac.AddProperty("contents", memberNames)
bpFile.AddModule(ac)
}
// Create a transformer that will transform a module by replacing any references