Deprecate Snapshot build
Existing snapshot code will no longer work from VNDK deprecation, but it
can give confusion to users if we keep code for the snapshot - and it
adds complexity on existing code while it is not in use. This change
removes all snapshot definition except host snapshot and its usage.
Bug: 330100430
Bug: 332986564
Test: AOSP CF build succeeded
Change-Id: Ieb6fa43d5e38315c662ce997bc305b744b367c24
diff --git a/cc/cc.go b/cc/cc.go
index fb5d096..2fa4b3b 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -35,7 +35,6 @@
"android/soong/fuzz"
"android/soong/genrule"
"android/soong/multitree"
- "android/soong/snapshot"
)
func init() {
@@ -347,11 +346,6 @@
// see soong/cc/config/vndk.go
MustUseVendorVariant bool `blueprint:"mutated"`
- // Used by vendor snapshot to record dependencies from snapshot modules.
- SnapshotSharedLibs []string `blueprint:"mutated"`
- SnapshotStaticLibs []string `blueprint:"mutated"`
- SnapshotRuntimeLibs []string `blueprint:"mutated"`
-
Installable *bool `android:"arch_variant"`
// Set by factories of module types that can only be referenced from variants compiled against
@@ -364,20 +358,6 @@
// variant to have a ".sdk" suffix.
SdkAndPlatformVariantVisibleToMake bool `blueprint:"mutated"`
- // Normally Soong uses the directory structure to decide which modules
- // should be included (framework) or excluded (non-framework) from the
- // different snapshots (vendor, recovery, etc.), but this property
- // allows a partner to exclude a module normally thought of as a
- // framework module from the vendor snapshot.
- Exclude_from_vendor_snapshot *bool
-
- // Normally Soong uses the directory structure to decide which modules
- // should be included (framework) or excluded (non-framework) from the
- // different snapshots (vendor, recovery, etc.), but this property
- // allows a partner to exclude a module normally thought of as a
- // framework module from the recovery snapshot.
- Exclude_from_recovery_snapshot *bool
-
// List of APEXes that this module has private access to for testing purpose. The module
// can depend on libraries that are not exported by the APEXes and use private symbols
// from the exported libraries.
@@ -960,8 +940,6 @@
"IsVndkSp": c.IsVndkSp(),
"IsLlndk": c.IsLlndk(),
"IsLlndkPublic": c.IsLlndkPublic(),
- "IsSnapshotLibrary": c.IsSnapshotLibrary(),
- "IsSnapshotPrebuilt": c.IsSnapshotPrebuilt(),
"IsVendorPublicLibrary": c.IsVendorPublicLibrary(),
"ApexSdkVersion": c.apexSdkVersion,
"TestFor": c.TestFor(),
@@ -1513,14 +1491,6 @@
return false
}
-func (c *Module) ExcludeFromVendorSnapshot() bool {
- return Bool(c.Properties.Exclude_from_vendor_snapshot)
-}
-
-func (c *Module) ExcludeFromRecoverySnapshot() bool {
- return Bool(c.Properties.Exclude_from_recovery_snapshot)
-}
-
func isBionic(name string) bool {
switch name {
case "libc", "libm", "libdl", "libdl_android", "linker":
@@ -2152,14 +2122,6 @@
c.outputFile = android.OptionalPathForPath(outputFile)
c.maybeUnhideFromMake()
-
- // glob exported headers for snapshot, if BOARD_VNDK_VERSION is current or
- // RECOVERY_SNAPSHOT_VERSION is current.
- if i, ok := c.linker.(snapshotLibraryInterface); ok {
- if ShouldCollectHeadersForSnapshot(ctx, c, apexInfo) {
- i.collectHeadersForSnapshot(ctx)
- }
- }
}
if c.testModule {
android.SetProvider(ctx, testing.TestModuleProviderKey, testing.TestModuleProviderData{})
@@ -2438,31 +2400,6 @@
return apiImportInfo
}
-func GetSnapshot(c LinkableInterface, snapshotInfo **SnapshotInfo, actx android.BottomUpMutatorContext) SnapshotInfo {
- // Only device modules with BOARD_VNDK_VERSION uses snapshot. Others use the zero value of
- // SnapshotInfo, which provides no mappings.
- if *snapshotInfo == nil && c.Device() {
- // Only retrieve the snapshot on demand in order to avoid circular dependencies
- // between the modules in the snapshot and the snapshot itself.
- var snapshotModule []blueprint.Module
- if c.InVendor() && c.VndkVersion() == actx.DeviceConfig().VndkVersion() && actx.OtherModuleExists("vendor_snapshot") {
- snapshotModule = actx.AddVariationDependencies(nil, nil, "vendor_snapshot")
- } else if recoverySnapshotVersion := actx.DeviceConfig().RecoverySnapshotVersion(); recoverySnapshotVersion != "current" && recoverySnapshotVersion != "" && c.InRecovery() && actx.OtherModuleExists("recovery_snapshot") {
- snapshotModule = actx.AddVariationDependencies(nil, nil, "recovery_snapshot")
- }
- if len(snapshotModule) > 0 && snapshotModule[0] != nil {
- snapshot, _ := android.OtherModuleProvider(actx, snapshotModule[0], SnapshotInfoProvider)
- *snapshotInfo = &snapshot
- // republish the snapshot for use in later mutators on this module
- android.SetProvider(actx, SnapshotInfoProvider, snapshot)
- }
- }
- if *snapshotInfo == nil {
- *snapshotInfo = &SnapshotInfo{}
- }
- return **snapshotInfo
-}
-
func GetReplaceModuleName(lib string, replaceMap map[string]string) string {
if snapshot, ok := replaceMap[lib]; ok {
return snapshot
@@ -2471,44 +2408,35 @@
return lib
}
-// RewriteLibs takes a list of names of shared libraries and scans it for three types
+// FilterNdkLibs takes a list of names of shared libraries and scans it for two types
// of names:
//
-// 1. Name of an NDK library that refers to a prebuilt module.
-//
-// For each of these, it adds the name of the prebuilt module (which will be in
-// prebuilts/ndk) to the list of nonvariant libs.
-//
-// 2. Name of an NDK library that refers to an ndk_library module.
+// 1. Name of an NDK library that refers to an ndk_library module.
//
// For each of these, it adds the name of the ndk_library module to the list of
// variant libs.
//
-// 3. Anything else (so anything that isn't an NDK library).
+// 2. Anything else (so anything that isn't an NDK library).
//
// It adds these to the nonvariantLibs list.
//
// The caller can then know to add the variantLibs dependencies differently from the
// nonvariantLibs
-func RewriteLibs(c LinkableInterface, snapshotInfo **SnapshotInfo, actx android.BottomUpMutatorContext, config android.Config, list []string) (nonvariantLibs []string, variantLibs []string) {
+func FilterNdkLibs(c LinkableInterface, config android.Config, list []string) (nonvariantLibs []string, variantLibs []string) {
variantLibs = []string{}
nonvariantLibs = []string{}
for _, entry := range list {
// strip #version suffix out
name, _ := StubsLibNameAndVersion(entry)
- if c.InRecovery() {
- nonvariantLibs = append(nonvariantLibs, GetReplaceModuleName(entry, GetSnapshot(c, snapshotInfo, actx).SharedLibs))
- } else if c.UseSdk() && inList(name, *getNDKKnownLibs(config)) {
+ if c.UseSdk() && inList(name, *getNDKKnownLibs(config)) {
variantLibs = append(variantLibs, name+ndkLibrarySuffix)
- } else if c.UseVndk() {
- nonvariantLibs = append(nonvariantLibs, GetReplaceModuleName(entry, GetSnapshot(c, snapshotInfo, actx).SharedLibs))
} else {
- // put name#version back
nonvariantLibs = append(nonvariantLibs, entry)
}
}
return nonvariantLibs, variantLibs
+
}
func rewriteLibsForApiImports(c LinkableInterface, libs []string, replaceList map[string]string, config android.Config) ([]string, []string) {
@@ -2580,18 +2508,12 @@
c.Properties.AndroidMkSystemSharedLibs = deps.SystemSharedLibs
- var snapshotInfo *SnapshotInfo
-
variantNdkLibs := []string{}
variantLateNdkLibs := []string{}
if ctx.Os() == android.Android {
- deps.SharedLibs, variantNdkLibs = RewriteLibs(c, &snapshotInfo, actx, ctx.Config(), deps.SharedLibs)
- deps.LateSharedLibs, variantLateNdkLibs = RewriteLibs(c, &snapshotInfo, actx, ctx.Config(), deps.LateSharedLibs)
- deps.ReexportSharedLibHeaders, _ = RewriteLibs(c, &snapshotInfo, actx, ctx.Config(), deps.ReexportSharedLibHeaders)
-
- for idx, lib := range deps.RuntimeLibs {
- deps.RuntimeLibs[idx] = GetReplaceModuleName(lib, GetSnapshot(c, &snapshotInfo, actx).SharedLibs)
- }
+ deps.SharedLibs, variantNdkLibs = FilterNdkLibs(c, ctx.Config(), deps.SharedLibs)
+ deps.LateSharedLibs, variantLateNdkLibs = FilterNdkLibs(c, ctx.Config(), deps.LateSharedLibs)
+ deps.ReexportSharedLibHeaders, _ = FilterNdkLibs(c, ctx.Config(), deps.ReexportSharedLibHeaders)
}
for _, lib := range deps.HeaderLibs {
@@ -2604,7 +2526,6 @@
if c.shouldUseApiSurface() {
lib = GetReplaceModuleName(lib, apiImportInfo.HeaderLibs)
}
- lib = GetReplaceModuleName(lib, GetSnapshot(c, &snapshotInfo, actx).HeaderLibs)
if c.isNDKStubLibrary() {
// ndk_headers do not have any variations
@@ -2630,8 +2551,6 @@
for _, lib := range deps.WholeStaticLibs {
depTag := libraryDependencyTag{Kind: staticLibraryDependency, wholeStatic: true, reexportFlags: true}
- lib = GetReplaceModuleName(lib, GetSnapshot(c, &snapshotInfo, actx).StaticLibs)
-
actx.AddVariationDependencies([]blueprint.Variation{
{Mutator: "link", Variation: "static"},
}, depTag, lib)
@@ -2646,8 +2565,6 @@
depTag.excludeInApex = true
}
- lib = GetReplaceModuleName(lib, GetSnapshot(c, &snapshotInfo, actx).StaticLibs)
-
actx.AddVariationDependencies([]blueprint.Variation{
{Mutator: "link", Variation: "static"},
}, depTag, lib)
@@ -2660,7 +2577,7 @@
depTag := libraryDependencyTag{Kind: staticLibraryDependency, staticUnwinder: true}
actx.AddVariationDependencies([]blueprint.Variation{
{Mutator: "link", Variation: "static"},
- }, depTag, GetReplaceModuleName(staticUnwinder(actx), GetSnapshot(c, &snapshotInfo, actx).StaticLibs))
+ }, depTag, staticUnwinder(actx))
}
// shared lib names without the #version suffix
@@ -2701,14 +2618,14 @@
depTag := libraryDependencyTag{Kind: staticLibraryDependency, Order: lateLibraryDependency}
actx.AddVariationDependencies([]blueprint.Variation{
{Mutator: "link", Variation: "static"},
- }, depTag, GetReplaceModuleName(lib, GetSnapshot(c, &snapshotInfo, actx).StaticLibs))
+ }, depTag, lib)
}
for _, lib := range deps.UnexportedStaticLibs {
depTag := libraryDependencyTag{Kind: staticLibraryDependency, Order: lateLibraryDependency, unexportedSymbols: true}
actx.AddVariationDependencies([]blueprint.Variation{
{Mutator: "link", Variation: "static"},
- }, depTag, GetReplaceModuleName(lib, GetSnapshot(c, &snapshotInfo, actx).StaticLibs))
+ }, depTag, lib)
}
for _, lib := range deps.LateSharedLibs {
@@ -2749,11 +2666,11 @@
actx.AddVariationDependencies(crtVariations, objDepTag, deps.ObjFiles...)
for _, crt := range deps.CrtBegin {
actx.AddVariationDependencies(crtVariations, CrtBeginDepTag,
- GetReplaceModuleName(crt, GetSnapshot(c, &snapshotInfo, actx).Objects))
+ crt)
}
for _, crt := range deps.CrtEnd {
actx.AddVariationDependencies(crtVariations, CrtEndDepTag,
- GetReplaceModuleName(crt, GetSnapshot(c, &snapshotInfo, actx).Objects))
+ crt)
}
if deps.DynamicLinker != "" {
actx.AddDependency(c, dynamicLinkerDepTag, deps.DynamicLinker)
@@ -2786,7 +2703,7 @@
actx.AddVariationDependencies([]blueprint.Variation{
c.ImageVariation(),
{Mutator: "link", Variation: "shared"},
- }, vndkExtDepTag, GetReplaceModuleName(vndkdep.getVndkExtendsModuleName(), GetSnapshot(c, &snapshotInfo, actx).SharedLibs))
+ }, vndkExtDepTag, vndkdep.getVndkExtendsModuleName())
}
}
@@ -3394,8 +3311,6 @@
// they merely serve as Make dependencies and do not affect this lib itself.
c.Properties.AndroidMkSharedLibs = append(
c.Properties.AndroidMkSharedLibs, makeLibName)
- // Record BaseLibName for snapshots.
- c.Properties.SnapshotSharedLibs = append(c.Properties.SnapshotSharedLibs, BaseLibName(depName))
case libDepTag.static():
if libDepTag.wholeStatic {
c.Properties.AndroidMkWholeStaticLibs = append(
@@ -3404,8 +3319,6 @@
c.Properties.AndroidMkStaticLibs = append(
c.Properties.AndroidMkStaticLibs, makeLibName)
}
- // Record BaseLibName for snapshots.
- c.Properties.SnapshotStaticLibs = append(c.Properties.SnapshotStaticLibs, BaseLibName(depName))
}
} else if !c.IsStubs() {
// Stubs lib doesn't link to the runtime lib, object, crt, etc. dependencies.
@@ -3414,8 +3327,6 @@
case runtimeDepTag:
c.Properties.AndroidMkRuntimeLibs = append(
c.Properties.AndroidMkRuntimeLibs, MakeLibName(ctx, c, ccDep, ccDep.BaseModuleName())+libDepTag.makeSuffix)
- // Record BaseLibName for snapshots.
- c.Properties.SnapshotRuntimeLibs = append(c.Properties.SnapshotRuntimeLibs, BaseLibName(depName))
case objDepTag:
depPaths.Objs.objFiles = append(depPaths.Objs.objFiles, linkFile.Path())
case CrtBeginDepTag:
@@ -3799,6 +3710,14 @@
return false
}
+func (m *Module) Dylib() bool {
+ return false
+}
+
+func (m *Module) Rlib() bool {
+ return false
+}
+
func GetMakeLinkType(actx android.ModuleContext, c LinkableInterface) string {
if c.InVendorOrProduct() {
if c.IsLlndk() {
@@ -4030,8 +3949,6 @@
return nil
}
-var _ snapshot.RelativeInstallPath = (*Module)(nil)
-
type moduleType int
const (