summaryrefslogtreecommitdiff
path: root/cc/snapshot_utils.go
diff options
context:
space:
mode:
author Inseob Kim <inseob@google.com> 2020-01-22 11:11:29 +0900
committer Inseob Kim <inseob@google.com> 2020-02-07 02:59:24 +0900
commiteec88e1de8861f221fec0644500a3f80c181f57e (patch)
tree534e2a7622f4b9f59d8d432d31abf81bd942f798 /cc/snapshot_utils.go
parent8471cdaced6a8c240ec9908916c567ef9c0dac5b (diff)
Add vendor snapshot modules
This implements four modules (static/shared/header libraries, and binaries) for vendor snapshot. These modules will override source modules if BOARD_VNDK_VERSION != current. Bug: 65377115 Test: 1) VNDK_SNAPSHOT_BUILD_ARTIFACTS=true m dist vndk vendor-snapshot Test: 2) install snapshot under source tree Test: 3) set BOARD_VNDK_VERSION and boot cuttlefish Change-Id: I24ddb4c3aa6abeab60bbfd31bcbd8753e2592dc5
Diffstat (limited to 'cc/snapshot_utils.go')
-rw-r--r--cc/snapshot_utils.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/cc/snapshot_utils.go b/cc/snapshot_utils.go
index 1c872c2c9..8f48f869b 100644
--- a/cc/snapshot_utils.go
+++ b/cc/snapshot_utils.go
@@ -31,6 +31,33 @@ type snapshotLibraryInterface interface {
var _ snapshotLibraryInterface = (*prebuiltLibraryLinker)(nil)
var _ snapshotLibraryInterface = (*libraryDecorator)(nil)
+type snapshotMap struct {
+ snapshots map[string]string
+}
+
+func newSnapshotMap() *snapshotMap {
+ return &snapshotMap{
+ snapshots: make(map[string]string),
+ }
+}
+
+func snapshotMapKey(name string, arch android.ArchType) string {
+ return name + ":" + arch.String()
+}
+
+// Adds a snapshot name for given module name and architecture.
+// e.g. add("libbase", X86, "libbase.vndk.29.x86")
+func (s *snapshotMap) add(name string, arch android.ArchType, snapshot string) {
+ s.snapshots[snapshotMapKey(name, arch)] = snapshot
+}
+
+// Returns snapshot name for given module name and architecture, if found.
+// e.g. get("libcutils", X86) => "libcutils.vndk.29.x86", true
+func (s *snapshotMap) get(name string, arch android.ArchType) (snapshot string, found bool) {
+ snapshot, found = s.snapshots[snapshotMapKey(name, arch)]
+ return snapshot, found
+}
+
func exportedHeaders(ctx android.SingletonContext, l exportedFlagsProducer) android.Paths {
var ret android.Paths