Install sdk variants in unbundled builds and package uninstallable variants

This effectively undoes both If6c3ee82d588e2742c85cef7244c090c93f38b8e
and I682e4f1f477f3024f7719dfaa67006ef335e0640.  SDK variants are now
installed again, which will fix unbundled builds of cc_test modules.
The platform variants used by com.android.virt are now packagable
even though they are not installable.

Fix the original problem in b/194403710 by adding a flag to platform
variants of modules in apexes that are not platform available, and
using that to prevent install and packaging dependencies.  That
allows the HideFromMake flag to go back to being used for preventing
install dependencies but not packaging dependencies.

Test: TestPackagingWithSkipInstallDeps
Test: TestFileSystemShouldInstallCoreVariantIfTargetBuildAppsIsSet
Test: TestFileSystemShouldSkipApexLibraries
Bug: 194403710
Bug: 268582372
Fixes: 274443025
Change-Id: If5418df3ddbb940bd631caebdf38daa81e71f40e
This commit is contained in:
Colin Cross
2023-04-25 11:30:51 -07:00
parent e018bc858b
commit bd3a16b5e7
8 changed files with 92 additions and 111 deletions

View File

@@ -101,95 +101,3 @@ func TestSdkMutator(t *testing.T) {
assertDep(t, libsdkNDK, libcxxNDK)
assertDep(t, libsdkPlatform, libcxxPlatform)
}
func TestMakeModuleNameForSdkVariant(t *testing.T) {
bp := `
cc_library {
name: "libfoo",
srcs: ["main_test.cpp"],
sdk_version: "current",
stl: "none",
}
`
platformVariant := "android_arm64_armv8-a_shared"
sdkVariant := "android_arm64_armv8-a_sdk_shared"
testCases := []struct {
name string
unbundledApps []string
variant string
skipInstall bool // soong skips install
hideFromMake bool // no make entry
makeUninstallable bool // make skips install
makeModuleName string
}{
{
name: "platform variant in normal builds",
unbundledApps: nil,
variant: platformVariant,
// installable in soong
skipInstall: false,
// visiable in Make as "libfoo"
hideFromMake: false,
makeModuleName: "libfoo",
// installable in Make
makeUninstallable: false,
},
{
name: "sdk variant in normal builds",
unbundledApps: nil,
variant: sdkVariant,
// soong doesn't install
skipInstall: true,
// visible in Make as "libfoo.sdk"
hideFromMake: false,
makeModuleName: "libfoo.sdk",
// but not installed
makeUninstallable: true,
},
{
name: "platform variant in unbunded builds",
unbundledApps: []string{"bar"},
variant: platformVariant,
// installable in soong
skipInstall: false,
// hidden from make
hideFromMake: true,
},
{
name: "sdk variant in unbunded builds",
unbundledApps: []string{"bar"},
variant: sdkVariant,
// soong doesn't install
skipInstall: true,
// visible in Make as "libfoo"
hideFromMake: false,
makeModuleName: "libfoo",
// but not installed
makeUninstallable: true,
},
}
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
fixture := android.GroupFixturePreparers(prepareForCcTest,
android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
variables.Unbundled_build_apps = tc.unbundledApps
}),
)
ctx := fixture.RunTestWithBp(t, bp).TestContext
module := ctx.ModuleForTests("libfoo", tc.variant).Module().(*Module)
android.AssertBoolEquals(t, "IsSkipInstall", tc.skipInstall, module.IsSkipInstall())
android.AssertBoolEquals(t, "HideFromMake", tc.hideFromMake, module.HiddenFromMake())
if !tc.hideFromMake {
entries := android.AndroidMkEntriesForTest(t, ctx, module)[0]
android.AssertStringEquals(t, "LOCAL_MODULE",
tc.makeModuleName, entries.EntryMap["LOCAL_MODULE"][0])
actualUninstallable := false
if actual, ok := entries.EntryMap["LOCAL_UNINSTALLABLE_MODULE"]; ok {
actualUninstallable = "true" == actual[0]
}
android.AssertBoolEquals(t, "LOCAL_UNINSTALLABLE_MODULE",
tc.makeUninstallable, actualUninstallable)
}
})
}
}