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
This commit is contained in:
Kiyoung Kim
2024-04-04 09:56:15 +09:00
parent 4caca1d797
commit 37693d0a27
37 changed files with 85 additions and 3853 deletions

View File

@@ -104,8 +104,6 @@ type libraryDecorator struct {
includeDirs android.Paths
sourceProvider SourceProvider
collectedSnapshotHeaders android.Paths
// table-of-contents file for cdylib crates to optimize out relinking when possible
tocFile android.OptionalPath
}
@@ -749,55 +747,3 @@ func LibstdMutator(mctx android.BottomUpMutatorContext) {
}
}
}
func (l *libraryDecorator) snapshotHeaders() android.Paths {
if l.collectedSnapshotHeaders == nil {
panic("snapshotHeaders() must be called after collectHeadersForSnapshot()")
}
return l.collectedSnapshotHeaders
}
// collectHeadersForSnapshot collects all exported headers from library.
// It globs header files in the source tree for exported include directories,
// and tracks generated header files separately.
//
// This is to be called from GenerateAndroidBuildActions, and then collected
// header files can be retrieved by snapshotHeaders().
func (l *libraryDecorator) collectHeadersForSnapshot(ctx android.ModuleContext, deps PathDeps) {
ret := android.Paths{}
// Glob together the headers from the modules include_dirs property
for _, path := range android.CopyOfPaths(l.includeDirs) {
dir := path.String()
globDir := dir + "/**/*"
glob, err := ctx.GlobWithDeps(globDir, nil)
if err != nil {
ctx.ModuleErrorf("glob of %q failed: %s", globDir, err)
return
}
for _, header := range glob {
// Filter out only the files with extensions that are headers.
found := false
for _, ext := range cc.HeaderExts {
if strings.HasSuffix(header, ext) {
found = true
break
}
}
if !found {
continue
}
ret = append(ret, android.PathForSource(ctx, header))
}
}
// Glob together the headers from C dependencies as well, starting with non-generated headers.
ret = append(ret, cc.GlobHeadersForSnapshot(ctx, append(android.CopyOfPaths(deps.depIncludePaths), deps.depSystemIncludePaths...))...)
// Collect generated headers from C dependencies.
ret = append(ret, cc.GlobGeneratedHeadersForSnapshot(ctx, deps.depGeneratedHeaders)...)
// TODO(185577950): If support for generated headers is added, they need to be collected here as well.
l.collectedSnapshotHeaders = ret
}