diff options
author | 2021-04-01 09:49:36 -0400 | |
---|---|---|
committer | 2021-05-12 14:01:10 -0400 | |
commit | d7586b6526f6db839d368587fb58574db9b7042a (patch) | |
tree | f391b4f50b010e8fad32bfd0492c362a0b95482b /cc/snapshot_utils.go | |
parent | c8aeb00a9cb273acc4b4f92beddf592642cc3e5e (diff) |
Refactor vendor snapshot to use LinkableInterface.
Refactors the vendor snapshot support to use the LinkableInterface
so that support can be extended to Rust. This CL does not add
vendor snapshot support for Rust; that is left for a follow-on CL.
Bug: 184042776
Test: m nothing
Change-Id: Id0c4970ca00053484a52677d182153cbc454c301
Diffstat (limited to 'cc/snapshot_utils.go')
-rw-r--r-- | cc/snapshot_utils.go | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/cc/snapshot_utils.go b/cc/snapshot_utils.go index c32fa364f..8eb616448 100644 --- a/cc/snapshot_utils.go +++ b/cc/snapshot_utils.go @@ -23,6 +23,36 @@ var ( headerExts = []string{".h", ".hh", ".hpp", ".hxx", ".h++", ".inl", ".inc", ".ipp", ".h.generic"} ) +func (m *Module) IsSnapshotLibrary() bool { + if _, ok := m.linker.(snapshotLibraryInterface); ok { + return true + } + return false +} + +func (m *Module) SnapshotHeaders() android.Paths { + if m.IsSnapshotLibrary() { + return m.linker.(snapshotLibraryInterface).snapshotHeaders() + } + return android.Paths{} +} + +func (m *Module) Dylib() bool { + return false +} + +func (m *Module) Rlib() bool { + return false +} + +func (m *Module) SnapshotRuntimeLibs() []string { + return m.Properties.SnapshotRuntimeLibs +} + +func (m *Module) SnapshotSharedLibs() []string { + return m.Properties.SnapshotSharedLibs +} + // snapshotLibraryInterface is an interface for libraries captured to VNDK / vendor snapshots. type snapshotLibraryInterface interface { libraryInterface @@ -68,14 +98,14 @@ func (s *snapshotMap) get(name string, arch android.ArchType) (snapshot string, return snapshot, found } -// shouldCollectHeadersForSnapshot determines if the module is a possible candidate for snapshot. +// ShouldCollectHeadersForSnapshot determines if the module is a possible candidate for snapshot. // If it's true, collectHeadersForSnapshot will be called in GenerateAndroidBuildActions. -func shouldCollectHeadersForSnapshot(ctx android.ModuleContext, m *Module, apexInfo android.ApexInfo) bool { +func ShouldCollectHeadersForSnapshot(ctx android.ModuleContext, m LinkableInterface, apexInfo android.ApexInfo) bool { if ctx.DeviceConfig().VndkVersion() != "current" && ctx.DeviceConfig().RecoverySnapshotVersion() != "current" { return false } - if _, _, ok := isVndkSnapshotAware(ctx.DeviceConfig(), m, apexInfo); ok { + if _, ok := isVndkSnapshotAware(ctx.DeviceConfig(), m, apexInfo); ok { return ctx.Config().VndkSnapshotBuildArtifacts() } |