release_config: container is a repeated string field
Container is a string, and a flag can be in more than one container.
Bug: 328495189
Test: manual
Change-Id: I5a2a9855532027584d2b67f63f1b9584fce3d8d9
diff --git a/cmd/release_config/crunch_flags/main.go b/cmd/release_config/crunch_flags/main.go
index 29290a4..5b64062 100644
--- a/cmd/release_config/crunch_flags/main.go
+++ b/cmd/release_config/crunch_flags/main.go
@@ -102,10 +102,13 @@
description = ""
continue
}
- declValue := matches[declRegexp.SubexpIndex("value")]
declName := matches[declRegexp.SubexpIndex("name")]
- container := rc_proto.Container(rc_proto.Container_value[matches[declRegexp.SubexpIndex("container")]])
+ declValue := matches[declRegexp.SubexpIndex("value")]
description = strings.TrimSpace(description)
+ containers := []string{strings.ToLower(matches[declRegexp.SubexpIndex("container")])}
+ if containers[0] == "all" {
+ containers = []string{"product", "system", "system_ext", "vendor"}
+ }
var namespace string
var ok bool
if namespace, ok = namespaceMap[declName]; !ok {
@@ -115,7 +118,7 @@
Name: proto.String(declName),
Namespace: proto.String(namespace),
Description: proto.String(description),
- Container: &container,
+ Containers: containers,
}
description = ""
// Most build flags are `workflow: PREBUILT`.
@@ -213,6 +216,12 @@
return err
}
+var (
+ allContainers = func() []string {
+ return []string{"product", "system", "system_ext", "vendor"}
+ }()
+)
+
func ProcessReleaseConfigMap(dir string, descriptionMap map[string]string) error {
path := filepath.Join(dir, "release_config_map.mk")
if _, err := os.Stat(path); err != nil {
@@ -235,16 +244,16 @@
return err
}
cleanDir := strings.TrimLeft(dir, "../")
- var defaultContainer rc_proto.Container
+ var defaultContainers []string
switch {
case strings.HasPrefix(cleanDir, "build/") || cleanDir == "vendor/google_shared/build":
- defaultContainer = rc_proto.Container(rc_proto.Container_ALL)
+ defaultContainers = allContainers
case cleanDir == "vendor/google/release":
- defaultContainer = rc_proto.Container(rc_proto.Container_ALL)
+ defaultContainers = allContainers
default:
- defaultContainer = rc_proto.Container(rc_proto.Container_VENDOR)
+ defaultContainers = []string{"vendor"}
}
- releaseConfigMap := &rc_proto.ReleaseConfigMap{DefaultContainer: &defaultContainer}
+ releaseConfigMap := &rc_proto.ReleaseConfigMap{DefaultContainers: defaultContainers}
// If we find a description for the directory, include it.
if description, ok := descriptionMap[cleanDir]; ok {
releaseConfigMap.Description = proto.String(description)