rename workflow enum for lint

Bug: 339672075
Test: manual
Change-Id: I55f7fff9f1f367e13566fc23fb5379f6732a8e8d
This commit is contained in:
LaMont Jones
2024-05-16 15:45:57 -07:00
parent 693c703ab3
commit 2efc8e2e82
6 changed files with 43 additions and 41 deletions

View File

@@ -16,8 +16,8 @@ import (
) )
var ( var (
// When a flag declaration has an initial value that is a string, the default workflow is PREBUILT. // When a flag declaration has an initial value that is a string, the default workflow is WorkflowPrebuilt.
// If the flag name starts with any of prefixes in manualFlagNamePrefixes, it is MANUAL. // If the flag name starts with any of prefixes in manualFlagNamePrefixes, it is WorkflowManual.
manualFlagNamePrefixes []string = []string{ manualFlagNamePrefixes []string = []string{
"RELEASE_ACONFIG_", "RELEASE_ACONFIG_",
"RELEASE_PLATFORM_", "RELEASE_PLATFORM_",
@@ -133,8 +133,8 @@ func ProcessBuildFlags(dir string, namespaceMap map[string]string) error {
Containers: containers, Containers: containers,
} }
description = "" description = ""
// Most build flags are `workflow: PREBUILT`. // Most build flags are `workflow: WorkflowPrebuilt`.
workflow := rc_proto.Workflow(rc_proto.Workflow_PREBUILT) workflow := rc_proto.Workflow(rc_proto.Workflow_WorkflowPrebuilt)
switch { switch {
case declName == "RELEASE_ACONFIG_VALUE_SETS": case declName == "RELEASE_ACONFIG_VALUE_SETS":
if strings.HasPrefix(declValue, "\"") { if strings.HasPrefix(declValue, "\"") {
@@ -142,21 +142,21 @@ func ProcessBuildFlags(dir string, namespaceMap map[string]string) error {
} }
continue continue
case strings.HasPrefix(declValue, "\""): case strings.HasPrefix(declValue, "\""):
// String values mean that the flag workflow is (most likely) either MANUAL or PREBUILT. // String values mean that the flag workflow is (most likely) either WorkflowManual or WorkflowPrebuilt.
declValue = declValue[1 : len(declValue)-1] declValue = declValue[1 : len(declValue)-1]
flagDeclaration.Value = &rc_proto.Value{Val: &rc_proto.Value_StringValue{declValue}} flagDeclaration.Value = &rc_proto.Value{Val: &rc_proto.Value_StringValue{declValue}}
for _, prefix := range manualFlagNamePrefixes { for _, prefix := range manualFlagNamePrefixes {
if strings.HasPrefix(declName, prefix) { if strings.HasPrefix(declName, prefix) {
workflow = rc_proto.Workflow(rc_proto.Workflow_MANUAL) workflow = rc_proto.Workflow(rc_proto.Workflow_WorkflowManual)
break break
} }
} }
case declValue == "False" || declValue == "True": case declValue == "False" || declValue == "True":
// Boolean values are LAUNCH flags. // Boolean values are WorkflowLaunch flags.
flagDeclaration.Value = &rc_proto.Value{Val: &rc_proto.Value_BoolValue{declValue == "True"}} flagDeclaration.Value = &rc_proto.Value{Val: &rc_proto.Value_BoolValue{declValue == "True"}}
workflow = rc_proto.Workflow(rc_proto.Workflow_LAUNCH) workflow = rc_proto.Workflow(rc_proto.Workflow_WorkflowLaunch)
case declValue == "None": case declValue == "None":
// Use PREBUILT workflow with no initial value. // Use WorkflowPrebuilt workflow with no initial value.
default: default:
fmt.Printf("%s: Unexpected value %s=%s\n", path, declName, declValue) fmt.Printf("%s: Unexpected value %s=%s\n", path, declName, declValue)
} }

View File

@@ -177,7 +177,7 @@ func (config *ReleaseConfig) GenerateReleaseConfig(configs *ReleaseConfigs) erro
contributionsToApply = append(contributionsToApply, config.Contributions...) contributionsToApply = append(contributionsToApply, config.Contributions...)
workflowManual := rc_proto.Workflow(rc_proto.Workflow_MANUAL) workflowManual := rc_proto.Workflow(rc_proto.Workflow_WorkflowManual)
myDirsMap := make(map[int]bool) myDirsMap := make(map[int]bool)
for _, contrib := range contributionsToApply { for _, contrib := range contributionsToApply {
contribAconfigValueSets := []string{} contribAconfigValueSets := []string{}
@@ -211,8 +211,8 @@ func (config *ReleaseConfig) GenerateReleaseConfig(configs *ReleaseConfigs) erro
return fmt.Errorf("Setting value for flag %s not allowed in %s\n", name, value.path) return fmt.Errorf("Setting value for flag %s not allowed in %s\n", name, value.path)
} }
if isRoot && *fa.FlagDeclaration.Workflow != workflowManual { if isRoot && *fa.FlagDeclaration.Workflow != workflowManual {
// The "root" release config can only contain workflow: MANUAL flags. // The "root" release config can only contain workflow: WorkflowManual flags.
return fmt.Errorf("Setting value for non-MANUAL flag %s is not allowed in %s", name, value.path) return fmt.Errorf("Setting value for non-WorkflowManual flag %s is not allowed in %s", name, value.path)
} }
if err := fa.UpdateValue(*value); err != nil { if err := fa.UpdateValue(*value); err != nil {
return err return err

View File

@@ -107,7 +107,7 @@ func ReleaseConfigsFactory() (c *ReleaseConfigs) {
configDirIndexes: make(ReleaseConfigDirMap), configDirIndexes: make(ReleaseConfigDirMap),
FilesUsedMap: make(map[string]bool), FilesUsedMap: make(map[string]bool),
} }
workflowManual := rc_proto.Workflow(rc_proto.Workflow_MANUAL) workflowManual := rc_proto.Workflow(rc_proto.Workflow_WorkflowManual)
releaseAconfigValueSets := FlagArtifact{ releaseAconfigValueSets := FlagArtifact{
FlagDeclaration: &rc_proto.FlagDeclaration{ FlagDeclaration: &rc_proto.FlagDeclaration{
Name: proto.String("RELEASE_ACONFIG_VALUE_SETS"), Name: proto.String("RELEASE_ACONFIG_VALUE_SETS"),

View File

@@ -11,7 +11,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.30.0 // protoc-gen-go v1.33.0
// protoc v3.21.12 // protoc v3.21.12
// source: build_flags_out.proto // source: build_flags_out.proto

View File

@@ -11,7 +11,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT. // Code generated by protoc-gen-go. DO NOT EDIT.
// versions: // versions:
// protoc-gen-go v1.30.0 // protoc-gen-go v1.33.0
// protoc v3.21.12 // protoc v3.21.12
// source: build_flags_src.proto // source: build_flags_src.proto
@@ -34,30 +34,30 @@ const (
type Workflow int32 type Workflow int32
const ( const (
Workflow_UNSPECIFIED_workflow Workflow = 0 Workflow_WorkflowUnspecified Workflow = 0
// Boolean value flags that progress from false to true. // Boolean value flags that progress from false to true.
Workflow_LAUNCH Workflow = 1 Workflow_WorkflowLaunch Workflow = 1
// String value flags that get updated with new version strings to control // String value flags that get updated with new version strings to control
// prebuilt inclusion. // prebuilt inclusion.
Workflow_PREBUILT Workflow = 2 Workflow_WorkflowPrebuilt Workflow = 2
// Manually managed outside flags. These are likely to be found in a // Manually managed outside flags. These are likely to be found in a
// different directory than flags with other workflows. // different directory than flags with other workflows.
Workflow_MANUAL Workflow = 3 Workflow_WorkflowManual Workflow = 3
) )
// Enum value maps for Workflow. // Enum value maps for Workflow.
var ( var (
Workflow_name = map[int32]string{ Workflow_name = map[int32]string{
0: "UNSPECIFIED_workflow", 0: "WorkflowUnspecified",
1: "LAUNCH", 1: "WorkflowLaunch",
2: "PREBUILT", 2: "WorkflowPrebuilt",
3: "MANUAL", 3: "WorkflowManual",
} }
Workflow_value = map[string]int32{ Workflow_value = map[string]int32{
"UNSPECIFIED_workflow": 0, "WorkflowUnspecified": 0,
"LAUNCH": 1, "WorkflowLaunch": 1,
"PREBUILT": 2, "WorkflowPrebuilt": 2,
"MANUAL": 3, "WorkflowManual": 3,
} }
) )
@@ -295,7 +295,7 @@ func (x *FlagDeclaration) GetWorkflow() Workflow {
if x != nil && x.Workflow != nil { if x != nil && x.Workflow != nil {
return *x.Workflow return *x.Workflow
} }
return Workflow_UNSPECIFIED_workflow return Workflow_WorkflowUnspecified
} }
func (x *FlagDeclaration) GetContainers() []string { func (x *FlagDeclaration) GetContainers() []string {
@@ -642,15 +642,17 @@ var file_build_flags_src_proto_rawDesc = []byte{
0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2d, 0x0a, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x2d, 0x0a,
0x12, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x12, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e,
0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x11, 0x64, 0x65, 0x66, 0x61, 0x75, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x11, 0x64, 0x65, 0x66, 0x61, 0x75,
0x6c, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x2a, 0x4a, 0x0a, 0x08, 0x6c, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x2a, 0x61, 0x0a, 0x08,
0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x18, 0x0a, 0x14, 0x55, 0x4e, 0x53, 0x50, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x17, 0x0a, 0x13, 0x57, 0x6f, 0x72, 0x6b,
0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x5f, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x66, 0x6c, 0x6f, 0x77, 0x55, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10,
0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x41, 0x55, 0x4e, 0x43, 0x48, 0x10, 0x01, 0x12, 0x0c, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x4c, 0x61, 0x75,
0x0a, 0x08, 0x50, 0x52, 0x45, 0x42, 0x55, 0x49, 0x4c, 0x54, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x6e, 0x63, 0x68, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f,
0x4d, 0x41, 0x4e, 0x55, 0x41, 0x4c, 0x10, 0x03, 0x42, 0x33, 0x5a, 0x31, 0x61, 0x6e, 0x64, 0x72, 0x77, 0x50, 0x72, 0x65, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x10, 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x57,
0x6f, 0x69, 0x64, 0x2f, 0x73, 0x6f, 0x6f, 0x6e, 0x67, 0x2f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x4d, 0x61, 0x6e, 0x75, 0x61, 0x6c, 0x10, 0x03, 0x42,
0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x33, 0x5a, 0x31, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2f, 0x73, 0x6f, 0x6f, 0x6e, 0x67,
0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f,
0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x70,
0x72, 0x6f, 0x74, 0x6f,
} }
var ( var (

View File

@@ -39,18 +39,18 @@ option go_package = "android/soong/release_config/release_config_proto";
// com.android.1mypackage are invalid // com.android.1mypackage are invalid
enum workflow { enum workflow {
UNSPECIFIED_workflow = 0; WorkflowUnspecified = 0;
// Boolean value flags that progress from false to true. // Boolean value flags that progress from false to true.
LAUNCH = 1; WorkflowLaunch = 1;
// String value flags that get updated with new version strings to control // String value flags that get updated with new version strings to control
// prebuilt inclusion. // prebuilt inclusion.
PREBUILT = 2; WorkflowPrebuilt = 2;
// Manually managed outside flags. These are likely to be found in a // Manually managed outside flags. These are likely to be found in a
// different directory than flags with other workflows. // different directory than flags with other workflows.
MANUAL = 3; WorkflowManual = 3;
} }
message value { message value {