summaryrefslogtreecommitdiff
path: root/cc
diff options
context:
space:
mode:
authorJustin Yun <justinyun@google.com>2021-07-13 11:36:24 +0900
committerJustin Yun <justinyun@google.com>2021-07-13 15:06:42 +0900
commit6e2b7ed2c3cbe15ec1fffb493ec2381fd6ef2145 (patch)
tree26d289da9a7cef242bc83f47b90d2cd002d941bb /cc
parentef25c8777180f88650dad8bd2499e8c8c9d174b7 (diff)
Export paths for the snapshot modules
Some makefiles require the paths to the snapshot to use the snapshot resources. Export SOONG_{IMAGE}_{VERSION}_SNAPSHOT_DIR to make. Bug: 187222756 Test: check ninja depedency with and without snasphots. Change-Id: Ie817285d43db094335e4c81ebb6eca7007c5f37d (cherry picked from commit d9e05750ba0f91f1a492ce95187237db859db887)
Diffstat (limited to 'cc')
-rw-r--r--cc/snapshot_prebuilt.go20
1 files changed, 19 insertions, 1 deletions
diff --git a/cc/snapshot_prebuilt.go b/cc/snapshot_prebuilt.go
index 435d50793..e52d74881 100644
--- a/cc/snapshot_prebuilt.go
+++ b/cc/snapshot_prebuilt.go
@@ -325,11 +325,11 @@ var vendorSnapshotImageSingleton vendorSnapshotImage
var recoverySnapshotImageSingleton recoverySnapshotImage
var ramdiskSnapshotImageSingleton ramdiskSnapshotImage
-
func init() {
vendorSnapshotImageSingleton.init(android.InitRegistrationContext)
recoverySnapshotImageSingleton.init(android.InitRegistrationContext)
ramdiskSnapshotImageSingleton.init(android.InitRegistrationContext)
+ android.RegisterMakeVarsProvider(pctx, snapshotMakeVarsProvider)
}
const (
@@ -445,6 +445,24 @@ var SnapshotInfoProvider = blueprint.NewMutatorProvider(SnapshotInfo{}, "deps")
var _ android.ImageInterface = (*snapshot)(nil)
+func snapshotMakeVarsProvider(ctx android.MakeVarsContext) {
+ snapshotSet := map[string]struct{}{}
+ ctx.VisitAllModules(func(m android.Module) {
+ if s, ok := m.(*snapshot); ok {
+ if _, ok := snapshotSet[s.Name()]; ok {
+ // arch variant generates duplicated modules
+ // skip this as we only need to know the path of the module.
+ return
+ }
+ snapshotSet[s.Name()] = struct{}{}
+ imageNameVersion := strings.Split(s.image.imageVariantName(ctx.DeviceConfig()), ".")
+ ctx.Strict(
+ strings.Join([]string{strings.ToUpper(imageNameVersion[0]), s.baseSnapshot.version(), "SNAPSHOT_DIR"}, "_"),
+ ctx.ModuleDir(s))
+ }
+ })
+}
+
func vendorSnapshotFactory() android.Module {
return snapshotFactory(vendorSnapshotImageSingleton)
}