Merge changes I6b1d6dcd,I97eb864e,I155c26b1 into main
* changes: Minor flagging cleanup Add build_flag_declarations module Add build-flag-declarations tool
This commit is contained in:
23
aconfig/build_flags/Android.bp
Normal file
23
aconfig/build_flags/Android.bp
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
package {
|
||||||
|
default_applicable_licenses: ["Android-Apache-2.0"],
|
||||||
|
}
|
||||||
|
|
||||||
|
bootstrap_go_package {
|
||||||
|
name: "soong-aconfig-build_flags",
|
||||||
|
pkgPath: "android/soong/aconfig/build_flags",
|
||||||
|
deps: [
|
||||||
|
"blueprint",
|
||||||
|
"blueprint-pathtools",
|
||||||
|
"sbox_proto",
|
||||||
|
"soong",
|
||||||
|
"soong-android",
|
||||||
|
],
|
||||||
|
srcs: [
|
||||||
|
"all_build_flag_declarations.go",
|
||||||
|
"declarations.go",
|
||||||
|
"init.go",
|
||||||
|
],
|
||||||
|
testSrcs: [
|
||||||
|
],
|
||||||
|
pluginFor: ["soong_build"],
|
||||||
|
}
|
78
aconfig/build_flags/all_build_flag_declarations.go
Normal file
78
aconfig/build_flags/all_build_flag_declarations.go
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
// Copyright 2023 Google Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package build_flags
|
||||||
|
|
||||||
|
import (
|
||||||
|
"android/soong/android"
|
||||||
|
)
|
||||||
|
|
||||||
|
// A singleton module that collects all of the build flags declared in the
|
||||||
|
// tree into a single combined file for export to the external flag setting
|
||||||
|
// server (inside Google it's Gantry).
|
||||||
|
//
|
||||||
|
// Note that this is ALL build_declarations modules present in the tree, not just
|
||||||
|
// ones that are relevant to the product currently being built, so that that infra
|
||||||
|
// doesn't need to pull from multiple builds and merge them.
|
||||||
|
func AllBuildFlagDeclarationsFactory() android.Singleton {
|
||||||
|
return &allBuildFlagDeclarationsSingleton{}
|
||||||
|
}
|
||||||
|
|
||||||
|
type allBuildFlagDeclarationsSingleton struct {
|
||||||
|
intermediateBinaryProtoPath android.OutputPath
|
||||||
|
intermediateTextProtoPath android.OutputPath
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *allBuildFlagDeclarationsSingleton) GenerateBuildActions(ctx android.SingletonContext) {
|
||||||
|
// Find all of the build_flag_declarations modules
|
||||||
|
var intermediateFiles android.Paths
|
||||||
|
ctx.VisitAllModules(func(module android.Module) {
|
||||||
|
decl, ok := android.SingletonModuleProvider(ctx, module, BuildFlagDeclarationsProviderKey)
|
||||||
|
if !ok {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
intermediateFiles = append(intermediateFiles, decl.IntermediateCacheOutputPath)
|
||||||
|
})
|
||||||
|
|
||||||
|
// Generate build action for build_flag (binary proto output)
|
||||||
|
this.intermediateBinaryProtoPath = android.PathForIntermediates(ctx, "all_build_flag_declarations.pb")
|
||||||
|
ctx.Build(pctx, android.BuildParams{
|
||||||
|
Rule: allDeclarationsRule,
|
||||||
|
Inputs: intermediateFiles,
|
||||||
|
Output: this.intermediateBinaryProtoPath,
|
||||||
|
Description: "all_build_flag_declarations",
|
||||||
|
Args: map[string]string{
|
||||||
|
"intermediates": android.JoinPathsWithPrefix(intermediateFiles, "--intermediate "),
|
||||||
|
},
|
||||||
|
})
|
||||||
|
ctx.Phony("all_build_flag_declarations", this.intermediateBinaryProtoPath)
|
||||||
|
|
||||||
|
// Generate build action for build_flag (text proto output)
|
||||||
|
this.intermediateTextProtoPath = android.PathForIntermediates(ctx, "all_build_flag_declarations.textproto")
|
||||||
|
ctx.Build(pctx, android.BuildParams{
|
||||||
|
Rule: allDeclarationsRuleTextProto,
|
||||||
|
Input: this.intermediateBinaryProtoPath,
|
||||||
|
Output: this.intermediateTextProtoPath,
|
||||||
|
Description: "all_build_flag_declarations_textproto",
|
||||||
|
})
|
||||||
|
ctx.Phony("all_build_flag_declarations_textproto", this.intermediateTextProtoPath)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (this *allBuildFlagDeclarationsSingleton) MakeVars(ctx android.MakeVarsContext) {
|
||||||
|
ctx.DistForGoal("droid", this.intermediateBinaryProtoPath)
|
||||||
|
for _, goal := range []string{"docs", "droid", "sdk"} {
|
||||||
|
ctx.DistForGoalWithFilename(goal, this.intermediateBinaryProtoPath, "build_flags/all_flags.pb")
|
||||||
|
ctx.DistForGoalWithFilename(goal, this.intermediateTextProtoPath, "build_flags/all_flags.textproto")
|
||||||
|
}
|
||||||
|
}
|
118
aconfig/build_flags/declarations.go
Normal file
118
aconfig/build_flags/declarations.go
Normal file
@@ -0,0 +1,118 @@
|
|||||||
|
// Copyright 2023 Google Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package build_flags
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
|
"android/soong/android"
|
||||||
|
|
||||||
|
"github.com/google/blueprint"
|
||||||
|
)
|
||||||
|
|
||||||
|
type BuildFlagDeclarationsProviderData struct {
|
||||||
|
IntermediateCacheOutputPath android.WritablePath
|
||||||
|
IntermediateDumpOutputPath android.WritablePath
|
||||||
|
}
|
||||||
|
|
||||||
|
var BuildFlagDeclarationsProviderKey = blueprint.NewProvider[BuildFlagDeclarationsProviderData]()
|
||||||
|
|
||||||
|
type DeclarationsModule struct {
|
||||||
|
android.ModuleBase
|
||||||
|
android.DefaultableModuleBase
|
||||||
|
|
||||||
|
// Properties for "aconfig_declarations"
|
||||||
|
properties struct {
|
||||||
|
// aconfig files, relative to this Android.bp file
|
||||||
|
Srcs []string `android:"path"`
|
||||||
|
}
|
||||||
|
|
||||||
|
intermediatePath android.WritablePath
|
||||||
|
}
|
||||||
|
|
||||||
|
func DeclarationsFactory() android.Module {
|
||||||
|
module := &DeclarationsModule{}
|
||||||
|
|
||||||
|
android.InitAndroidModule(module)
|
||||||
|
android.InitDefaultableModule(module)
|
||||||
|
module.AddProperties(&module.properties)
|
||||||
|
|
||||||
|
return module
|
||||||
|
}
|
||||||
|
|
||||||
|
func (module *DeclarationsModule) OutputFiles(tag string) (android.Paths, error) {
|
||||||
|
switch tag {
|
||||||
|
case "":
|
||||||
|
// The default output of this module is the intermediates format, which is
|
||||||
|
// not installable and in a private format that no other rules can handle
|
||||||
|
// correctly.
|
||||||
|
return []android.Path{module.intermediatePath}, nil
|
||||||
|
default:
|
||||||
|
return nil, fmt.Errorf("unsupported build_flags_declarations module reference tag %q", tag)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func joinAndPrefix(prefix string, values []string) string {
|
||||||
|
var sb strings.Builder
|
||||||
|
for _, v := range values {
|
||||||
|
sb.WriteString(prefix)
|
||||||
|
sb.WriteString(v)
|
||||||
|
}
|
||||||
|
return sb.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
func optionalVariable(prefix string, value string) string {
|
||||||
|
var sb strings.Builder
|
||||||
|
if value != "" {
|
||||||
|
sb.WriteString(prefix)
|
||||||
|
sb.WriteString(value)
|
||||||
|
}
|
||||||
|
return sb.String()
|
||||||
|
}
|
||||||
|
|
||||||
|
func (module *DeclarationsModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
|
// Intermediate format
|
||||||
|
declarationFiles := android.PathsForModuleSrc(ctx, module.properties.Srcs)
|
||||||
|
intermediateCacheFilePath := android.PathForModuleOut(ctx, "build_flag_intermediate.pb")
|
||||||
|
inputFiles := make([]android.Path, len(declarationFiles))
|
||||||
|
copy(inputFiles, declarationFiles)
|
||||||
|
|
||||||
|
// TODO(lamont): generate the rc_proto.FlagArtifacts message for the sources.
|
||||||
|
args := map[string]string{
|
||||||
|
"release_version": ctx.Config().ReleaseVersion(),
|
||||||
|
"declarations": android.JoinPathsWithPrefix(declarationFiles, "--decl "),
|
||||||
|
}
|
||||||
|
ctx.Build(pctx, android.BuildParams{
|
||||||
|
Rule: buildFlagRule,
|
||||||
|
Output: intermediateCacheFilePath,
|
||||||
|
Inputs: inputFiles,
|
||||||
|
Description: "build_flag_declarations",
|
||||||
|
Args: args,
|
||||||
|
})
|
||||||
|
|
||||||
|
intermediateDumpFilePath := android.PathForModuleOut(ctx, "build_flag_intermediate.textproto")
|
||||||
|
ctx.Build(pctx, android.BuildParams{
|
||||||
|
Rule: buildFlagTextRule,
|
||||||
|
Output: intermediateDumpFilePath,
|
||||||
|
Input: intermediateCacheFilePath,
|
||||||
|
Description: "build_flag_declarations_text",
|
||||||
|
})
|
||||||
|
|
||||||
|
android.SetProvider(ctx, BuildFlagDeclarationsProviderKey, BuildFlagDeclarationsProviderData{
|
||||||
|
IntermediateCacheOutputPath: intermediateCacheFilePath,
|
||||||
|
IntermediateDumpOutputPath: intermediateDumpFilePath,
|
||||||
|
})
|
||||||
|
}
|
78
aconfig/build_flags/init.go
Normal file
78
aconfig/build_flags/init.go
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
// Copyright 2023 Google Inc. All rights reserved.
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
package build_flags
|
||||||
|
|
||||||
|
import (
|
||||||
|
"android/soong/android"
|
||||||
|
|
||||||
|
"github.com/google/blueprint"
|
||||||
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
pctx = android.NewPackageContext("android/soong/aconfig/build_flags")
|
||||||
|
|
||||||
|
// For build_flag_declarations: Generate cache file
|
||||||
|
buildFlagRule = pctx.AndroidStaticRule("build-flag-declarations",
|
||||||
|
blueprint.RuleParams{
|
||||||
|
Command: `${buildFlagDeclarations} ` +
|
||||||
|
` ${declarations}` +
|
||||||
|
` --format pb` +
|
||||||
|
` --output ${out}.tmp` +
|
||||||
|
` && ( if cmp -s ${out}.tmp ${out} ; then rm ${out}.tmp ; else mv ${out}.tmp ${out} ; fi )`,
|
||||||
|
CommandDeps: []string{
|
||||||
|
"${buildFlagDeclarations}",
|
||||||
|
},
|
||||||
|
Restat: true,
|
||||||
|
}, "release_version", "declarations")
|
||||||
|
|
||||||
|
buildFlagTextRule = pctx.AndroidStaticRule("build-flag-declarations-text",
|
||||||
|
blueprint.RuleParams{
|
||||||
|
Command: `${buildFlagDeclarations} --format=textproto` +
|
||||||
|
` --intermediate ${in}` +
|
||||||
|
` --format textproto` +
|
||||||
|
` --output ${out}.tmp` +
|
||||||
|
` && ( if cmp -s ${out}.tmp ${out} ; then rm ${out}.tmp ; else mv ${out}.tmp ${out} ; fi )`,
|
||||||
|
CommandDeps: []string{
|
||||||
|
"${buildFlagDeclarations}",
|
||||||
|
},
|
||||||
|
Restat: true,
|
||||||
|
})
|
||||||
|
|
||||||
|
allDeclarationsRule = pctx.AndroidStaticRule("all-build-flag-declarations-dump",
|
||||||
|
blueprint.RuleParams{
|
||||||
|
Command: `${buildFlagDeclarations} ${intermediates} --format pb --output ${out}`,
|
||||||
|
CommandDeps: []string{
|
||||||
|
"${buildFlagDeclarations}",
|
||||||
|
},
|
||||||
|
}, "intermediates")
|
||||||
|
|
||||||
|
allDeclarationsRuleTextProto = pctx.AndroidStaticRule("All_build_flag_declarations_dump_textproto",
|
||||||
|
blueprint.RuleParams{
|
||||||
|
Command: `${buildFlagDeclarations} --intermediate ${in} --format textproto --output ${out}`,
|
||||||
|
CommandDeps: []string{
|
||||||
|
"${buildFlagDeclarations}",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
RegisterBuildComponents(android.InitRegistrationContext)
|
||||||
|
pctx.HostBinToolVariable("buildFlagDeclarations", "build-flag-declarations")
|
||||||
|
}
|
||||||
|
|
||||||
|
func RegisterBuildComponents(ctx android.RegistrationContext) {
|
||||||
|
ctx.RegisterModuleType("build_flag_declarations", DeclarationsFactory)
|
||||||
|
ctx.RegisterParallelSingletonType("all_build_flag_declarations", AllBuildFlagDeclarationsFactory)
|
||||||
|
}
|
28
bin/build-flag-declarations
Executable file
28
bin/build-flag-declarations
Executable file
@@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/bash -eu
|
||||||
|
#
|
||||||
|
# Copyright 2017 Google Inc. All rights reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
source $(cd $(dirname $BASH_SOURCE) &> /dev/null && pwd)/../../make/shell_utils.sh
|
||||||
|
require_top
|
||||||
|
|
||||||
|
# Save the current PWD for use in soong_ui
|
||||||
|
export ORIGINAL_PWD=${PWD}
|
||||||
|
export TOP=$(gettop)
|
||||||
|
source ${TOP}/build/soong/scripts/microfactory.bash
|
||||||
|
|
||||||
|
soong_build_go build-flag-declarations android/soong/cmd/release_config/build_flag_declarations
|
||||||
|
|
||||||
|
cd ${TOP}
|
||||||
|
exec "$(getoutdir)/build-flag-declarations" "$@"
|
32
cmd/release_config/build_flag_declarations/Android.bp
Normal file
32
cmd/release_config/build_flag_declarations/Android.bp
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
package {
|
||||||
|
default_applicable_licenses: ["Android-Apache-2.0"],
|
||||||
|
}
|
||||||
|
|
||||||
|
blueprint_go_binary {
|
||||||
|
name: "build-flag-declarations",
|
||||||
|
deps: [
|
||||||
|
"golang-protobuf-encoding-prototext",
|
||||||
|
"golang-protobuf-reflect-protoreflect",
|
||||||
|
"golang-protobuf-runtime-protoimpl",
|
||||||
|
"soong-cmd-release_config-proto",
|
||||||
|
"soong-cmd-release_config-lib",
|
||||||
|
],
|
||||||
|
srcs: [
|
||||||
|
"main.go",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
bootstrap_go_package {
|
||||||
|
name: "soong-cmd-release_config-build_flag_declarations",
|
||||||
|
pkgPath: "android/soong/cmd/release_config/build_flag_declarations",
|
||||||
|
deps: [
|
||||||
|
"golang-protobuf-encoding-prototext",
|
||||||
|
"golang-protobuf-reflect-protoreflect",
|
||||||
|
"golang-protobuf-runtime-protoimpl",
|
||||||
|
"soong-cmd-release_config-proto",
|
||||||
|
"soong-cmd-release_config-lib",
|
||||||
|
],
|
||||||
|
srcs: [
|
||||||
|
"main.go",
|
||||||
|
],
|
||||||
|
}
|
81
cmd/release_config/build_flag_declarations/main.go
Normal file
81
cmd/release_config/build_flag_declarations/main.go
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"flag"
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
rc_lib "android/soong/cmd/release_config/release_config_lib"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Flags struct {
|
||||||
|
// The path to the top of the workspace. Default: ".".
|
||||||
|
top string
|
||||||
|
|
||||||
|
// Output file.
|
||||||
|
output string
|
||||||
|
|
||||||
|
// Format for output file
|
||||||
|
format string
|
||||||
|
|
||||||
|
// List of flag_declaration files to add.
|
||||||
|
decls rc_lib.StringList
|
||||||
|
|
||||||
|
// List of flag_artifacts files to merge.
|
||||||
|
intermediates rc_lib.StringList
|
||||||
|
|
||||||
|
// Disable warning messages
|
||||||
|
quiet bool
|
||||||
|
|
||||||
|
// Panic on errors.
|
||||||
|
debug bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
var flags Flags
|
||||||
|
topDir, err := rc_lib.GetTopDir()
|
||||||
|
|
||||||
|
// Handle the common arguments
|
||||||
|
flag.StringVar(&flags.top, "top", topDir, "path to top of workspace")
|
||||||
|
flag.Var(&flags.decls, "decl", "path to a flag_declaration file. May be repeated")
|
||||||
|
flag.Var(&flags.intermediates, "intermediate", "path to a flag_artifacts file (output from a prior run). May be repeated")
|
||||||
|
flag.StringVar(&flags.format, "format", "pb", "output file format")
|
||||||
|
flag.StringVar(&flags.output, "output", "build_flags.pb", "output file")
|
||||||
|
flag.BoolVar(&flags.debug, "debug", false, "turn on debugging output for errors")
|
||||||
|
flag.BoolVar(&flags.quiet, "quiet", false, "disable warning messages")
|
||||||
|
flag.Parse()
|
||||||
|
|
||||||
|
errorExit := func(err error) {
|
||||||
|
if flags.debug {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
fmt.Fprintf(os.Stderr, "%s\n", err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
|
||||||
|
if flags.quiet {
|
||||||
|
rc_lib.DisableWarnings()
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = os.Chdir(flags.top); err != nil {
|
||||||
|
errorExit(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
flagArtifacts := rc_lib.FlagArtifactsFactory("")
|
||||||
|
for _, intermediate := range flags.intermediates {
|
||||||
|
fas := rc_lib.FlagArtifactsFactory(intermediate)
|
||||||
|
for _, fa := range *fas {
|
||||||
|
(*flagArtifacts)[*fa.FlagDeclaration.Name] = fa
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for _, decl := range flags.decls {
|
||||||
|
fa := rc_lib.FlagArtifactFactory(decl)
|
||||||
|
(*flagArtifacts)[*fa.FlagDeclaration.Name] = fa
|
||||||
|
}
|
||||||
|
|
||||||
|
message := flagArtifacts.GenerateFlagArtifacts()
|
||||||
|
err = rc_lib.WriteFormattedMessage(flags.output, flags.format, message)
|
||||||
|
if err != nil {
|
||||||
|
errorExit(err)
|
||||||
|
}
|
||||||
|
}
|
@@ -16,8 +16,8 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// When a flag declaration has an initial value that is a string, the default workflow is WorkflowPrebuilt.
|
// 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 WorkflowManual.
|
// If the flag name starts with any of prefixes in manualFlagNamePrefixes, it is Workflow_Manual.
|
||||||
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: WorkflowPrebuilt`.
|
// Most build flags are `workflow: Workflow_Prebuilt`.
|
||||||
workflow := rc_proto.Workflow(rc_proto.Workflow_WorkflowPrebuilt)
|
workflow := rc_proto.Workflow(rc_proto.Workflow_Workflow_Prebuilt)
|
||||||
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 WorkflowManual or WorkflowPrebuilt.
|
// String values mean that the flag workflow is (most likely) either Workflow_Manual or Workflow_Prebuilt.
|
||||||
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_WorkflowManual)
|
workflow = rc_proto.Workflow(rc_proto.Workflow_Workflow_Manual)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case declValue == "False" || declValue == "True":
|
case declValue == "False" || declValue == "True":
|
||||||
// Boolean values are WorkflowLaunch flags.
|
// Boolean values are Workflow_Launch 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_WorkflowLaunch)
|
workflow = rc_proto.Workflow(rc_proto.Workflow_Workflow_Launch)
|
||||||
case declValue == "None":
|
case declValue == "None":
|
||||||
// Use WorkflowPrebuilt workflow with no initial value.
|
// Use Workflow_Prebuilt 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)
|
||||||
}
|
}
|
||||||
|
@@ -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_WorkflowManual)
|
workflowManual := rc_proto.Workflow(rc_proto.Workflow_Workflow_Manual)
|
||||||
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: WorkflowManual flags.
|
// The "root" release config can only contain workflow: Workflow_Manual flags.
|
||||||
return fmt.Errorf("Setting value for non-WorkflowManual flag %s is not allowed in %s", name, value.path)
|
return fmt.Errorf("Setting value for non-Workflow_Manual 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
|
||||||
|
@@ -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_WorkflowManual)
|
workflowManual := rc_proto.Workflow(rc_proto.Workflow_Workflow_Manual)
|
||||||
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"),
|
||||||
|
@@ -1,3 +1,7 @@
|
|||||||
|
//
|
||||||
|
// Copyright (C) 2024 The Android Open-Source Project
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
// You may obtain a copy of the License at
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
|
@@ -1,3 +1,7 @@
|
|||||||
|
//
|
||||||
|
// Copyright (C) 2024 The Android Open-Source Project
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
// You may obtain a copy of the License at
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
|
@@ -1,3 +1,7 @@
|
|||||||
|
//
|
||||||
|
// Copyright (C) 2024 The Android Open-Source Project
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
// You may obtain a copy of the License at
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
@@ -34,30 +38,30 @@ const (
|
|||||||
type Workflow int32
|
type Workflow int32
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Workflow_WorkflowUnspecified Workflow = 0
|
Workflow_Workflow_Unspecified Workflow = 0
|
||||||
// Boolean value flags that progress from false to true.
|
// Boolean value flags that progress from false to true.
|
||||||
Workflow_WorkflowLaunch Workflow = 1
|
Workflow_Workflow_Launch 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_WorkflowPrebuilt Workflow = 2
|
Workflow_Workflow_Prebuilt 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_WorkflowManual Workflow = 3
|
Workflow_Workflow_Manual 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: "WorkflowUnspecified",
|
0: "Workflow_Unspecified",
|
||||||
1: "WorkflowLaunch",
|
1: "Workflow_Launch",
|
||||||
2: "WorkflowPrebuilt",
|
2: "Workflow_Prebuilt",
|
||||||
3: "WorkflowManual",
|
3: "Workflow_Manual",
|
||||||
}
|
}
|
||||||
Workflow_value = map[string]int32{
|
Workflow_value = map[string]int32{
|
||||||
"WorkflowUnspecified": 0,
|
"Workflow_Unspecified": 0,
|
||||||
"WorkflowLaunch": 1,
|
"Workflow_Launch": 1,
|
||||||
"WorkflowPrebuilt": 2,
|
"Workflow_Prebuilt": 2,
|
||||||
"WorkflowManual": 3,
|
"Workflow_Manual": 3,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -295,7 +299,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_WorkflowUnspecified
|
return Workflow_Workflow_Unspecified
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *FlagDeclaration) GetContainers() []string {
|
func (x *FlagDeclaration) GetContainers() []string {
|
||||||
@@ -642,17 +646,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, 0x61, 0x0a, 0x08,
|
0x6c, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x2a, 0x65, 0x0a, 0x08,
|
||||||
0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x17, 0x0a, 0x13, 0x57, 0x6f, 0x72, 0x6b,
|
0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x18, 0x0a, 0x14, 0x57, 0x6f, 0x72, 0x6b,
|
||||||
0x66, 0x6c, 0x6f, 0x77, 0x55, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64, 0x10,
|
0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x55, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x69, 0x66, 0x69, 0x65, 0x64,
|
||||||
0x00, 0x12, 0x12, 0x0a, 0x0e, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x4c, 0x61, 0x75,
|
0x10, 0x00, 0x12, 0x13, 0x0a, 0x0f, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x4c,
|
||||||
0x6e, 0x63, 0x68, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f,
|
0x61, 0x75, 0x6e, 0x63, 0x68, 0x10, 0x01, 0x12, 0x15, 0x0a, 0x11, 0x57, 0x6f, 0x72, 0x6b, 0x66,
|
||||||
0x77, 0x50, 0x72, 0x65, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x10, 0x02, 0x12, 0x12, 0x0a, 0x0e, 0x57,
|
0x6c, 0x6f, 0x77, 0x5f, 0x50, 0x72, 0x65, 0x62, 0x75, 0x69, 0x6c, 0x74, 0x10, 0x02, 0x12, 0x13,
|
||||||
0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x4d, 0x61, 0x6e, 0x75, 0x61, 0x6c, 0x10, 0x03, 0x42,
|
0x0a, 0x0f, 0x57, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x5f, 0x4d, 0x61, 0x6e, 0x75, 0x61,
|
||||||
0x33, 0x5a, 0x31, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2f, 0x73, 0x6f, 0x6f, 0x6e, 0x67,
|
0x6c, 0x10, 0x03, 0x42, 0x33, 0x5a, 0x31, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2f, 0x73,
|
||||||
0x2f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x2f,
|
0x6f, 0x6f, 0x6e, 0x67, 0x2f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e,
|
||||||
0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x70,
|
0x66, 0x69, 0x67, 0x2f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66,
|
||||||
0x72, 0x6f, 0x74, 0x6f,
|
0x69, 0x67, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@@ -1,3 +1,7 @@
|
|||||||
|
//
|
||||||
|
// Copyright (C) 2024 The Android Open-Source Project
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
// You may obtain a copy of the License at
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
@@ -39,18 +43,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 {
|
||||||
WorkflowUnspecified = 0;
|
Workflow_Unspecified = 0;
|
||||||
|
|
||||||
// Boolean value flags that progress from false to true.
|
// Boolean value flags that progress from false to true.
|
||||||
WorkflowLaunch = 1;
|
Workflow_Launch = 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.
|
||||||
WorkflowPrebuilt = 2;
|
Workflow_Prebuilt = 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.
|
||||||
WorkflowManual = 3;
|
Workflow_Manual = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
message value {
|
message value {
|
||||||
|
Reference in New Issue
Block a user