Merge "Log warnings to stdout instead of stderr" into main
diff --git a/android/module.go b/android/module.go
index 4dc1688..c4cc5e6 100644
--- a/android/module.go
+++ b/android/module.go
@@ -2157,8 +2157,18 @@
ctx.OtherModulePropertyErrorf(m, property, "release_flag requires 1 argument, found %d", condition.NumArgs())
return proptools.ConfigurableValueUndefined()
}
- if v, ok := ctx.Config().productVariables.BuildFlags[condition.Arg(0)]; ok {
- return proptools.ConfigurableValueString(v)
+ if ty, ok := ctx.Config().productVariables.BuildFlagTypes[condition.Arg(0)]; ok {
+ v := ctx.Config().productVariables.BuildFlags[condition.Arg(0)]
+ switch ty {
+ case "unspecified", "obsolete":
+ return proptools.ConfigurableValueUndefined()
+ case "string":
+ return proptools.ConfigurableValueString(v)
+ case "bool":
+ return proptools.ConfigurableValueBool(v == "true")
+ default:
+ panic("unhandled release flag type: " + ty)
+ }
}
return proptools.ConfigurableValueUndefined()
case "product_variable":
diff --git a/android/variable.go b/android/variable.go
index 419bd61..a3fdafb 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -492,6 +492,8 @@
BuildFlags map[string]string `json:",omitempty"`
+ BuildFlagTypes map[string]string `json:",omitempty"`
+
BuildFromSourceStub *bool `json:",omitempty"`
BuildIgnoreApexContributionContents *bool `json:",omitempty"`
diff --git a/cmd/release_config/crunch_flags/main.go b/cmd/release_config/crunch_flags/main.go
index 44e5539..cd39ffd 100644
--- a/cmd/release_config/crunch_flags/main.go
+++ b/cmd/release_config/crunch_flags/main.go
@@ -16,8 +16,8 @@
)
var (
- // When a flag declaration has an initial value that is a string, the default workflow is Workflow_Prebuilt.
- // If the flag name starts with any of prefixes in manualFlagNamePrefixes, it is Workflow_Manual.
+ // When a flag declaration has an initial value that is a string, the default workflow is PREBUILT.
+ // If the flag name starts with any of prefixes in manualFlagNamePrefixes, it is MANUAL.
manualFlagNamePrefixes []string = []string{
"RELEASE_ACONFIG_",
"RELEASE_PLATFORM_",
@@ -133,8 +133,8 @@
Containers: containers,
}
description = ""
- // Most build flags are `workflow: Workflow_Prebuilt`.
- workflow := rc_proto.Workflow(rc_proto.Workflow_Workflow_Prebuilt)
+ // Most build flags are `workflow: PREBUILT`.
+ workflow := rc_proto.Workflow(rc_proto.Workflow_PREBUILT)
switch {
case declName == "RELEASE_ACONFIG_VALUE_SETS":
if strings.HasPrefix(declValue, "\"") {
@@ -142,21 +142,21 @@
}
continue
case strings.HasPrefix(declValue, "\""):
- // String values mean that the flag workflow is (most likely) either Workflow_Manual or Workflow_Prebuilt.
+ // String values mean that the flag workflow is (most likely) either MANUAL or PREBUILT.
declValue = declValue[1 : len(declValue)-1]
flagDeclaration.Value = &rc_proto.Value{Val: &rc_proto.Value_StringValue{declValue}}
for _, prefix := range manualFlagNamePrefixes {
if strings.HasPrefix(declName, prefix) {
- workflow = rc_proto.Workflow(rc_proto.Workflow_Workflow_Manual)
+ workflow = rc_proto.Workflow(rc_proto.Workflow_MANUAL)
break
}
}
case declValue == "False" || declValue == "True":
- // Boolean values are Workflow_Launch flags.
+ // Boolean values are LAUNCH flags.
flagDeclaration.Value = &rc_proto.Value{Val: &rc_proto.Value_BoolValue{declValue == "True"}}
- workflow = rc_proto.Workflow(rc_proto.Workflow_Workflow_Launch)
+ workflow = rc_proto.Workflow(rc_proto.Workflow_LAUNCH)
case declValue == "None":
- // Use Workflow_Prebuilt workflow with no initial value.
+ // Use PREBUILT workflow with no initial value.
default:
fmt.Printf("%s: Unexpected value %s=%s\n", path, declName, declValue)
}
diff --git a/cmd/release_config/release_config_lib/flag_value.go b/cmd/release_config/release_config_lib/flag_value.go
index 59021e2..76363ce 100644
--- a/cmd/release_config/release_config_lib/flag_value.go
+++ b/cmd/release_config/release_config_lib/flag_value.go
@@ -74,3 +74,22 @@
return ""
}
}
+
+// Returns a string representation of the type of the value for make
+func ValueType(value *rc_proto.Value) string {
+ if value == nil || value.Val == nil {
+ return "unspecified"
+ }
+ switch value.Val.(type) {
+ case *rc_proto.Value_UnspecifiedValue:
+ return "unspecified"
+ case *rc_proto.Value_StringValue:
+ return "string"
+ case *rc_proto.Value_BoolValue:
+ return "bool"
+ case *rc_proto.Value_Obsolete:
+ return "obsolete"
+ default:
+ panic("Unhandled type")
+ }
+}
diff --git a/cmd/release_config/release_config_lib/release_config.go b/cmd/release_config/release_config_lib/release_config.go
index a1b10f5..547f0dc 100644
--- a/cmd/release_config/release_config_lib/release_config.go
+++ b/cmd/release_config/release_config_lib/release_config.go
@@ -177,7 +177,7 @@
contributionsToApply = append(contributionsToApply, config.Contributions...)
- workflowManual := rc_proto.Workflow(rc_proto.Workflow_Workflow_Manual)
+ workflowManual := rc_proto.Workflow(rc_proto.Workflow_MANUAL)
myDirsMap := make(map[int]bool)
for _, contrib := range contributionsToApply {
contribAconfigValueSets := []string{}
@@ -211,8 +211,8 @@
return fmt.Errorf("Setting value for flag %s not allowed in %s\n", name, value.path)
}
if isRoot && *fa.FlagDeclaration.Workflow != workflowManual {
- // The "root" release config can only contain workflow: Workflow_Manual flags.
- return fmt.Errorf("Setting value for non-Workflow_Manual flag %s is not allowed in %s", name, value.path)
+ // The "root" release config can only contain workflow: MANUAL flags.
+ return fmt.Errorf("Setting value for non-MANUAL flag %s is not allowed in %s", name, value.path)
}
if err := fa.UpdateValue(*value); err != nil {
return err
diff --git a/cmd/release_config/release_config_lib/release_configs.go b/cmd/release_config/release_config_lib/release_configs.go
index 403ba1a..c62a78e 100644
--- a/cmd/release_config/release_config_lib/release_configs.go
+++ b/cmd/release_config/release_config_lib/release_configs.go
@@ -107,7 +107,7 @@
configDirIndexes: make(ReleaseConfigDirMap),
FilesUsedMap: make(map[string]bool),
}
- workflowManual := rc_proto.Workflow(rc_proto.Workflow_Workflow_Manual)
+ workflowManual := rc_proto.Workflow(rc_proto.Workflow_MANUAL)
releaseAconfigValueSets := FlagArtifact{
FlagDeclaration: &rc_proto.FlagDeclaration{
Name: proto.String("RELEASE_ACONFIG_VALUE_SETS"),
@@ -348,6 +348,7 @@
}
value := MarshalValue(flag.Value)
makeVars[name] = value
+ addVar(name, "TYPE", ValueType(flag.Value))
addVar(name, "PARTITIONS", strings.Join(decl.Containers, " "))
addVar(name, "DEFAULT", MarshalValue(decl.Value))
addVar(name, "VALUE", value)
@@ -356,7 +357,7 @@
addVar(name, "NAMESPACE", *decl.Namespace)
}
pNames := []string{}
- for k, _ := range partitions {
+ for k := range partitions {
pNames = append(pNames, k)
}
slices.SortFunc(pNames, func(a, b string) int {
diff --git a/cmd/release_config/release_config_lib/util.go b/cmd/release_config/release_config_lib/util.go
index 4e22a54..0af99a6 100644
--- a/cmd/release_config/release_config_lib/util.go
+++ b/cmd/release_config/release_config_lib/util.go
@@ -219,6 +219,7 @@
var stdout strings.Builder
getBuildVar.Stdin = strings.NewReader("")
getBuildVar.Stdout = &stdout
+ getBuildVar.Stderr = os.Stderr
err = getBuildVar.Run()
if err != nil {
return
diff --git a/cmd/release_config/release_config_proto/build_flags_src.pb.go b/cmd/release_config/release_config_proto/build_flags_src.pb.go
index 1a3fb80..a538236 100644
--- a/cmd/release_config/release_config_proto/build_flags_src.pb.go
+++ b/cmd/release_config/release_config_proto/build_flags_src.pb.go
@@ -40,28 +40,28 @@
const (
Workflow_Workflow_Unspecified Workflow = 0
// Boolean value flags that progress from false to true.
- Workflow_Workflow_Launch Workflow = 1
+ Workflow_LAUNCH Workflow = 1
// String value flags that get updated with new version strings to control
// prebuilt inclusion.
- Workflow_Workflow_Prebuilt Workflow = 2
+ Workflow_PREBUILT Workflow = 2
// Manually managed outside flags. These are likely to be found in a
// different directory than flags with other workflows.
- Workflow_Workflow_Manual Workflow = 3
+ Workflow_MANUAL Workflow = 3
)
// Enum value maps for Workflow.
var (
Workflow_name = map[int32]string{
0: "Workflow_Unspecified",
- 1: "Workflow_Launch",
- 2: "Workflow_Prebuilt",
- 3: "Workflow_Manual",
+ 1: "LAUNCH",
+ 2: "PREBUILT",
+ 3: "MANUAL",
}
Workflow_value = map[string]int32{
"Workflow_Unspecified": 0,
- "Workflow_Launch": 1,
- "Workflow_Prebuilt": 2,
- "Workflow_Manual": 3,
+ "LAUNCH": 1,
+ "PREBUILT": 2,
+ "MANUAL": 3,
}
)
@@ -646,17 +646,15 @@
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,
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, 0x65, 0x0a, 0x08,
+ 0x6c, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x2a, 0x4a, 0x0a, 0x08,
0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x18, 0x0a, 0x14, 0x57, 0x6f, 0x72, 0x6b,
0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x55, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64,
- 0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x4c,
- 0x61, 0x75, 0x6e, 0x63, 0x68, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x57, 0x6f, 0x72, 0x6b, 0x66,
- 0x6c, 0x6f, 0x77, 0x5f, 0x50, 0x72, 0x65, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x10, 0x02, 0x12, 0x13,
- 0x0a, 0x0f, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x4d, 0x61, 0x6e, 0x75, 0x61,
- 0x6c, 0x10, 0x03, 0x42, 0x33, 0x5a, 0x31, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2f, 0x73,
- 0x6f, 0x6f, 0x6e, 0x67, 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,
+ 0x10, 0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4c, 0x41, 0x55, 0x4e, 0x43, 0x48, 0x10, 0x01, 0x12, 0x0c,
+ 0x0a, 0x08, 0x50, 0x52, 0x45, 0x42, 0x55, 0x49, 0x4c, 0x54, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06,
+ 0x4d, 0x41, 0x4e, 0x55, 0x41, 0x4c, 0x10, 0x03, 0x42, 0x33, 0x5a, 0x31, 0x61, 0x6e, 0x64, 0x72,
+ 0x6f, 0x69, 0x64, 0x2f, 0x73, 0x6f, 0x6f, 0x6e, 0x67, 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 (
diff --git a/cmd/release_config/release_config_proto/build_flags_src.proto b/cmd/release_config/release_config_proto/build_flags_src.proto
index 6a8e96e..cb0d9d9 100644
--- a/cmd/release_config/release_config_proto/build_flags_src.proto
+++ b/cmd/release_config/release_config_proto/build_flags_src.proto
@@ -46,15 +46,15 @@
Workflow_Unspecified = 0;
// Boolean value flags that progress from false to true.
- Workflow_Launch = 1;
+ LAUNCH = 1;
// String value flags that get updated with new version strings to control
// prebuilt inclusion.
- Workflow_Prebuilt = 2;
+ PREBUILT = 2;
// Manually managed outside flags. These are likely to be found in a
// different directory than flags with other workflows.
- Workflow_Manual = 3;
+ MANUAL = 3;
}
message value {
diff --git a/java/sdk_library.go b/java/sdk_library.go
index 645f513..8c91288 100644
--- a/java/sdk_library.go
+++ b/java/sdk_library.go
@@ -1504,6 +1504,12 @@
var implLibraryTag = sdkLibraryComponentTag{name: "impl-library"}
+var _ android.InstallNeededDependencyTag = sdkLibraryComponentTag{}
+
+func (t sdkLibraryComponentTag) InstallDepNeeded() bool {
+ return t.name == "xml-permissions-file" || t.name == "impl-library"
+}
+
// Add the dependencies on the child modules in the component deps mutator.
func (module *SdkLibrary) ComponentDepsMutator(ctx android.BottomUpMutatorContext) {
for _, apiScope := range module.getGeneratedApiScopes(ctx) {