Merge "Replace Malloc_not_svelte with Malloc_low_memory." into main
diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg
index 317f5c4..e8cad7d 100644
--- a/PREUPLOAD.cfg
+++ b/PREUPLOAD.cfg
@@ -4,3 +4,4 @@
[Hook Scripts]
do_not_use_DO_NOT_MERGE = ${REPO_ROOT}/build/soong/scripts/check_do_not_merge.sh ${PREUPLOAD_COMMIT}
+aosp_hook = ${REPO_ROOT}/frameworks/base/tools/aosp/aosp_sha.sh ${PREUPLOAD_COMMIT} "."
diff --git a/aconfig/aconfig_declarations.go b/aconfig/aconfig_declarations.go
index d29e312..71a64dd 100644
--- a/aconfig/aconfig_declarations.go
+++ b/aconfig/aconfig_declarations.go
@@ -73,8 +73,9 @@
if len(module.properties.Package) == 0 {
ctx.PropertyErrorf("package", "missing package property")
}
- // TODO(b/311155208): Add mandatory check for container after all pre-existing
- // ones are changed.
+ if len(module.properties.Container) == 0 {
+ ctx.PropertyErrorf("container", "missing container property")
+ }
// Add a dependency on the aconfig_value_sets defined in
// RELEASE_ACONFIG_VALUE_SETS, and add any aconfig_values that
diff --git a/aconfig/aconfig_declarations_test.go b/aconfig/aconfig_declarations_test.go
index 5201fed..c37274c 100644
--- a/aconfig/aconfig_declarations_test.go
+++ b/aconfig/aconfig_declarations_test.go
@@ -88,19 +88,49 @@
android.AssertStringEquals(t, "rule must contain container", rule.Args["container"], "--container com.android.foo")
}
-func TestAconfigDeclarationsWithoutContainer(t *testing.T) {
- bp := `
- aconfig_declarations {
- name: "module_name",
- package: "com.example.package",
- srcs: [
- "foo.aconfig",
- ],
- }
- `
- result := runTest(t, android.FixtureExpectsNoErrors, bp)
-
- module := result.ModuleForTests("module_name", "")
- rule := module.Rule("aconfig")
- android.AssertIntEquals(t, "rule must not contain container", len(rule.Args["container"]), 0)
+func TestMandatoryProperties(t *testing.T) {
+ testCases := []struct {
+ name string
+ expectedError string
+ bp string
+ }{
+ {
+ name: "Srcs missing from aconfig_declarations",
+ bp: `
+ aconfig_declarations {
+ name: "my_aconfig_declarations_foo",
+ package: "com.example.package",
+ container: "otherapex",
+ }`,
+ expectedError: `missing source files`,
+ },
+ {
+ name: "Package missing from aconfig_declarations",
+ bp: `
+ aconfig_declarations {
+ name: "my_aconfig_declarations_foo",
+ container: "otherapex",
+ srcs: ["foo.aconfig"],
+ }`,
+ expectedError: `missing package property`,
+ },
+ {
+ name: "Container missing from aconfig_declarations",
+ bp: `
+ aconfig_declarations {
+ name: "my_aconfig_declarations_foo",
+ package: "com.example.package",
+ srcs: ["foo.aconfig"],
+ }`,
+ expectedError: `missing container property`,
+ },
+ }
+ for _, test := range testCases {
+ t.Run(test.name, func(t *testing.T) {
+ errorHandler := android.FixtureExpectsAtLeastOneErrorMatchingPattern(test.expectedError)
+ android.GroupFixturePreparers(PrepareForTestWithAconfigBuildComponents).
+ ExtendWithErrorHandler(errorHandler).
+ RunTestWithBp(t, test.bp)
+ })
+ }
}
diff --git a/aconfig/codegen/aconfig_declarations_group_test.go b/aconfig/codegen/aconfig_declarations_group_test.go
index ec7cea3..c69d21f 100644
--- a/aconfig/codegen/aconfig_declarations_group_test.go
+++ b/aconfig/codegen/aconfig_declarations_group_test.go
@@ -15,9 +15,10 @@
package codegen
import (
+ "testing"
+
"android/soong/android"
"android/soong/java"
- "testing"
)
func TestAconfigDeclarationsGroup(t *testing.T) {
@@ -28,6 +29,7 @@
aconfig_declarations {
name: "foo-aconfig",
package: "com.example.package",
+ container: "com.android.foo",
srcs: ["foo.aconfig"],
}
@@ -39,6 +41,7 @@
aconfig_declarations {
name: "bar-aconfig",
package: "com.example.package",
+ container: "com.android.foo",
srcs: ["foo.aconfig"],
}
diff --git a/aconfig/codegen/cc_aconfig_library.go b/aconfig/codegen/cc_aconfig_library.go
index 2d3ee39..ec0a6b6 100644
--- a/aconfig/codegen/cc_aconfig_library.go
+++ b/aconfig/codegen/cc_aconfig_library.go
@@ -22,6 +22,7 @@
"github.com/google/blueprint/proptools"
"fmt"
+ "strconv"
"strings"
)
@@ -36,7 +37,6 @@
const libBaseDep = "libbase"
const libLogDep = "liblog"
const libAconfigStorageReadApiCcDep = "libaconfig_storage_read_api_cc"
-const libAconfigStorageProtosCcDep = "libaconfig_storage_protos_cc"
type CcAconfigLibraryProperties struct {
// name of the aconfig_declarations module to generate a library for
@@ -88,11 +88,13 @@
if mode != "force-read-only" {
deps.SharedLibs = append(deps.SharedLibs, baseLibDep)
- deps.SharedLibs = append(deps.SharedLibs, libBaseDep)
- deps.SharedLibs = append(deps.SharedLibs, libLogDep)
- deps.SharedLibs = append(deps.SharedLibs, libAconfigStorageReadApiCcDep)
- deps.SharedLibs = append(deps.SharedLibs, libAconfigStorageProtosCcDep)
}
+
+ // TODO: after storage migration is over, don't add these in force-read-only-mode.
+ deps.SharedLibs = append(deps.SharedLibs, libAconfigStorageReadApiCcDep)
+ deps.SharedLibs = append(deps.SharedLibs, libBaseDep)
+ deps.SharedLibs = append(deps.SharedLibs, libLogDep)
+
// TODO: It'd be really nice if we could reexport this library and not make everyone do it.
return deps
@@ -154,6 +156,7 @@
Args: map[string]string{
"gendir": this.generatedDir.String(),
"mode": mode,
+ "debug": strconv.FormatBool(ctx.Config().ReleaseReadFromNewStorageCc()),
},
})
diff --git a/aconfig/codegen/cc_aconfig_library_test.go b/aconfig/codegen/cc_aconfig_library_test.go
index 2e7fdc2..d01d13b 100644
--- a/aconfig/codegen/cc_aconfig_library_test.go
+++ b/aconfig/codegen/cc_aconfig_library_test.go
@@ -50,6 +50,7 @@
aconfig_declarations {
name: "my_aconfig_declarations",
package: "com.example.package",
+ container: "com.android.foo",
srcs: ["foo.aconfig"],
}
@@ -112,6 +113,7 @@
aconfig_declarations {
name: "my_aconfig_declarations",
package: "com.example.package",
+ container: "com.android.foo",
srcs: ["foo.aconfig"],
}
@@ -167,6 +169,7 @@
aconfig_declarations {
name: "my_aconfig_declarations_bar",
package: "com.example.package",
+ container: "com.android.foo",
srcs: ["bar.aconfig"],
}
@@ -241,6 +244,7 @@
aconfig_declarations {
name: "my_aconfig_declarations",
package: "com.example.package",
+ container: "com.android.foo",
srcs: ["foo.aconfig"],
}
@@ -249,6 +253,22 @@
aconfig_declarations: "my_aconfig_declarations",
mode: "force-read-only",
}
+
+
+ cc_library {
+ name: "libbase",
+ srcs: ["libbase.cc"],
+ }
+
+ cc_library {
+ name: "liblog",
+ srcs: ["liblog.cc"],
+ }
+
+ cc_library {
+ name: "libaconfig_storage_read_api_cc",
+ srcs: ["libaconfig_storage_read_api_cc.cc"],
+ }
`))
module := result.ModuleForTests("my_cc_aconfig_library", "android_arm64_armv8-a_shared").Module()
diff --git a/aconfig/codegen/init.go b/aconfig/codegen/init.go
index 73a8951..6182e14 100644
--- a/aconfig/codegen/init.go
+++ b/aconfig/codegen/init.go
@@ -49,11 +49,12 @@
` && ${aconfig} create-cpp-lib` +
` --mode ${mode}` +
` --cache ${in}` +
- ` --out ${gendir}`,
+ ` --out ${gendir}` +
+ ` --allow-instrumentation ${debug}`,
CommandDeps: []string{
"$aconfig",
},
- }, "gendir", "mode")
+ }, "gendir", "mode", "debug")
// For rust_aconfig_library: Generate Rust library
rustRule = pctx.AndroidStaticRule("rust_aconfig_library",
diff --git a/aconfig/codegen/java_aconfig_library.go b/aconfig/codegen/java_aconfig_library.go
index a46ce52..9f42e21 100644
--- a/aconfig/codegen/java_aconfig_library.go
+++ b/aconfig/codegen/java_aconfig_library.go
@@ -115,6 +115,7 @@
module.AddJarJarRenameRule(declarations.Package+".Flags", "")
module.AddJarJarRenameRule(declarations.Package+".FeatureFlags", "")
module.AddJarJarRenameRule(declarations.Package+".FeatureFlagsImpl", "")
+ module.AddJarJarRenameRule(declarations.Package+".CustomFeatureFlags", "")
module.AddJarJarRenameRule(declarations.Package+".FakeFeatureFlagsImpl", "")
}
diff --git a/aconfig/codegen/java_aconfig_library_test.go b/aconfig/codegen/java_aconfig_library_test.go
index de45b5c..87b54a4 100644
--- a/aconfig/codegen/java_aconfig_library_test.go
+++ b/aconfig/codegen/java_aconfig_library_test.go
@@ -35,6 +35,7 @@
aconfig_declarations {
name: "my_aconfig_declarations_foo",
package: "com.example.package.foo",
+ container: "system",
srcs: ["foo.aconfig"],
}
@@ -46,6 +47,7 @@
aconfig_declarations {
name: "my_aconfig_declarations_bar",
package: "com.example.package.bar",
+ container: "system",
srcs: ["bar.aconfig"],
}
@@ -60,7 +62,7 @@
entry := android.AndroidMkEntriesForTest(t, result.TestContext, module)[0]
makeVar := entry.EntryMap["LOCAL_ACONFIG_FILES"]
- android.EnsureListContainsSuffix(t, makeVar, "android_common/aconfig_merged.pb")
+ android.EnsureListContainsSuffix(t, makeVar, "android_common/system/aconfig_merged.pb")
}
func TestAndroidMkJavaLibrary(t *testing.T) {
@@ -175,6 +177,7 @@
aconfig_declarations {
name: "my_aconfig_declarations",
package: "com.example.package",
+ container: "com.android.foo",
srcs: ["foo.aconfig"],
exportable: true,
}
@@ -200,6 +203,7 @@
aconfig_declarations {
name: "my_aconfig_declarations",
package: "com.example.package",
+ container: "com.android.foo",
srcs: ["foo.aconfig"],
}
@@ -234,3 +238,52 @@
func TestUnsupportedMode(t *testing.T) {
testCodegenModeWithError(t, "mode: `unsupported`,", "mode: \"unsupported\" is not a supported mode")
}
+
+func TestMkEntriesMatchedContainer(t *testing.T) {
+ result := android.GroupFixturePreparers(
+ PrepareForTestWithAconfigBuildComponents,
+ java.PrepareForTestWithJavaDefaultModules).
+ ExtendWithErrorHandler(android.FixtureExpectsNoErrors).
+ RunTestWithBp(t, `
+ aconfig_declarations {
+ name: "my_aconfig_declarations_foo",
+ package: "com.example.package.foo",
+ container: "system",
+ srcs: ["foo.aconfig"],
+ }
+
+ java_aconfig_library {
+ name: "my_java_aconfig_library_foo",
+ aconfig_declarations: "my_aconfig_declarations_foo",
+ }
+
+ aconfig_declarations {
+ name: "my_aconfig_declarations_bar",
+ package: "com.example.package.bar",
+ container: "system_ext",
+ srcs: ["bar.aconfig"],
+ }
+
+ java_aconfig_library {
+ name: "my_java_aconfig_library_bar",
+ aconfig_declarations: "my_aconfig_declarations_bar",
+ }
+
+ java_library {
+ name: "my_module",
+ srcs: [
+ "src/foo.java",
+ ],
+ static_libs: [
+ "my_java_aconfig_library_foo",
+ "my_java_aconfig_library_bar",
+ ],
+ platform_apis: true,
+ }
+ `)
+
+ module := result.ModuleForTests("my_module", "android_common").Module()
+ entry := android.AndroidMkEntriesForTest(t, result.TestContext, module)[0]
+ makeVar := entry.EntryMap["LOCAL_ACONFIG_FILES"]
+ android.EnsureListContainsSuffix(t, makeVar, "my_aconfig_declarations_foo/intermediate.pb")
+}
diff --git a/aconfig/codegen/rust_aconfig_library_test.go b/aconfig/codegen/rust_aconfig_library_test.go
index fe28f94..523b464 100644
--- a/aconfig/codegen/rust_aconfig_library_test.go
+++ b/aconfig/codegen/rust_aconfig_library_test.go
@@ -46,6 +46,7 @@
aconfig_declarations {
name: "my_aconfig_declarations",
package: "com.example.package",
+ container: "com.android.foo",
srcs: ["foo.aconfig"],
}
@@ -131,6 +132,7 @@
aconfig_declarations {
name: "my_aconfig_declarations",
package: "com.example.package",
+ container: "com.android.foo",
srcs: ["foo.aconfig"],
}
rust_aconfig_library {
@@ -193,6 +195,7 @@
aconfig_declarations {
name: "my_aconfig_declarations",
package: "com.example.package",
+ container: "com.android.foo",
srcs: ["foo.aconfig"],
}
rust_aconfig_library {
diff --git a/android/Android.bp b/android/Android.bp
index f130d3a..f0be44b 100644
--- a/android/Android.bp
+++ b/android/Android.bp
@@ -60,6 +60,7 @@
"license_metadata.go",
"license_sdk_member.go",
"licenses.go",
+ "logtags.go",
"makevars.go",
"metrics.go",
"module.go",
diff --git a/android/androidmk.go b/android/androidmk.go
index 07f7c58..53f0609 100644
--- a/android/androidmk.go
+++ b/android/androidmk.go
@@ -36,6 +36,7 @@
"github.com/google/blueprint"
"github.com/google/blueprint/bootstrap"
"github.com/google/blueprint/pathtools"
+ "github.com/google/blueprint/proptools"
)
func init() {
@@ -541,6 +542,11 @@
a.SetPath("LOCAL_SOONG_INSTALLED_MODULE", base.katiInstalls[len(base.katiInstalls)-1].to)
a.SetString("LOCAL_SOONG_INSTALL_PAIRS", base.katiInstalls.BuiltInstalled())
a.SetPaths("LOCAL_SOONG_INSTALL_SYMLINKS", base.katiSymlinks.InstallPaths().Paths())
+ } else {
+ // Soong may not have generated the install rule also when `no_full_install: true`.
+ // Mark this module as uninstallable in order to prevent Make from creating an
+ // install rule there.
+ a.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", proptools.Bool(base.commonProperties.No_full_install))
}
if len(base.testData) > 0 {
diff --git a/android/apex_contributions.go b/android/apex_contributions.go
index dd09fbf..f5c50d3 100644
--- a/android/apex_contributions.go
+++ b/android/apex_contributions.go
@@ -15,8 +15,6 @@
package android
import (
- "strings"
-
"github.com/google/blueprint"
"github.com/google/blueprint/proptools"
)
@@ -115,15 +113,6 @@
func (a *allApexContributions) SetPrebuiltSelectionInfoProvider(ctx BaseModuleContext) {
addContentsToProvider := func(p *PrebuiltSelectionInfoMap, m *apexContributions) {
for _, content := range m.Contents() {
- // Coverage builds for TARGET_RELEASE=foo should always build from source,
- // even if TARGET_RELEASE=foo uses prebuilt mainline modules.
- // This is necessary because the checked-in prebuilts were generated with
- // instrumentation turned off.
- //
- // Skip any prebuilt contents in coverage builds
- if strings.HasPrefix(content, "prebuilt_") && (ctx.Config().JavaCoverageEnabled() || ctx.DeviceConfig().NativeCoverageEnabled()) {
- continue
- }
if !ctx.OtherModuleExists(content) && !ctx.Config().AllowMissingDependencies() {
ctx.ModuleErrorf("%s listed in apex_contributions %s does not exist\n", content, m.Name())
}
diff --git a/android/config.go b/android/config.go
index 75d135f..f6711e6 100644
--- a/android/config.go
+++ b/android/config.go
@@ -229,6 +229,11 @@
return c.config.productVariables.GetBuildFlagBool("RELEASE_NDK_ABI_MONITORED")
}
+// Enable read flag from new storage, for C/C++
+func (c Config) ReleaseReadFromNewStorageCc() bool {
+ return c.config.productVariables.GetBuildFlagBool("RELEASE_READ_FROM_NEW_STORAGE_CC")
+}
+
func (c Config) ReleaseHiddenApiExportableStubs() bool {
return c.config.productVariables.GetBuildFlagBool("RELEASE_HIDDEN_API_EXPORTABLE_STUBS") ||
Bool(c.config.productVariables.HiddenapiExportableStubs)
@@ -813,12 +818,12 @@
}
func (c *config) IsEnvTrue(key string) bool {
- value := c.Getenv(key)
+ value := strings.ToLower(c.Getenv(key))
return value == "1" || value == "y" || value == "yes" || value == "on" || value == "true"
}
func (c *config) IsEnvFalse(key string) bool {
- value := c.Getenv(key)
+ value := strings.ToLower(c.Getenv(key))
return value == "0" || value == "n" || value == "no" || value == "off" || value == "false"
}
@@ -2099,6 +2104,7 @@
"RELEASE_APEX_CONTRIBUTIONS_IPSEC",
"RELEASE_APEX_CONTRIBUTIONS_MEDIA",
"RELEASE_APEX_CONTRIBUTIONS_MEDIAPROVIDER",
+ "RELEASE_APEX_CONTRIBUTIONS_MODULE_METADATA",
"RELEASE_APEX_CONTRIBUTIONS_NETWORKSTACKGOOGLE",
"RELEASE_APEX_CONTRIBUTIONS_NEURALNETWORKS",
"RELEASE_APEX_CONTRIBUTIONS_ONDEVICEPERSONALIZATION",
diff --git a/android/logtags.go b/android/logtags.go
new file mode 100644
index 0000000..d11cccf
--- /dev/null
+++ b/android/logtags.go
@@ -0,0 +1,56 @@
+// Copyright 2024 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 android
+
+import "github.com/google/blueprint"
+
+func init() {
+ RegisterParallelSingletonType("logtags", LogtagsSingleton)
+}
+
+type LogtagsInfo struct {
+ Logtags Paths
+}
+
+var LogtagsProviderKey = blueprint.NewProvider[*LogtagsInfo]()
+
+func LogtagsSingleton() Singleton {
+ return &logtagsSingleton{}
+}
+
+type logtagsSingleton struct{}
+
+func MergedLogtagsPath(ctx PathContext) OutputPath {
+ return PathForIntermediates(ctx, "all-event-log-tags.txt")
+}
+
+func (l *logtagsSingleton) GenerateBuildActions(ctx SingletonContext) {
+ var allLogtags Paths
+ ctx.VisitAllModules(func(module Module) {
+ if !module.ExportedToMake() {
+ return
+ }
+ if logtagsInfo, ok := SingletonModuleProvider(ctx, module, LogtagsProviderKey); ok {
+ allLogtags = append(allLogtags, logtagsInfo.Logtags...)
+ }
+ })
+
+ builder := NewRuleBuilder(pctx, ctx)
+ builder.Command().
+ BuiltTool("merge-event-log-tags").
+ FlagWithOutput("-o ", MergedLogtagsPath(ctx)).
+ Inputs(SortedUniquePaths(allLogtags))
+ builder.Build("all-event-log-tags.txt", "merge logtags")
+}
diff --git a/android/module.go b/android/module.go
index 5fe379c..f8fec3a 100644
--- a/android/module.go
+++ b/android/module.go
@@ -484,6 +484,11 @@
// Set by osMutator.
CommonOSVariant bool `blueprint:"mutated"`
+ // When set to true, this module is not installed to the full install path (ex: under
+ // out/target/product/<name>/<partition>). It can be installed only to the packaging
+ // modules like android_filesystem.
+ No_full_install *bool
+
// When HideFromMake is set to true, no entry for this variant will be emitted in the
// generated Android.mk file.
HideFromMake bool `blueprint:"mutated"`
@@ -2142,13 +2147,13 @@
func (e configurationEvalutor) EvaluateConfiguration(condition proptools.ConfigurableCondition, property string) proptools.ConfigurableValue {
ctx := e.ctx
m := e.m
- switch condition.FunctionName {
+ switch condition.FunctionName() {
case "release_variable":
- if len(condition.Args) != 1 {
- ctx.OtherModulePropertyErrorf(m, property, "release_variable requires 1 argument, found %d", len(condition.Args))
+ if condition.NumArgs() != 1 {
+ ctx.OtherModulePropertyErrorf(m, property, "release_variable requires 1 argument, found %d", condition.NumArgs())
return proptools.ConfigurableValueUndefined()
}
- if v, ok := ctx.Config().productVariables.BuildFlags[condition.Args[0]]; ok {
+ if v, ok := ctx.Config().productVariables.BuildFlags[condition.Arg(0)]; ok {
return proptools.ConfigurableValueString(v)
}
return proptools.ConfigurableValueUndefined()
@@ -2157,12 +2162,12 @@
ctx.OtherModulePropertyErrorf(m, property, "TODO(b/323382414): Product variables are not yet supported in selects")
return proptools.ConfigurableValueUndefined()
case "soong_config_variable":
- if len(condition.Args) != 2 {
- ctx.OtherModulePropertyErrorf(m, property, "soong_config_variable requires 2 arguments, found %d", len(condition.Args))
+ if condition.NumArgs() != 2 {
+ ctx.OtherModulePropertyErrorf(m, property, "soong_config_variable requires 2 arguments, found %d", condition.NumArgs())
return proptools.ConfigurableValueUndefined()
}
- namespace := condition.Args[0]
- variable := condition.Args[1]
+ namespace := condition.Arg(0)
+ variable := condition.Arg(1)
if n, ok := ctx.Config().productVariables.VendorVars[namespace]; ok {
if v, ok := n[variable]; ok {
return proptools.ConfigurableValueString(v)
@@ -2170,8 +2175,8 @@
}
return proptools.ConfigurableValueUndefined()
case "arch":
- if len(condition.Args) != 0 {
- ctx.OtherModulePropertyErrorf(m, property, "arch requires no arguments, found %d", len(condition.Args))
+ if condition.NumArgs() != 0 {
+ ctx.OtherModulePropertyErrorf(m, property, "arch requires no arguments, found %d", condition.NumArgs())
return proptools.ConfigurableValueUndefined()
}
if !m.base().ArchReady() {
@@ -2180,8 +2185,8 @@
}
return proptools.ConfigurableValueString(m.base().Arch().ArchType.Name)
case "os":
- if len(condition.Args) != 0 {
- ctx.OtherModulePropertyErrorf(m, property, "os requires no arguments, found %d", len(condition.Args))
+ if condition.NumArgs() != 0 {
+ ctx.OtherModulePropertyErrorf(m, property, "os requires no arguments, found %d", condition.NumArgs())
return proptools.ConfigurableValueUndefined()
}
// the arch mutator runs after the os mutator, we can just use this to enforce that os is ready.
@@ -2194,8 +2199,8 @@
// We currently don't have any other boolean variables (we should add support for typing
// the soong config variables), so add this fake one for testing the boolean select
// functionality.
- if len(condition.Args) != 0 {
- ctx.OtherModulePropertyErrorf(m, property, "boolean_var_for_testing requires 0 arguments, found %d", len(condition.Args))
+ if condition.NumArgs() != 0 {
+ ctx.OtherModulePropertyErrorf(m, property, "boolean_var_for_testing requires 0 arguments, found %d", condition.NumArgs())
return proptools.ConfigurableValueUndefined()
}
diff --git a/android/module_context.go b/android/module_context.go
index d3e2770..605d3ba 100644
--- a/android/module_context.go
+++ b/android/module_context.go
@@ -444,6 +444,21 @@
return false
}
+// Tells whether this module is installed to the full install path (ex:
+// out/target/product/<name>/<partition>) or not. If this returns false, the install build rule is
+// not created and this module can only be installed to packaging modules like android_filesystem.
+func (m *moduleContext) requiresFullInstall() bool {
+ if m.skipInstall() {
+ return false
+ }
+
+ if proptools.Bool(m.module.base().commonProperties.No_full_install) {
+ return false
+ }
+
+ return true
+}
+
func (m *moduleContext) InstallFile(installPath InstallPath, name string, srcPath Path,
deps ...InstallPath) InstallPath {
return m.installFile(installPath, name, srcPath, deps, false, true, nil)
@@ -476,6 +491,7 @@
executable: executable,
effectiveLicenseFiles: &licenseFiles,
partition: fullInstallPath.partition,
+ skipInstall: m.skipInstall(),
}
m.packagingSpecs = append(m.packagingSpecs, spec)
return spec
@@ -489,7 +505,7 @@
m.module.base().hooks.runInstallHooks(m, srcPath, fullInstallPath, false)
}
- if !m.skipInstall() {
+ if m.requiresFullInstall() {
deps = append(deps, InstallPaths(m.module.base().installFilesDepSet.ToList())...)
deps = append(deps, m.module.base().installedInitRcPaths...)
deps = append(deps, m.module.base().installedVintfFragmentsPaths...)
@@ -562,7 +578,7 @@
if err != nil {
panic(fmt.Sprintf("Unable to generate symlink between %q and %q: %s", fullInstallPath.Base(), srcPath.Base(), err))
}
- if !m.skipInstall() {
+ if m.requiresFullInstall() {
if m.Config().KatiEnabled() {
// When creating the symlink rule in Soong but embedding in Make, write the rule to a
@@ -599,6 +615,7 @@
symlinkTarget: relPath,
executable: false,
partition: fullInstallPath.partition,
+ skipInstall: m.skipInstall(),
})
return fullInstallPath
@@ -610,7 +627,7 @@
fullInstallPath := installPath.Join(m, name)
m.module.base().hooks.runInstallHooks(m, nil, fullInstallPath, true)
- if !m.skipInstall() {
+ if m.requiresFullInstall() {
if m.Config().KatiEnabled() {
// When creating the symlink rule in Soong but embedding in Make, write the rule to a
// makefile instead of directly to the ninja file so that main.mk can add the
@@ -640,6 +657,7 @@
symlinkTarget: absPath,
executable: false,
partition: fullInstallPath.partition,
+ skipInstall: m.skipInstall(),
})
return fullInstallPath
diff --git a/android/mutator.go b/android/mutator.go
index 75ba650..9cfdb60 100644
--- a/android/mutator.go
+++ b/android/mutator.go
@@ -293,15 +293,14 @@
// WalkDeps, etc.
AddInterVariantDependency(tag blueprint.DependencyTag, from, to blueprint.Module)
- // ReplaceDependencies replaces all dependencies on the identical variant of the module with the
- // specified name with the current variant of this module. Replacements don't take effect until
- // after the mutator pass is finished.
+ // ReplaceDependencies finds all the variants of the module with the specified name, then
+ // replaces all dependencies onto those variants with the current variant of this module.
+ // Replacements don't take effect until after the mutator pass is finished.
ReplaceDependencies(string)
- // ReplaceDependencies replaces all dependencies on the identical variant of the module with the
- // specified name with the current variant of this module as long as the supplied predicate returns
- // true.
- //
+ // ReplaceDependenciesIf finds all the variants of the module with the specified name, then
+ // replaces all dependencies onto those variants with the current variant of this module
+ // as long as the supplied predicate returns true.
// Replacements don't take effect until after the mutator pass is finished.
ReplaceDependenciesIf(string, blueprint.ReplaceDependencyPredicate)
@@ -595,11 +594,16 @@
func (a *androidTransitionMutator) Mutate(ctx blueprint.BottomUpMutatorContext, variation string) {
if am, ok := ctx.Module().(Module); ok {
+ if variation != "" {
+ // TODO: this should really be checking whether the TransitionMutator affected this module, not
+ // the empty variant, but TransitionMutator has no concept of skipping a module.
+ base := am.base()
+ base.commonProperties.DebugMutators = append(base.commonProperties.DebugMutators, a.name)
+ base.commonProperties.DebugVariations = append(base.commonProperties.DebugVariations, variation)
+ }
+
mctx := bottomUpMutatorContextFactory(ctx, am, a.finalPhase)
defer bottomUpMutatorContextPool.Put(mctx)
- base := am.base()
- base.commonProperties.DebugMutators = append(base.commonProperties.DebugMutators, a.name)
- base.commonProperties.DebugVariations = append(base.commonProperties.DebugVariations, variation)
a.mutator.Mutate(mctx, variation)
}
}
diff --git a/android/override_module.go b/android/override_module.go
index 1341f53..163f7b7 100644
--- a/android/override_module.go
+++ b/android/override_module.go
@@ -28,6 +28,7 @@
// module based on it.
import (
+ "fmt"
"sort"
"sync"
@@ -120,7 +121,7 @@
addOverride(o OverrideModule)
getOverrides() []OverrideModule
- override(ctx BaseModuleContext, m Module, o OverrideModule)
+ override(ctx BaseModuleContext, bm OverridableModule, o OverrideModule)
GetOverriddenBy() string
GetOverriddenByModuleDir() string
@@ -191,15 +192,14 @@
}
// Overrides a base module with the given OverrideModule.
-func (b *OverridableModuleBase) override(ctx BaseModuleContext, m Module, o OverrideModule) {
-
+func (b *OverridableModuleBase) override(ctx BaseModuleContext, bm OverridableModule, o OverrideModule) {
for _, p := range b.overridableProperties {
for _, op := range o.getOverridingProperties() {
if proptools.TypeEqual(p, op) {
err := proptools.ExtendProperties(p, op, nil, proptools.OrderReplace)
if err != nil {
if propertyErr, ok := err.(*proptools.ExtendPropertyError); ok {
- ctx.PropertyErrorf(propertyErr.Property, "%s", propertyErr.Err.Error())
+ ctx.OtherModulePropertyErrorf(bm, propertyErr.Property, "%s", propertyErr.Err.Error())
} else {
panic(err)
}
@@ -210,7 +210,7 @@
// Adds the base module to the overrides property, if exists, of the overriding module. See the
// comment on OverridableModuleBase.overridesProperty for details.
if b.overridesProperty != nil {
- *b.overridesProperty = append(*b.overridesProperty, ctx.ModuleName())
+ *b.overridesProperty = append(*b.overridesProperty, ctx.OtherModuleName(bm))
}
b.overridableModuleProperties.OverriddenBy = o.Name()
b.overridableModuleProperties.OverriddenByModuleDir = o.ModuleDir()
@@ -235,7 +235,7 @@
// to keep them in this order and not put any order mutators between them.
func RegisterOverridePostDepsMutators(ctx RegisterMutatorsContext) {
ctx.BottomUp("override_deps", overrideModuleDepsMutator).Parallel()
- ctx.BottomUp("perform_override", performOverrideMutator).Parallel()
+ ctx.Transition("override", &overrideTransitionMutator{})
// overridableModuleDepsMutator calls OverridablePropertiesDepsMutator so that overridable modules can
// add deps from overridable properties.
ctx.BottomUp("overridable_deps", overridableModuleDepsMutator).Parallel()
@@ -262,18 +262,6 @@
ctx.PropertyErrorf("base", "%q is not a valid module name", base)
return
}
- // See if there's a prebuilt module that overrides this override module with prefer flag,
- // in which case we call HideFromMake on the corresponding variant later.
- ctx.VisitDirectDepsWithTag(PrebuiltDepTag, func(dep Module) {
- prebuilt := GetEmbeddedPrebuilt(dep)
- if prebuilt == nil {
- panic("PrebuiltDepTag leads to a non-prebuilt module " + dep.Name())
- }
- if prebuilt.UsePrebuilt() {
- module.setOverriddenByPrebuilt(dep)
- return
- }
- })
baseModule := ctx.AddDependency(ctx.Module(), overrideBaseDepTag, *module.getOverrideModuleProperties().Base)[0]
if o, ok := baseModule.(OverridableModule); ok {
overrideModule := ctx.Module().(OverrideModule)
@@ -285,11 +273,13 @@
// Now, goes through all overridable modules, finds all modules overriding them, creates a local
// variant for each of them, and performs the actual overriding operation by calling override().
-func performOverrideMutator(ctx BottomUpMutatorContext) {
+type overrideTransitionMutator struct{}
+
+func (overrideTransitionMutator) Split(ctx BaseModuleContext) []string {
if b, ok := ctx.Module().(OverridableModule); ok {
overrides := b.getOverrides()
if len(overrides) == 0 {
- return
+ return []string{""}
}
variants := make([]string, len(overrides)+1)
// The first variant is for the original, non-overridden, base module.
@@ -297,27 +287,69 @@
for i, o := range overrides {
variants[i+1] = o.(Module).Name()
}
- mods := ctx.CreateLocalVariations(variants...)
- // Make the original variation the default one to depend on if no other override module variant
- // is specified.
- ctx.AliasVariation(variants[0])
- for i, o := range overrides {
- mods[i+1].(OverridableModule).override(ctx, mods[i+1], o)
- if prebuilt := o.getOverriddenByPrebuilt(); prebuilt != nil {
- // The overriding module itself, too, is overridden by a prebuilt.
- // Perform the same check for replacement
- checkInvariantsForSourceAndPrebuilt(ctx, mods[i+1], prebuilt)
- // Copy the flag and hide it in make
- mods[i+1].ReplacedByPrebuilt()
- }
- }
+ return variants
} else if o, ok := ctx.Module().(OverrideModule); ok {
// Create a variant of the overriding module with its own name. This matches the above local
// variant name rule for overridden modules, and thus allows ReplaceDependencies to match the
// two.
- ctx.CreateLocalVariations(o.Name())
- // To allow dependencies to be added without having to know the above variation.
- ctx.AliasVariation(o.Name())
+ return []string{o.Name()}
+ }
+
+ return []string{""}
+}
+
+func (overrideTransitionMutator) OutgoingTransition(ctx OutgoingTransitionContext, sourceVariation string) string {
+ if o, ok := ctx.Module().(OverrideModule); ok {
+ if ctx.DepTag() == overrideBaseDepTag {
+ return o.Name()
+ }
+ }
+
+ // Variations are always local and shouldn't affect the variant used for dependencies
+ return ""
+}
+
+func (overrideTransitionMutator) IncomingTransition(ctx IncomingTransitionContext, incomingVariation string) string {
+ if _, ok := ctx.Module().(OverridableModule); ok {
+ return incomingVariation
+ } else if o, ok := ctx.Module().(OverrideModule); ok {
+ // To allow dependencies to be added without having to know the variation.
+ return o.Name()
+ }
+
+ return ""
+}
+
+func (overrideTransitionMutator) Mutate(ctx BottomUpMutatorContext, variation string) {
+ if o, ok := ctx.Module().(OverrideModule); ok {
+ overridableDeps := ctx.GetDirectDepsWithTag(overrideBaseDepTag)
+ if len(overridableDeps) > 1 {
+ panic(fmt.Errorf("expected a single dependency with overrideBaseDepTag, found %q", overridableDeps))
+ } else if len(overridableDeps) == 1 {
+ b := overridableDeps[0].(OverridableModule)
+ b.override(ctx, b, o)
+
+ checkPrebuiltReplacesOverride(ctx, b)
+ }
+ }
+}
+
+func checkPrebuiltReplacesOverride(ctx BottomUpMutatorContext, b OverridableModule) {
+ // See if there's a prebuilt module that overrides this override module with prefer flag,
+ // in which case we call HideFromMake on the corresponding variant later.
+ prebuiltDeps := ctx.GetDirectDepsWithTag(PrebuiltDepTag)
+ for _, prebuiltDep := range prebuiltDeps {
+ prebuilt := GetEmbeddedPrebuilt(prebuiltDep)
+ if prebuilt == nil {
+ panic("PrebuiltDepTag leads to a non-prebuilt module " + prebuiltDep.Name())
+ }
+ if prebuilt.UsePrebuilt() {
+ // The overriding module itself, too, is overridden by a prebuilt.
+ // Perform the same check for replacement
+ checkInvariantsForSourceAndPrebuilt(ctx, b, prebuiltDep)
+ // Copy the flag and hide it in make
+ b.ReplacedByPrebuilt()
+ }
}
}
diff --git a/android/packaging.go b/android/packaging.go
index a8fb28d..fe61da1 100644
--- a/android/packaging.go
+++ b/android/packaging.go
@@ -43,6 +43,30 @@
effectiveLicenseFiles *Paths
partition string
+
+ // Whether this packaging spec represents an installation of the srcPath (i.e. this struct
+ // is created via InstallFile or InstallSymlink) or a simple packaging (i.e. created via
+ // PackageFile).
+ skipInstall bool
+}
+
+func (p *PackagingSpec) Equals(other *PackagingSpec) bool {
+ if other == nil {
+ return false
+ }
+ if p.relPathInPackage != other.relPathInPackage {
+ return false
+ }
+ if p.srcPath != other.srcPath || p.symlinkTarget != other.symlinkTarget {
+ return false
+ }
+ if p.executable != other.executable {
+ return false
+ }
+ if p.partition != other.partition {
+ return false
+ }
+ return true
}
// Get file name of installed package
@@ -74,6 +98,10 @@
return p.partition
}
+func (p *PackagingSpec) SkipInstall() bool {
+ return p.skipInstall
+}
+
type PackageModule interface {
Module
packagingBase() *PackagingBase
@@ -234,9 +262,15 @@
continue
}
}
- if _, ok := m[ps.relPathInPackage]; !ok {
- m[ps.relPathInPackage] = ps
+ dstPath := ps.relPathInPackage
+ if existingPs, ok := m[dstPath]; ok {
+ if !existingPs.Equals(&ps) {
+ ctx.ModuleErrorf("packaging conflict at %v:\n%v\n%v", dstPath, existingPs, ps)
+ }
+ continue
}
+
+ m[dstPath] = ps
}
})
return m
diff --git a/android/paths.go b/android/paths.go
index 2b33f67..39b660c 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -277,6 +277,7 @@
type genPathProvider interface {
genPathWithExt(ctx ModuleOutPathContext, subdir, ext string) ModuleGenPath
+ genPathWithExtAndTrimExt(ctx ModuleOutPathContext, subdir, ext string, trimExt string) ModuleGenPath
}
type objPathProvider interface {
objPathWithExt(ctx ModuleOutPathContext, subdir, ext string) ModuleObjPath
@@ -295,6 +296,16 @@
return PathForModuleGen(ctx)
}
+// GenPathWithExtAndTrimExt derives a new file path in ctx's generated sources directory
+// from the current path, but with the new extension and trim the suffix.
+func GenPathWithExtAndTrimExt(ctx ModuleOutPathContext, subdir string, p Path, ext string, trimExt string) ModuleGenPath {
+ if path, ok := p.(genPathProvider); ok {
+ return path.genPathWithExtAndTrimExt(ctx, subdir, ext, trimExt)
+ }
+ ReportPathErrorf(ctx, "Tried to create generated file from unsupported path: %s(%s)", reflect.TypeOf(p).Name(), p)
+ return PathForModuleGen(ctx)
+}
+
// ObjPathWithExt derives a new file path in ctx's object directory from the
// current path, but with the new extension.
func ObjPathWithExt(ctx ModuleOutPathContext, subdir string, p Path, ext string) ModuleObjPath {
@@ -1507,6 +1518,17 @@
return PathForModuleGen(ctx, subdir, pathtools.ReplaceExtension(p.path, ext))
}
+func (p SourcePath) genPathWithExtAndTrimExt(ctx ModuleOutPathContext, subdir, ext string, trimExt string) ModuleGenPath {
+ // If Trim_extension being set, force append Output_extension without replace original extension.
+ if trimExt != "" {
+ if ext != "" {
+ return PathForModuleGen(ctx, subdir, strings.TrimSuffix(p.path, trimExt)+"."+ext)
+ }
+ return PathForModuleGen(ctx, subdir, strings.TrimSuffix(p.path, trimExt))
+ }
+ return PathForModuleGen(ctx, subdir, pathtools.ReplaceExtension(p.path, ext))
+}
+
func (p SourcePath) objPathWithExt(ctx ModuleOutPathContext, subdir, ext string) ModuleObjPath {
return PathForModuleObj(ctx, subdir, pathtools.ReplaceExtension(p.path, ext))
}
@@ -1594,6 +1616,17 @@
return PathForModuleGen(ctx, subdir, pathtools.ReplaceExtension(p.path, ext))
}
+func (p ModuleGenPath) genPathWithExtAndTrimExt(ctx ModuleOutPathContext, subdir, ext string, trimExt string) ModuleGenPath {
+ // If Trim_extension being set, force append Output_extension without replace original extension.
+ if trimExt != "" {
+ if ext != "" {
+ return PathForModuleGen(ctx, subdir, strings.TrimSuffix(p.path, trimExt)+"."+ext)
+ }
+ return PathForModuleGen(ctx, subdir, strings.TrimSuffix(p.path, trimExt))
+ }
+ return PathForModuleGen(ctx, subdir, pathtools.ReplaceExtension(p.path, ext))
+}
+
func (p ModuleGenPath) objPathWithExt(ctx ModuleOutPathContext, subdir, ext string) ModuleObjPath {
return PathForModuleObj(ctx, subdir, pathtools.ReplaceExtension(p.path, ext))
}
diff --git a/android/prebuilt_test.go b/android/prebuilt_test.go
index 2574ed4..575b926 100644
--- a/android/prebuilt_test.go
+++ b/android/prebuilt_test.go
@@ -610,45 +610,3 @@
}
`, selectMainlineModuleContritbutions)
}
-
-// Test that apex_contributions of prebuilt modules are ignored in coverage builds
-func TestSourceIsSelectedInCoverageBuilds(t *testing.T) {
- prebuiltMainlineContributions := GroupFixturePreparers(
- FixtureModifyProductVariables(func(variables FixtureProductVariables) {
- variables.BuildFlags = map[string]string{
- "RELEASE_APEX_CONTRIBUTIONS_ADSERVICES": "my_prebuilt_apex_contributions",
- }
- }),
- FixtureMergeEnv(map[string]string{
- "EMMA_INSTRUMENT_FRAMEWORK": "true",
- }),
- )
- bp := `
- source {
- name: "foo",
- }
- prebuilt {
- name: "foo",
- srcs: ["prebuilt_file"],
- }
- apex_contributions {
- name: "my_prebuilt_apex_contributions",
- api_domain: "my_mainline_module",
- contents: [
- "prebuilt_foo",
- ],
- }
- all_apex_contributions {
- name: "all_apex_contributions",
- }
- `
- ctx := GroupFixturePreparers(
- PrepareForTestWithArchMutator,
- PrepareForTestWithPrebuilts,
- FixtureRegisterWithContext(registerTestPrebuiltModules),
- prebuiltMainlineContributions).RunTestWithBp(t, bp)
- source := ctx.ModuleForTests("foo", "android_common").Module()
- AssertBoolEquals(t, "Source should be preferred in coverage builds", true, !source.IsHideFromMake())
- prebuilt := ctx.ModuleForTests("prebuilt_foo", "android_common").Module()
- AssertBoolEquals(t, "Prebuilt should not be preferred in coverage builds", false, !prebuilt.IsHideFromMake())
-}
diff --git a/android/sdk_version.go b/android/sdk_version.go
index b2ff960..01b55d0 100644
--- a/android/sdk_version.go
+++ b/android/sdk_version.go
@@ -40,9 +40,15 @@
// SdkKind represents a particular category of an SDK spec like public, system, test, etc.
type SdkKind int
+// These are generally ordered from the narrower sdk version to the wider sdk version,
+// but not all entries have a strict subset/superset relationship.
+// For example, SdkTest and SdkModule do not have a strict subset/superset relationship but both
+// are supersets of SdkSystem.
+// The general trend should be kept when an additional sdk kind is added.
const (
SdkInvalid SdkKind = iota
SdkNone
+ SdkToolchain // API surface provided by ART to compile other API domains
SdkCore
SdkCorePlatform
SdkIntraCore // API surface provided by one core module to another
@@ -53,7 +59,6 @@
SdkModule
SdkSystemServer
SdkPrivate
- SdkToolchain // API surface provided by ART to compile other API domains
)
// String returns the string representation of this SdkKind
diff --git a/android/selects_test.go b/android/selects_test.go
index f912ce6..d9499a5 100644
--- a/android/selects_test.go
+++ b/android/selects_test.go
@@ -28,6 +28,7 @@
name string
bp string
provider selectsTestProvider
+ providers map[string]selectsTestProvider
vendorVars map[string]map[string]string
expectedError string
}{
@@ -411,6 +412,42 @@
},
},
{
+ name: "defaults applied to multiple modules",
+ bp: `
+ my_module_type {
+ name: "foo2",
+ defaults: ["bar"],
+ my_string_list: select(soong_config_variable("my_namespace", "my_variable"), {
+ "a": ["a1"],
+ default: ["b1"],
+ }),
+ }
+ my_module_type {
+ name: "foo",
+ defaults: ["bar"],
+ my_string_list: select(soong_config_variable("my_namespace", "my_variable"), {
+ "a": ["a1"],
+ default: ["b1"],
+ }),
+ }
+ my_defaults {
+ name: "bar",
+ my_string_list: select(soong_config_variable("my_namespace", "my_variable2"), {
+ "a": ["a2"],
+ default: ["b2"],
+ }),
+ }
+ `,
+ providers: map[string]selectsTestProvider{
+ "foo": {
+ my_string_list: &[]string{"b2", "b1"},
+ },
+ "foo2": {
+ my_string_list: &[]string{"b2", "b1"},
+ },
+ },
+ },
+ {
name: "Replacing string list",
bp: `
my_module_type {
@@ -596,6 +633,61 @@
},
expectedError: "Expected all branches of a select on condition boolean_var_for_testing\\(\\) to have type bool, found string",
},
+ {
+ name: "Assigning select to nonconfigurable bool",
+ bp: `
+ my_module_type {
+ name: "foo",
+ my_nonconfigurable_bool: select(arch(), {
+ "x86_64": true,
+ default: false,
+ }),
+ }
+ `,
+ expectedError: `can't assign select statement to non-configurable property "my_nonconfigurable_bool"`,
+ },
+ {
+ name: "Assigning select to nonconfigurable string",
+ bp: `
+ my_module_type {
+ name: "foo",
+ my_nonconfigurable_string: select(arch(), {
+ "x86_64": "x86!",
+ default: "unknown!",
+ }),
+ }
+ `,
+ expectedError: `can't assign select statement to non-configurable property "my_nonconfigurable_string"`,
+ },
+ {
+ name: "Assigning appended selects to nonconfigurable string",
+ bp: `
+ my_module_type {
+ name: "foo",
+ my_nonconfigurable_string: select(arch(), {
+ "x86_64": "x86!",
+ default: "unknown!",
+ }) + select(os(), {
+ "darwin": "_darwin!",
+ default: "unknown!",
+ }),
+ }
+ `,
+ expectedError: `can't assign select statement to non-configurable property "my_nonconfigurable_string"`,
+ },
+ {
+ name: "Assigning select to nonconfigurable string list",
+ bp: `
+ my_module_type {
+ name: "foo",
+ my_nonconfigurable_string_list: select(arch(), {
+ "x86_64": ["foo", "bar"],
+ default: ["baz", "qux"],
+ }),
+ }
+ `,
+ expectedError: `can't assign select statement to non-configurable property "my_nonconfigurable_string_list"`,
+ },
}
for _, tc := range testCases {
@@ -617,10 +709,19 @@
result := fixtures.RunTestWithBp(t, tc.bp)
if tc.expectedError == "" {
- m := result.ModuleForTests("foo", "android_arm64_armv8-a")
- p, _ := OtherModuleProvider(result.testContext.OtherModuleProviderAdaptor(), m.Module(), selectsTestProviderKey)
- if !reflect.DeepEqual(p, tc.provider) {
- t.Errorf("Expected:\n %q\ngot:\n %q", tc.provider.String(), p.String())
+ if len(tc.providers) == 0 {
+ tc.providers = map[string]selectsTestProvider{
+ "foo": tc.provider,
+ }
+ }
+
+ for moduleName := range tc.providers {
+ expected := tc.providers[moduleName]
+ m := result.ModuleForTests(moduleName, "android_arm64_armv8-a")
+ p, _ := OtherModuleProvider(result.testContext.OtherModuleProviderAdaptor(), m.Module(), selectsTestProviderKey)
+ if !reflect.DeepEqual(p, expected) {
+ t.Errorf("Expected:\n %q\ngot:\n %q", expected.String(), p.String())
+ }
}
}
})
@@ -628,11 +729,14 @@
}
type selectsTestProvider struct {
- my_bool *bool
- my_string *string
- my_string_list *[]string
- my_paths *[]string
- replacing_string_list *[]string
+ my_bool *bool
+ my_string *string
+ my_string_list *[]string
+ my_paths *[]string
+ replacing_string_list *[]string
+ my_nonconfigurable_bool *bool
+ my_nonconfigurable_string *string
+ my_nonconfigurable_string_list []string
}
func (p *selectsTestProvider) String() string {
@@ -644,23 +748,42 @@
if p.my_string != nil {
myStringStr = *p.my_string
}
+ myNonconfigurableStringStr := "nil"
+ if p.my_string != nil {
+ myNonconfigurableStringStr = *p.my_nonconfigurable_string
+ }
return fmt.Sprintf(`selectsTestProvider {
my_bool: %v,
my_string: %s,
my_string_list: %s,
my_paths: %s,
replacing_string_list %s,
-}`, myBoolStr, myStringStr, p.my_string_list, p.my_paths, p.replacing_string_list)
+ my_nonconfigurable_bool: %v,
+ my_nonconfigurable_string: %s,
+ my_nonconfigurable_string_list: %s,
+}`,
+ myBoolStr,
+ myStringStr,
+ p.my_string_list,
+ p.my_paths,
+ p.replacing_string_list,
+ p.my_nonconfigurable_bool,
+ myNonconfigurableStringStr,
+ p.my_nonconfigurable_string_list,
+ )
}
var selectsTestProviderKey = blueprint.NewProvider[selectsTestProvider]()
type selectsMockModuleProperties struct {
- My_bool proptools.Configurable[bool]
- My_string proptools.Configurable[string]
- My_string_list proptools.Configurable[[]string]
- My_paths proptools.Configurable[[]string] `android:"path"`
- Replacing_string_list proptools.Configurable[[]string] `android:"replace_instead_of_append,arch_variant"`
+ My_bool proptools.Configurable[bool]
+ My_string proptools.Configurable[string]
+ My_string_list proptools.Configurable[[]string]
+ My_paths proptools.Configurable[[]string] `android:"path"`
+ Replacing_string_list proptools.Configurable[[]string] `android:"replace_instead_of_append,arch_variant"`
+ My_nonconfigurable_bool *bool
+ My_nonconfigurable_string *string
+ My_nonconfigurable_string_list []string
}
type selectsMockModule struct {
@@ -671,11 +794,14 @@
func (p *selectsMockModule) GenerateAndroidBuildActions(ctx ModuleContext) {
SetProvider(ctx, selectsTestProviderKey, selectsTestProvider{
- my_bool: p.properties.My_bool.Get(ctx),
- my_string: p.properties.My_string.Get(ctx),
- my_string_list: p.properties.My_string_list.Get(ctx),
- my_paths: p.properties.My_paths.Get(ctx),
- replacing_string_list: p.properties.Replacing_string_list.Get(ctx),
+ my_bool: p.properties.My_bool.Get(ctx),
+ my_string: p.properties.My_string.Get(ctx),
+ my_string_list: p.properties.My_string_list.Get(ctx),
+ my_paths: p.properties.My_paths.Get(ctx),
+ replacing_string_list: p.properties.Replacing_string_list.Get(ctx),
+ my_nonconfigurable_bool: p.properties.My_nonconfigurable_bool,
+ my_nonconfigurable_string: p.properties.My_nonconfigurable_string,
+ my_nonconfigurable_string_list: p.properties.My_nonconfigurable_string_list,
})
}
diff --git a/androidmk/androidmk/android.go b/androidmk/androidmk/android.go
index 9d61e1c..8a8bb2e 100644
--- a/androidmk/androidmk/android.go
+++ b/androidmk/androidmk/android.go
@@ -151,7 +151,7 @@
"LOCAL_CLANG_CFLAGS": "clang_cflags",
"LOCAL_YACCFLAGS": "yacc.flags",
"LOCAL_SANITIZE_RECOVER": "sanitize.recover",
- "LOCAL_LOGTAGS_FILES": "logtags",
+ "LOCAL_SOONG_LOGTAGS_FILES": "logtags",
"LOCAL_EXPORT_HEADER_LIBRARY_HEADERS": "export_header_lib_headers",
"LOCAL_EXPORT_SHARED_LIBRARY_HEADERS": "export_shared_lib_headers",
"LOCAL_EXPORT_STATIC_LIBRARY_HEADERS": "export_static_lib_headers",
diff --git a/apex/aconfig_test.go b/apex/aconfig_test.go
index 3de9286..726041c 100644
--- a/apex/aconfig_test.go
+++ b/apex/aconfig_test.go
@@ -165,6 +165,9 @@
cc_library {
name: "libbase",
srcs: ["libbase.cc"],
+ apex_available: [
+ "myapex",
+ ],
}
cc_library {
name: "libaconfig_storage_read_api_cc",
@@ -425,6 +428,9 @@
cc_library {
name: "libbase",
srcs: ["libbase.cc"],
+ apex_available: [
+ "myapex",
+ ],
}
cc_library {
name: "libaconfig_storage_read_api_cc",
@@ -487,6 +493,9 @@
cc_library {
name: "libbase",
srcs: ["libbase.cc"],
+ apex_available: [
+ "myapex",
+ ],
}
cc_library {
name: "libaconfig_storage_read_api_cc",
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 8a3735c..0b26f16 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -3671,34 +3671,13 @@
func vndkLibrariesTxtFiles(vers ...string) (result string) {
for _, v := range vers {
- if v == "current" {
- for _, txt := range []string{"vndkcore", "vndksp", "vndkprivate", "vndkproduct"} {
- result += `
- ` + txt + `_libraries_txt {
- name: "` + txt + `.libraries.txt",
- insert_vndk_version: true,
- }
- `
- }
+ for _, txt := range []string{"llndk", "vndkcore", "vndksp", "vndkprivate", "vndkproduct"} {
result += `
- llndk_libraries_txt {
- name: "llndk.libraries.txt",
- }
- llndk_libraries_txt_for_apex {
- name: "llndk.libraries.txt.apex",
- stem: "llndk.libraries.txt",
- insert_vndk_version: true,
- }
- `
- } else {
- for _, txt := range []string{"llndk", "vndkcore", "vndksp", "vndkprivate", "vndkproduct"} {
- result += `
prebuilt_etc {
name: "` + txt + `.libraries.` + v + `.txt",
src: "dummy.txt",
}
`
- }
}
}
return
@@ -10694,6 +10673,9 @@
cc_library {
name: "libbase",
srcs: ["libbase.cc"],
+ apex_available: [
+ "myapex",
+ ],
}
cc_library {
name: "libaconfig_storage_read_api_cc",
@@ -11425,6 +11407,7 @@
aconfig_declarations {
name: "%[1]s",
package: "com.example.package",
+ container: "system",
srcs: [
"%[1]s.aconfig",
],
diff --git a/bin/build-flag b/bin/build-flag
new file mode 100755
index 0000000..dc404bc
--- /dev/null
+++ b/bin/build-flag
@@ -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 android/soong/cmd/release_config/build_flag
+
+cd ${TOP}
+exec "$(getoutdir)/build-flag" "$@"
diff --git a/cc/androidmk.go b/cc/androidmk.go
index ef26366..071d829 100644
--- a/cc/androidmk.go
+++ b/cc/androidmk.go
@@ -88,7 +88,7 @@
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
if len(c.Properties.Logtags) > 0 {
- entries.AddStrings("LOCAL_LOGTAGS_FILES", c.Properties.Logtags...)
+ entries.AddStrings("LOCAL_SOONG_LOGTAGS_FILES", c.logtagsPaths.Strings()...)
}
// Note: Pass the exact value of AndroidMkSystemSharedLibs to the Make
// world, even if it is an empty list. In the Make world,
diff --git a/cc/builder.go b/cc/builder.go
index 845176e..e255cbe 100644
--- a/cc/builder.go
+++ b/cc/builder.go
@@ -608,6 +608,10 @@
ccCmd = "clang++"
moduleFlags = cppflags
moduleToolingFlags = toolingCppflags
+ case ".rs":
+ // A source provider (e.g. rust_bindgen) may provide both rs and c files.
+ // Ignore the rs files.
+ continue
case ".h", ".hpp":
ctx.PropertyErrorf("srcs", "Header file %s is not supported, instead use export_include_dirs or local_include_dirs.", srcFile)
continue
@@ -855,8 +859,8 @@
// into a single .ldump sAbi dump file
func transformDumpToLinkedDump(ctx android.ModuleContext, sAbiDumps android.Paths, soFile android.Path,
baseName string, exportedIncludeDirs []string, symbolFile android.OptionalPath,
- excludedSymbolVersions, excludedSymbolTags []string,
- api string) android.Path {
+ excludedSymbolVersions, excludedSymbolTags, includedSymbolTags []string,
+ api string, isLlndk bool) android.Path {
outputFile := android.PathForModuleOut(ctx, baseName+".lsdump")
@@ -874,6 +878,12 @@
for _, tag := range excludedSymbolTags {
symbolFilterStr += " --exclude-symbol-tag " + tag
}
+ for _, tag := range includedSymbolTags {
+ symbolFilterStr += " --include-symbol-tag " + tag
+ }
+ if isLlndk {
+ symbolFilterStr += " --symbol-tag-policy MatchTagOnly"
+ }
apiLevelsJson := android.GetApiLevelsJson(ctx)
implicits = append(implicits, apiLevelsJson)
symbolFilterStr += " --api-map " + apiLevelsJson.String()
diff --git a/cc/cc.go b/cc/cc.go
index e3954d7..b48a573 100644
--- a/cc/cc.go
+++ b/cc/cc.go
@@ -50,6 +50,7 @@
ctx.PreDepsMutators(func(ctx android.RegisterMutatorsContext) {
ctx.BottomUp("sdk", sdkMutator).Parallel()
ctx.BottomUp("vndk", VndkMutator).Parallel()
+ ctx.BottomUp("llndk", llndkMutator).Parallel()
ctx.BottomUp("link", LinkageMutator).Parallel()
ctx.BottomUp("test_per_src", TestPerSrcMutator).Parallel()
ctx.BottomUp("version", versionMutator).Parallel()
@@ -319,7 +320,7 @@
// *.logtags files, to combine together in order to generate the /system/etc/event-log-tags
// file
- Logtags []string
+ Logtags []string `android:"path"`
// Make this module available when building for ramdisk.
// On device without a dedicated recovery partition, the module is only
@@ -908,6 +909,8 @@
// Aconfig files for all transitive deps. Also exposed via TransitiveDeclarationsInfo
mergedAconfigFiles map[string]android.Paths
+
+ logtagsPaths android.Paths
}
func (c *Module) AddJSONData(d *map[string]interface{}) {
@@ -1997,6 +2000,11 @@
func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
ctx := moduleContextFromAndroidModuleContext(actx, c)
+ c.logtagsPaths = android.PathsForModuleSrc(actx, c.Properties.Logtags)
+ android.SetProvider(ctx, android.LogtagsProviderKey, &android.LogtagsInfo{
+ Logtags: c.logtagsPaths,
+ })
+
// If Test_only is set on a module in bp file, respect the setting, otherwise
// see if is a known test module type.
testOnly := c.testModule || c.testLibrary()
diff --git a/cc/library.go b/cc/library.go
index 5b24809..a436649 100644
--- a/cc/library.go
+++ b/cc/library.go
@@ -1249,16 +1249,29 @@
func (library *libraryDecorator) linkLlndkSAbiDumpFiles(ctx ModuleContext,
deps PathDeps, sAbiDumpFiles android.Paths, soFile android.Path, libFileName string,
- excludeSymbolVersions, excludeSymbolTags []string) android.Path {
+ excludeSymbolVersions, excludeSymbolTags []string,
+ vendorApiLevel string) android.Path {
// NDK symbols in version 34 are LLNDK symbols. Those in version 35 are not.
- // TODO(b/314010764): Add parameters to read LLNDK symbols from the symbol file.
return transformDumpToLinkedDump(ctx,
sAbiDumpFiles, soFile, libFileName+".llndk",
library.llndkIncludeDirsForAbiCheck(ctx, deps),
android.OptionalPathForModuleSrc(ctx, library.Properties.Llndk.Symbol_file),
append([]string{"*_PLATFORM", "*_PRIVATE"}, excludeSymbolVersions...),
append([]string{"platform-only"}, excludeSymbolTags...),
- "34")
+ []string{"llndk=" + vendorApiLevel}, "34", true /* isLlndk */)
+}
+
+func (library *libraryDecorator) linkApexSAbiDumpFiles(ctx ModuleContext,
+ deps PathDeps, sAbiDumpFiles android.Paths, soFile android.Path, libFileName string,
+ excludeSymbolVersions, excludeSymbolTags []string,
+ sdkVersion string) android.Path {
+ return transformDumpToLinkedDump(ctx,
+ sAbiDumpFiles, soFile, libFileName+".apex",
+ library.exportedIncludeDirsForAbiCheck(ctx),
+ android.OptionalPathForModuleSrc(ctx, library.Properties.Stubs.Symbol_file),
+ append([]string{"*_PLATFORM", "*_PRIVATE"}, excludeSymbolVersions...),
+ append([]string{"platform-only"}, excludeSymbolTags...),
+ []string{"apex", "systemapi"}, sdkVersion, false /* isLlndk */)
}
func getRefAbiDumpFile(ctx android.ModuleInstallPathContext,
@@ -1276,21 +1289,21 @@
}
// Return the previous and current SDK versions for cross-version ABI diff.
-func crossVersionAbiDiffSdkVersions(ctx ModuleContext, dumpDir string) (string, string) {
+func crossVersionAbiDiffSdkVersions(ctx ModuleContext, dumpDir string) (int, int) {
sdkVersionInt := ctx.Config().PlatformSdkVersion().FinalInt()
- sdkVersionStr := ctx.Config().PlatformSdkVersion().String()
if ctx.Config().PlatformSdkFinal() {
- return strconv.Itoa(sdkVersionInt - 1), sdkVersionStr
+ return sdkVersionInt - 1, sdkVersionInt
} else {
// The platform SDK version can be upgraded before finalization while the corresponding abi dumps hasn't
// been generated. Thus the Cross-Version Check chooses PLATFORM_SDK_VERION - 1 as previous version.
// This situation could be identified by checking the existence of the PLATFORM_SDK_VERION dump directory.
- versionedDumpDir := android.ExistentPathForSource(ctx, dumpDir, sdkVersionStr)
+ versionedDumpDir := android.ExistentPathForSource(ctx,
+ dumpDir, ctx.Config().PlatformSdkVersion().String())
if versionedDumpDir.Valid() {
- return sdkVersionStr, strconv.Itoa(sdkVersionInt + 1)
+ return sdkVersionInt, sdkVersionInt + 1
} else {
- return strconv.Itoa(sdkVersionInt - 1), sdkVersionStr
+ return sdkVersionInt - 1, sdkVersionInt
}
}
}
@@ -1385,20 +1398,30 @@
android.OptionalPathForModuleSrc(ctx, library.symbolFileForAbiCheck(ctx)),
headerAbiChecker.Exclude_symbol_versions,
headerAbiChecker.Exclude_symbol_tags,
- currSdkVersion)
+ []string{} /* includeSymbolTags */, currSdkVersion, false /* isLlndk */)
- var llndkDump android.Path
+ var llndkDump, apexVariantDump android.Path
tags := classifySourceAbiDump(ctx)
for _, tag := range tags {
- if tag == llndkLsdumpTag {
+ if tag == llndkLsdumpTag && currVendorVersion != "" {
if llndkDump == nil {
// TODO(b/323447559): Evaluate if replacing sAbiDumpFiles with implDump is faster
llndkDump = library.linkLlndkSAbiDumpFiles(ctx,
deps, objs.sAbiDumpFiles, soFile, fileName,
headerAbiChecker.Exclude_symbol_versions,
- headerAbiChecker.Exclude_symbol_tags)
+ headerAbiChecker.Exclude_symbol_tags,
+ currVendorVersion)
}
addLsdumpPath(string(tag) + ":" + llndkDump.String())
+ } else if tag == apexLsdumpTag {
+ if apexVariantDump == nil {
+ apexVariantDump = library.linkApexSAbiDumpFiles(ctx,
+ deps, objs.sAbiDumpFiles, soFile, fileName,
+ headerAbiChecker.Exclude_symbol_versions,
+ headerAbiChecker.Exclude_symbol_tags,
+ currSdkVersion)
+ }
+ addLsdumpPath(string(tag) + ":" + apexVariantDump.String())
} else {
addLsdumpPath(string(tag) + ":" + implDump.String())
}
@@ -1412,11 +1435,14 @@
}
dumpDir := filepath.Join("prebuilts", "abi-dumps", dumpDirName)
isLlndk := (tag == llndkLsdumpTag)
+ isApex := (tag == apexLsdumpTag)
isNdk := (tag == ndkLsdumpTag)
binderBitness := ctx.DeviceConfig().BinderBitness()
nameExt := ""
if isLlndk {
nameExt = "llndk"
+ } else if isApex {
+ nameExt = "apex"
}
// Check against the previous version.
var prevVersion, currVersion string
@@ -1430,7 +1456,13 @@
sourceDump = llndkDump
}
} else {
- prevVersion, currVersion = crossVersionAbiDiffSdkVersions(ctx, dumpDir)
+ prevVersionInt, currVersionInt := crossVersionAbiDiffSdkVersions(ctx, dumpDir)
+ prevVersion = strconv.Itoa(prevVersionInt)
+ currVersion = strconv.Itoa(currVersionInt)
+ // APEX dumps are generated by different rules after trunk stable.
+ if isApex && prevVersionInt > 34 {
+ sourceDump = apexVariantDump
+ }
}
prevDumpDir := filepath.Join(dumpDir, prevVersion, binderBitness)
prevDumpFile := getRefAbiDumpFile(ctx, prevDumpDir, fileName)
@@ -1447,6 +1479,10 @@
}
} else {
currVersion = currSdkVersion
+ if isApex && (!ctx.Config().PlatformSdkFinal() ||
+ ctx.Config().PlatformSdkVersion().FinalInt() > 34) {
+ sourceDump = apexVariantDump
+ }
}
currDumpDir := filepath.Join(dumpDir, currVersion, binderBitness)
currDumpFile := getRefAbiDumpFile(ctx, currDumpDir, fileName)
diff --git a/cc/linker.go b/cc/linker.go
index 9686697..56a68b2 100644
--- a/cc/linker.go
+++ b/cc/linker.go
@@ -330,6 +330,7 @@
deps.StaticLibs = removeListFromList(deps.StaticLibs, linker.Properties.Target.Vendor.Exclude_static_libs)
deps.HeaderLibs = append(deps.HeaderLibs, linker.Properties.Target.Vendor.Header_libs...)
deps.HeaderLibs = removeListFromList(deps.HeaderLibs, linker.Properties.Target.Vendor.Exclude_header_libs)
+ deps.ReexportHeaderLibHeaders = removeListFromList(deps.ReexportHeaderLibHeaders, linker.Properties.Target.Vendor.Exclude_header_libs)
deps.ReexportStaticLibHeaders = removeListFromList(deps.ReexportStaticLibHeaders, linker.Properties.Target.Vendor.Exclude_static_libs)
deps.WholeStaticLibs = removeListFromList(deps.WholeStaticLibs, linker.Properties.Target.Vendor.Exclude_static_libs)
deps.RuntimeLibs = removeListFromList(deps.RuntimeLibs, linker.Properties.Target.Vendor.Exclude_runtime_libs)
@@ -342,6 +343,7 @@
deps.StaticLibs = append(deps.StaticLibs, linker.Properties.Target.Product.Static_libs...)
deps.StaticLibs = removeListFromList(deps.StaticLibs, linker.Properties.Target.Product.Exclude_static_libs)
deps.HeaderLibs = removeListFromList(deps.HeaderLibs, linker.Properties.Target.Product.Exclude_header_libs)
+ deps.ReexportHeaderLibHeaders = removeListFromList(deps.ReexportHeaderLibHeaders, linker.Properties.Target.Product.Exclude_header_libs)
deps.ReexportStaticLibHeaders = removeListFromList(deps.ReexportStaticLibHeaders, linker.Properties.Target.Product.Exclude_static_libs)
deps.WholeStaticLibs = removeListFromList(deps.WholeStaticLibs, linker.Properties.Target.Product.Exclude_static_libs)
deps.RuntimeLibs = removeListFromList(deps.RuntimeLibs, linker.Properties.Target.Product.Exclude_runtime_libs)
diff --git a/cc/llndk_library.go b/cc/llndk_library.go
index 9e727a1..ae9da98 100644
--- a/cc/llndk_library.go
+++ b/cc/llndk_library.go
@@ -16,12 +16,12 @@
import (
"android/soong/android"
+ "android/soong/etc"
"strings"
)
var (
llndkLibrarySuffix = ".llndk"
- llndkHeadersSuffix = ".llndk"
)
// Holds properties to describe a stub shared library based on the provided version file.
@@ -78,3 +78,138 @@
ctx.Strict("LLNDK_MOVED_TO_APEX_LIBRARIES",
strings.Join(android.SortedKeys(movedToApexLlndkLibraries), " "))
}
+
+func init() {
+ RegisterLlndkLibraryTxtType(android.InitRegistrationContext)
+}
+
+func RegisterLlndkLibraryTxtType(ctx android.RegistrationContext) {
+ ctx.RegisterParallelSingletonModuleType("llndk_libraries_txt", llndkLibrariesTxtFactory)
+}
+
+type llndkLibrariesTxtModule struct {
+ android.SingletonModuleBase
+
+ outputFile android.OutputPath
+ moduleNames []string
+ fileNames []string
+}
+
+var _ etc.PrebuiltEtcModule = &llndkLibrariesTxtModule{}
+var _ android.OutputFileProducer = &llndkLibrariesTxtModule{}
+
+// llndk_libraries_txt is a singleton module whose content is a list of LLNDK libraries
+// generated by Soong but can be referenced by other modules.
+// For example, apex_vndk can depend on these files as prebuilt.
+// Make uses LLNDK_LIBRARIES to determine which libraries to install.
+// HWASAN is only part of the LL-NDK in builds in which libc depends on HWASAN.
+// Therefore, by removing the library here, we cause it to only be installed if libc
+// depends on it.
+func llndkLibrariesTxtFactory() android.SingletonModule {
+ m := &llndkLibrariesTxtModule{}
+ android.InitAndroidArchModule(m, android.DeviceSupported, android.MultilibCommon)
+ return m
+}
+
+func (txt *llndkLibrariesTxtModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
+ filename := txt.Name()
+
+ txt.outputFile = android.PathForModuleOut(ctx, filename).OutputPath
+
+ installPath := android.PathForModuleInstall(ctx, "etc")
+ ctx.InstallFile(installPath, filename, txt.outputFile)
+}
+
+func (txt *llndkLibrariesTxtModule) GenerateSingletonBuildActions(ctx android.SingletonContext) {
+ ctx.VisitAllModules(func(m android.Module) {
+ if c, ok := m.(*Module); ok && c.VendorProperties.IsLLNDK && !c.Header() && !c.IsVndkPrebuiltLibrary() {
+ filename, err := getVndkFileName(c)
+ if err != nil {
+ ctx.ModuleErrorf(m, "%s", err)
+ }
+
+ if !strings.HasPrefix(ctx.ModuleName(m), "libclang_rt.hwasan") {
+ txt.moduleNames = append(txt.moduleNames, ctx.ModuleName(m))
+ }
+ txt.fileNames = append(txt.fileNames, filename)
+ }
+ })
+ txt.moduleNames = android.SortedUniqueStrings(txt.moduleNames)
+ txt.fileNames = android.SortedUniqueStrings(txt.fileNames)
+
+ android.WriteFileRule(ctx, txt.outputFile, strings.Join(txt.fileNames, "\n"))
+}
+
+func (txt *llndkLibrariesTxtModule) AndroidMkEntries() []android.AndroidMkEntries {
+ return []android.AndroidMkEntries{{
+ Class: "ETC",
+ OutputFile: android.OptionalPathForPath(txt.outputFile),
+ ExtraEntries: []android.AndroidMkExtraEntriesFunc{
+ func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
+ entries.SetString("LOCAL_MODULE_STEM", txt.outputFile.Base())
+ },
+ },
+ }}
+}
+
+func (txt *llndkLibrariesTxtModule) MakeVars(ctx android.MakeVarsContext) {
+ ctx.Strict("LLNDK_LIBRARIES", strings.Join(txt.moduleNames, " "))
+}
+
+// PrebuiltEtcModule interface
+func (txt *llndkLibrariesTxtModule) OutputFile() android.OutputPath {
+ return txt.outputFile
+}
+
+// PrebuiltEtcModule interface
+func (txt *llndkLibrariesTxtModule) BaseDir() string {
+ return "etc"
+}
+
+// PrebuiltEtcModule interface
+func (txt *llndkLibrariesTxtModule) SubDir() string {
+ return ""
+}
+
+func (txt *llndkLibrariesTxtModule) OutputFiles(tag string) (android.Paths, error) {
+ return android.Paths{txt.outputFile}, nil
+}
+
+func llndkMutator(mctx android.BottomUpMutatorContext) {
+ m, ok := mctx.Module().(*Module)
+ if !ok {
+ return
+ }
+
+ if shouldSkipLlndkMutator(m) {
+ return
+ }
+
+ lib, isLib := m.linker.(*libraryDecorator)
+ prebuiltLib, isPrebuiltLib := m.linker.(*prebuiltLibraryLinker)
+
+ if m.InVendorOrProduct() && isLib && lib.hasLLNDKStubs() {
+ m.VendorProperties.IsLLNDK = true
+ }
+ if m.InVendorOrProduct() && isPrebuiltLib && prebuiltLib.hasLLNDKStubs() {
+ m.VendorProperties.IsLLNDK = true
+ }
+
+ if m.IsVndkPrebuiltLibrary() && !m.IsVndk() {
+ m.VendorProperties.IsLLNDK = true
+ }
+}
+
+// Check for modules that mustn't be LLNDK
+func shouldSkipLlndkMutator(m *Module) bool {
+ if !m.Enabled() {
+ return true
+ }
+ if !m.Device() {
+ return true
+ }
+ if m.Target().NativeBridge == android.NativeBridgeEnabled {
+ return true
+ }
+ return false
+}
diff --git a/cc/prebuilt.go b/cc/prebuilt.go
index cbb5d58..e9f790f 100644
--- a/cc/prebuilt.go
+++ b/cc/prebuilt.go
@@ -177,7 +177,7 @@
implicits = append(implicits, importLibOutputFile)
ctx.Build(pctx, android.BuildParams{
- Rule: android.Cp,
+ Rule: android.CpExecutable,
Description: "prebuilt import library",
Input: importLibSrc,
Output: importLibOutputFile,
@@ -188,7 +188,7 @@
}
ctx.Build(pctx, android.BuildParams{
- Rule: android.Cp,
+ Rule: android.CpExecutable,
Description: "prebuilt shared library",
Implicits: implicits,
Input: in,
diff --git a/cc/sabi.go b/cc/sabi.go
index ef43c8d..cd9bf63 100644
--- a/cc/sabi.go
+++ b/cc/sabi.go
@@ -29,6 +29,7 @@
type lsdumpTag string
const (
+ apexLsdumpTag lsdumpTag = "APEX"
llndkLsdumpTag lsdumpTag = "LLNDK"
ndkLsdumpTag lsdumpTag = "NDK"
platformLsdumpTag lsdumpTag = "PLATFORM"
@@ -39,6 +40,8 @@
// Return the prebuilt ABI dump directory for a tag; an empty string for an opt-in dump.
func (tag *lsdumpTag) dirName() string {
switch *tag {
+ case apexLsdumpTag:
+ return "platform"
case ndkLsdumpTag:
return "ndk"
case llndkLsdumpTag:
@@ -134,11 +137,13 @@
if m.isImplementationForLLNDKPublic() {
result = append(result, llndkLsdumpTag)
}
- // Return NDK if the library is both NDK and APEX.
- // TODO(b/309880485): Split NDK and APEX ABI.
if m.IsNdk(ctx.Config()) {
result = append(result, ndkLsdumpTag)
- } else if m.library.hasStubsVariants() || headerAbiChecker.enabled() {
+ }
+ // APEX and opt-in platform dumps are placed in the same directory.
+ if m.library.hasStubsVariants() {
+ result = append(result, apexLsdumpTag)
+ } else if headerAbiChecker.enabled() {
result = append(result, platformLsdumpTag)
}
} else if headerAbiChecker.enabled() {
diff --git a/cc/sanitize.go b/cc/sanitize.go
index db046ec..0cb54e5 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -55,7 +55,6 @@
// higher number of "optimized out" stack variables.
// b/112437883.
"-instcombine-lower-dbg-declare=0",
- "-hwasan-use-after-scope=1",
"-dom-tree-reachability-max-bbs-to-explore=128",
}
@@ -82,7 +81,8 @@
"-fno-sanitize-recover=integer,undefined"}
hwasanGlobalOptions = []string{"heap_history_size=1023", "stack_history_size=512",
"export_memory_stats=0", "max_malloc_fill_size=131072", "malloc_fill_byte=0"}
- memtagStackCommonFlags = []string{"-march=armv8-a+memtag", "-mllvm", "-dom-tree-reachability-max-bbs-to-explore=128"}
+ memtagStackCommonFlags = []string{"-march=armv8-a+memtag"}
+ memtagStackLlvmFlags = []string{"-dom-tree-reachability-max-bbs-to-explore=128"}
hostOnlySanitizeFlags = []string{"-fno-sanitize-recover=all"}
deviceOnlySanitizeFlags = []string{"-fsanitize-trap=all"}
@@ -176,11 +176,11 @@
func (t SanitizerType) registerMutators(ctx android.RegisterMutatorsContext) {
switch t {
- case cfi, Hwasan, Asan, tsan, Fuzzer, scs:
+ case cfi, Hwasan, Asan, tsan, Fuzzer, scs, Memtag_stack:
sanitizer := &sanitizerSplitMutator{t}
ctx.TopDown(t.variationName()+"_markapexes", sanitizer.markSanitizableApexesMutator)
ctx.Transition(t.variationName(), sanitizer)
- case Memtag_heap, Memtag_stack, Memtag_globals, intOverflow:
+ case Memtag_heap, Memtag_globals, intOverflow:
// do nothing
default:
panic(fmt.Errorf("unknown SanitizerType %d", t))
@@ -407,6 +407,7 @@
android.RegisterMakeVarsProvider(pctx, cfiMakeVarsProvider)
android.RegisterMakeVarsProvider(pctx, hwasanMakeVarsProvider)
+ android.RegisterMakeVarsProvider(pctx, memtagStackMakeVarsProvider)
}
func (sanitize *sanitize) props() []interface{} {
@@ -683,10 +684,14 @@
s.Diag.Cfi = nil
}
- // HWASan ramdisk (which is built from recovery) goes over some bootloader limit.
- // Keep libc instrumented so that ramdisk / vendor_ramdisk / recovery can run hwasan-instrumented code if necessary.
- if (ctx.inRamdisk() || ctx.inVendorRamdisk() || ctx.inRecovery()) && !strings.HasPrefix(ctx.ModuleDir(), "bionic/libc") {
- s.Hwaddress = nil
+ if ctx.inRamdisk() || ctx.inVendorRamdisk() || ctx.inRecovery() {
+ // HWASan ramdisk (which is built from recovery) goes over some bootloader limit.
+ // Keep libc instrumented so that ramdisk / vendor_ramdisk / recovery can run hwasan-instrumented code if necessary.
+ if !strings.HasPrefix(ctx.ModuleDir(), "bionic/libc") {
+ s.Hwaddress = nil
+ }
+ // Memtag stack in ramdisk makes pKVM unhappy.
+ s.Memtag_stack = nil
}
if ctx.staticBinary() {
@@ -858,7 +863,7 @@
flags.Local.CFlags = append(flags.Local.CFlags, cfiCflags...)
flags.Local.AsFlags = append(flags.Local.AsFlags, cfiAsflags...)
- flags.CFlagsDeps = append(flags.CFlagsDeps, android.PathForSource(ctx, cfiBlocklistPath + "/" + cfiBlocklistFilename))
+ flags.CFlagsDeps = append(flags.CFlagsDeps, android.PathForSource(ctx, cfiBlocklistPath+"/"+cfiBlocklistFilename))
if Bool(s.Properties.Sanitize.Config.Cfi_assembly_support) {
flags.Local.CFlags = append(flags.Local.CFlags, cfiAssemblySupportFlag)
}
@@ -879,6 +884,13 @@
flags.Local.CFlags = append(flags.Local.CFlags, memtagStackCommonFlags...)
flags.Local.AsFlags = append(flags.Local.AsFlags, memtagStackCommonFlags...)
flags.Local.LdFlags = append(flags.Local.LdFlags, memtagStackCommonFlags...)
+
+ for _, flag := range memtagStackLlvmFlags {
+ flags.Local.CFlags = append(flags.Local.CFlags, "-mllvm", flag)
+ }
+ for _, flag := range memtagStackLlvmFlags {
+ flags.Local.LdFlags = append(flags.Local.LdFlags, "-Wl,-mllvm,"+flag)
+ }
}
if (Bool(sanProps.Memtag_heap) || Bool(sanProps.Memtag_stack) || Bool(sanProps.Memtag_globals)) && ctx.binary() {
@@ -1303,6 +1315,8 @@
hwasanStaticLibs(mctx.Config()).add(c, c.Module().Name())
} else if s.sanitizer == cfi {
cfiStaticLibs(mctx.Config()).add(c, c.Module().Name())
+ } else if s.sanitizer == Memtag_stack {
+ memtagStackStaticLibs(mctx.Config()).add(c, c.Module().Name());
}
}
} else if c.IsSanitizerEnabled(s.sanitizer) {
@@ -1552,7 +1566,7 @@
addStaticDeps(config.BuiltinsRuntimeLibrary(toolchain), true)
}
- if runtimeSharedLibrary != "" && (toolchain.Bionic() || toolchain.Musl() || c.sanitize.Properties.UbsanRuntimeDep) {
+ if runtimeSharedLibrary != "" && (toolchain.Bionic() || toolchain.Musl()) {
// UBSan is supported on non-bionic linux host builds as well
// Adding dependency to the runtime library. We are using *FarVariation*
@@ -1715,6 +1729,14 @@
}).(*sanitizerStaticLibsMap)
}
+var memtagStackStaticLibsKey = android.NewOnceKey("memtagStackStaticLibs")
+
+func memtagStackStaticLibs(config android.Config) *sanitizerStaticLibsMap {
+ return config.Once(memtagStackStaticLibsKey, func() interface{} {
+ return newSanitizerStaticLibsMap(Memtag_stack)
+ }).(*sanitizerStaticLibsMap)
+}
+
func enableMinimalRuntime(sanitize *sanitize) bool {
if sanitize.isSanitizerEnabled(Asan) {
return false
@@ -1761,3 +1783,7 @@
func hwasanMakeVarsProvider(ctx android.MakeVarsContext) {
hwasanStaticLibs(ctx.Config()).exportToMake(ctx)
}
+
+func memtagStackMakeVarsProvider(ctx android.MakeVarsContext) {
+ memtagStackStaticLibs(ctx.Config()).exportToMake(ctx)
+}
diff --git a/cc/testing.go b/cc/testing.go
index 20c435a..4b4e866 100644
--- a/cc/testing.go
+++ b/cc/testing.go
@@ -554,6 +554,7 @@
ctx.RegisterModuleType("vndk_prebuilt_shared", VndkPrebuiltSharedFactory)
RegisterVndkLibraryTxtTypes(ctx)
+ RegisterLlndkLibraryTxtType(ctx)
}),
// Additional files needed in tests that disallow non-existent source files.
@@ -570,17 +571,17 @@
// Additional files needed in tests that disallow non-existent source.
android.MockFS{
- "defaults/cc/common/libc.map.txt": nil,
- "defaults/cc/common/libdl.map.txt": nil,
- "defaults/cc/common/libft2.map.txt": nil,
- "defaults/cc/common/libm.map.txt": nil,
- "defaults/cc/common/ndk_libc++_shared": nil,
- "defaults/cc/common/crtbegin_so.c": nil,
- "defaults/cc/common/crtbegin.c": nil,
- "defaults/cc/common/crtend_so.c": nil,
- "defaults/cc/common/crtend.c": nil,
- "defaults/cc/common/crtbrand.c": nil,
- "external/compiler-rt/lib/cfi/cfi_blocklist.txt": nil,
+ "defaults/cc/common/libc.map.txt": nil,
+ "defaults/cc/common/libdl.map.txt": nil,
+ "defaults/cc/common/libft2.map.txt": nil,
+ "defaults/cc/common/libm.map.txt": nil,
+ "defaults/cc/common/ndk_libc++_shared": nil,
+ "defaults/cc/common/crtbegin_so.c": nil,
+ "defaults/cc/common/crtbegin.c": nil,
+ "defaults/cc/common/crtend_so.c": nil,
+ "defaults/cc/common/crtend.c": nil,
+ "defaults/cc/common/crtbrand.c": nil,
+ "external/compiler-rt/lib/cfi/cfi_blocklist.txt": nil,
"defaults/cc/common/libclang_rt.ubsan_minimal.android_arm64.a": nil,
"defaults/cc/common/libclang_rt.ubsan_minimal.android_arm.a": nil,
@@ -702,6 +703,7 @@
ctx.RegisterModuleType("vndk_prebuilt_shared", VndkPrebuiltSharedFactory)
RegisterVndkLibraryTxtTypes(ctx)
+ RegisterLlndkLibraryTxtType(ctx)
ctx.PreArchMutators(android.RegisterDefaultsPreArchMutators)
android.RegisterPrebuiltMutators(ctx)
diff --git a/cc/vndk.go b/cc/vndk.go
index 14b44b6..50e6d4b 100644
--- a/cc/vndk.go
+++ b/cc/vndk.go
@@ -219,7 +219,6 @@
type moduleListerFunc func(ctx android.SingletonContext) (moduleNames, fileNames []string)
var (
- llndkLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsLLNDK && !m.Header() })
vndkSPLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsVNDKSP })
vndkCoreLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsVNDKCore })
vndkPrivateLibraries = vndkModuleLister(func(m *Module) bool { return m.VendorProperties.IsVNDKPrivate })
@@ -378,19 +377,12 @@
prebuiltLib, isPrebuiltLib := m.linker.(*prebuiltLibraryLinker)
if m.InVendorOrProduct() && isLib && lib.hasLLNDKStubs() {
- m.VendorProperties.IsLLNDK = true
m.VendorProperties.IsVNDKPrivate = Bool(lib.Properties.Llndk.Private)
}
if m.InVendorOrProduct() && isPrebuiltLib && prebuiltLib.hasLLNDKStubs() {
- m.VendorProperties.IsLLNDK = true
m.VendorProperties.IsVNDKPrivate = Bool(prebuiltLib.Properties.Llndk.Private)
}
- if m.IsVndkPrebuiltLibrary() && !m.IsVndk() {
- m.VendorProperties.IsLLNDK = true
- // TODO(b/280697209): copy "llndk.private" flag to vndk_prebuilt_shared
- }
-
if (isLib && lib.buildShared()) || (isPrebuiltLib && prebuiltLib.buildShared()) {
if m.vndkdep != nil && m.vndkdep.isVndk() && !m.vndkdep.isVndkExt() {
processVndkLibrary(mctx, m)
@@ -404,8 +396,6 @@
}
func RegisterVndkLibraryTxtTypes(ctx android.RegistrationContext) {
- ctx.RegisterParallelSingletonModuleType("llndk_libraries_txt", llndkLibrariesTxtFactory)
- ctx.RegisterParallelSingletonModuleType("llndk_libraries_txt_for_apex", llndkLibrariesTxtApexOnlyFactory)
ctx.RegisterParallelSingletonModuleType("vndksp_libraries_txt", vndkSPLibrariesTxtFactory)
ctx.RegisterParallelSingletonModuleType("vndkcore_libraries_txt", vndkCoreLibrariesTxtFactory)
ctx.RegisterParallelSingletonModuleType("vndkprivate_libraries_txt", vndkPrivateLibrariesTxtFactory)
@@ -435,25 +425,6 @@
var _ etc.PrebuiltEtcModule = &vndkLibrariesTxt{}
var _ android.OutputFileProducer = &vndkLibrariesTxt{}
-// llndk_libraries_txt is a singleton module whose content is a list of LLNDK libraries
-// generated by Soong.
-// Make uses LLNDK_LIBRARIES to determine which libraries to install.
-// HWASAN is only part of the LLNDK in builds in which libc depends on HWASAN.
-// Therefore, by removing the library here, we cause it to only be installed if libc
-// depends on it.
-func llndkLibrariesTxtFactory() android.SingletonModule {
- return newVndkLibrariesWithMakeVarFilter(llndkLibraries, "LLNDK_LIBRARIES", "libclang_rt.hwasan")
-}
-
-// llndk_libraries_txt_for_apex is a singleton module that provide the same LLNDK libraries list
-// with the llndk_libraries_txt, but skips setting make variable LLNDK_LIBRARIES. So, it must not
-// be used without installing llndk_libraries_txt singleton.
-// We include llndk_libraries_txt by default to install the llndk.libraries.txt file to system/etc.
-// This singleton module is to install the llndk.libraries.<ver>.txt file to vndk apex.
-func llndkLibrariesTxtApexOnlyFactory() android.SingletonModule {
- return newVndkLibrariesWithMakeVarFilter(llndkLibraries, "", "libclang_rt.hwasan")
-}
-
// vndksp_libraries_txt is a singleton module whose content is a list of VNDKSP libraries
// generated by Soong but can be referenced by other modules.
// For example, apex_vndk can depend on these files as prebuilt.
diff --git a/cmd/release_config/build_flag/main.go b/cmd/release_config/build_flag/main.go
index 6f909af..56c49d8 100644
--- a/cmd/release_config/build_flag/main.go
+++ b/cmd/release_config/build_flag/main.go
@@ -1,10 +1,12 @@
package main
import (
+ "cmp"
"flag"
"fmt"
"os"
"path/filepath"
+ "slices"
"strings"
rc_lib "android/soong/cmd/release_config/release_config_lib"
@@ -36,6 +38,16 @@
// Disable warning messages
quiet bool
+
+ // Show all release configs
+ allReleases bool
+
+ // Call get_build_var PRODUCT_RELEASE_CONFIG_MAPS to get the
+ // product-specific map directories.
+ useGetBuildVar bool
+
+ // Panic on errors.
+ debug bool
}
type CommandFunc func(*rc_lib.ReleaseConfigs, Flags, string, []string) error
@@ -60,6 +72,14 @@
return "", fmt.Errorf("Could not determine directory from %s", path)
}
+func MarshalFlagDefaultValue(config *rc_lib.ReleaseConfig, name string) (ret string, err error) {
+ fa, ok := config.FlagArtifacts[name]
+ if !ok {
+ return "", fmt.Errorf("%s not found in %s", name, config.Name)
+ }
+ return rc_lib.MarshalValue(fa.Traces[0].Value), nil
+}
+
func MarshalFlagValue(config *rc_lib.ReleaseConfig, name string) (ret string, err error) {
fa, ok := config.FlagArtifacts[name]
if !ok {
@@ -68,19 +88,41 @@
return rc_lib.MarshalValue(fa.Value), nil
}
+// Returns a list of ReleaseConfig objects for which to process flags.
func GetReleaseArgs(configs *rc_lib.ReleaseConfigs, commonFlags Flags) ([]*rc_lib.ReleaseConfig, error) {
var all bool
- relFlags := flag.NewFlagSet("set", flag.ExitOnError)
- relFlags.BoolVar(&all, "all", false, "Display all flags")
+ relFlags := flag.NewFlagSet("releaseFlags", flag.ExitOnError)
+ relFlags.BoolVar(&all, "all", false, "Display all releases")
relFlags.Parse(commonFlags.targetReleases)
var ret []*rc_lib.ReleaseConfig
- if all {
+ if all || commonFlags.allReleases {
+ sortMap := map[string]int{
+ "trunk_staging": 0,
+ "trunk_food": 10,
+ "trunk": 20,
+ // Anything not listed above, uses this for key 1 in the sort.
+ "-default": 100,
+ }
+
for _, config := range configs.ReleaseConfigs {
ret = append(ret, config)
}
+ slices.SortFunc(ret, func(a, b *rc_lib.ReleaseConfig) int {
+ mapValue := func(v *rc_lib.ReleaseConfig) int {
+ if v, ok := sortMap[v.Name]; ok {
+ return v
+ }
+ return sortMap["-default"]
+ }
+ if n := cmp.Compare(mapValue(a), mapValue(b)); n != 0 {
+ return n
+ }
+ return cmp.Compare(a.Name, b.Name)
+ })
return ret, nil
}
for _, arg := range relFlags.Args() {
+ // Return releases in the order that they were given.
config, err := configs.GetReleaseConfig(arg)
if err != nil {
return nil, err
@@ -92,12 +134,17 @@
func GetCommand(configs *rc_lib.ReleaseConfigs, commonFlags Flags, cmd string, args []string) error {
isTrace := cmd == "trace"
+ isSet := cmd == "set"
+
var all bool
- getFlags := flag.NewFlagSet("set", flag.ExitOnError)
+ getFlags := flag.NewFlagSet("get", flag.ExitOnError)
getFlags.BoolVar(&all, "all", false, "Display all flags")
getFlags.Parse(args)
args = getFlags.Args()
+ if isSet {
+ commonFlags.allReleases = true
+ }
releaseConfigList, err := GetReleaseArgs(configs, commonFlags)
if err != nil {
return err
@@ -113,21 +160,72 @@
}
}
- showName := len(releaseConfigList) > 1 || len(args) > 1
- for _, config := range releaseConfigList {
- var configName string
- if len(releaseConfigList) > 1 {
- configName = fmt.Sprintf("%s.", config.Name)
- }
+ var maxVariableNameLen, maxReleaseNameLen int
+ var releaseNameFormat, variableNameFormat string
+ valueFormat := "%s"
+ showReleaseName := len(releaseConfigList) > 1
+ showVariableName := len(args) > 1
+ if showVariableName {
for _, arg := range args {
- val, err := MarshalFlagValue(config, arg)
- if err != nil {
- return err
+ maxVariableNameLen = max(len(arg), maxVariableNameLen)
+ }
+ variableNameFormat = fmt.Sprintf("%%-%ds ", maxVariableNameLen)
+ valueFormat = "'%s'"
+ }
+ if showReleaseName {
+ for _, config := range releaseConfigList {
+ maxReleaseNameLen = max(len(config.Name), maxReleaseNameLen)
+ }
+ releaseNameFormat = fmt.Sprintf("%%-%ds ", maxReleaseNameLen)
+ valueFormat = "'%s'"
+ }
+
+ outputOneLine := func(variable, release, value, valueFormat string) {
+ var outStr string
+ if showVariableName {
+ outStr += fmt.Sprintf(variableNameFormat, variable)
+ }
+ if showReleaseName {
+ outStr += fmt.Sprintf(releaseNameFormat, release)
+ }
+ outStr += fmt.Sprintf(valueFormat, value)
+ fmt.Println(outStr)
+ }
+
+ for _, arg := range args {
+ if _, ok := configs.FlagArtifacts[arg]; !ok {
+ return fmt.Errorf("%s is not a defined build flag", arg)
+ }
+ }
+
+ for _, arg := range args {
+ for _, config := range releaseConfigList {
+ if isSet {
+ // If this is from the set command, format the output as:
+ // <default> ""
+ // trunk_staging ""
+ // trunk ""
+ //
+ // ap1a ""
+ // ...
+ switch {
+ case config.Name == "trunk_staging":
+ defaultValue, err := MarshalFlagDefaultValue(config, arg)
+ if err != nil {
+ return err
+ }
+ outputOneLine(arg, "<default>", defaultValue, valueFormat)
+ case config.AconfigFlagsOnly:
+ continue
+ case config.Name == "trunk":
+ fmt.Println()
+ }
}
- if showName {
- fmt.Printf("%s%s=%s\n", configName, arg, val)
+ val, err := MarshalFlagValue(config, arg)
+ if err == nil {
+ outputOneLine(arg, config.Name, val, valueFormat)
} else {
- fmt.Printf("%s\n", val)
+ outputOneLine(arg, config.Name, "REDACTED", "%s")
}
if isTrace {
for _, trace := range config.FlagArtifacts[arg].Traces {
@@ -160,6 +258,9 @@
if err != nil {
return err
}
+ if release.AconfigFlagsOnly {
+ return fmt.Errorf("%s does not allow build flag overrides", targetRelease)
+ }
flagArtifact, ok := release.FlagArtifacts[name]
if !ok {
return fmt.Errorf("Unknown build flag %s", name)
@@ -177,53 +278,79 @@
Value: rc_lib.UnmarshalValue(value),
}
flagPath := filepath.Join(valueDir, "flag_values", targetRelease, fmt.Sprintf("%s.textproto", name))
- return rc_lib.WriteMessage(flagPath, flagValue)
+ err = rc_lib.WriteMessage(flagPath, flagValue)
+ if err != nil {
+ return err
+ }
+
+ // Reload the release configs.
+ configs, err = rc_lib.ReadReleaseConfigMaps(commonFlags.maps, commonFlags.targetReleases[0], commonFlags.useGetBuildVar)
+ if err != nil {
+ return err
+ }
+ err = GetCommand(configs, commonFlags, cmd, args[0:1])
+ if err != nil {
+ return err
+ }
+ fmt.Printf("Updated: %s\n", flagPath)
+ return nil
}
func main() {
- var err error
var commonFlags Flags
var configs *rc_lib.ReleaseConfigs
+ topDir, err := rc_lib.GetTopDir()
- outEnv := os.Getenv("OUT_DIR")
- if outEnv == "" {
- outEnv = "out"
- }
// Handle the common arguments
- flag.StringVar(&commonFlags.top, "top", ".", "path to top of workspace")
+ flag.StringVar(&commonFlags.top, "top", topDir, "path to top of workspace")
flag.BoolVar(&commonFlags.quiet, "quiet", false, "disable warning messages")
flag.Var(&commonFlags.maps, "map", "path to a release_config_map.textproto. may be repeated")
- flag.StringVar(&commonFlags.outDir, "out_dir", rc_lib.GetDefaultOutDir(), "basepath for the output. Multiple formats are created")
+ flag.StringVar(&commonFlags.outDir, "out-dir", rc_lib.GetDefaultOutDir(), "basepath for the output. Multiple formats are created")
flag.Var(&commonFlags.targetReleases, "release", "TARGET_RELEASE for this build")
+ flag.BoolVar(&commonFlags.allReleases, "all-releases", false, "operate on all releases. (Ignored for set command)")
+ flag.BoolVar(&commonFlags.useGetBuildVar, "use-get-build-var", true, "use get_build_var PRODUCT_RELEASE_CONFIG_MAPS to get needed maps")
+ flag.BoolVar(&commonFlags.debug, "debug", false, "turn on debugging output for errors")
flag.Parse()
+ errorExit := func(err error) {
+ if commonFlags.debug {
+ panic(err)
+ }
+ fmt.Fprintf(os.Stderr, "%s\n", err)
+ os.Exit(1)
+ }
+
if commonFlags.quiet {
rc_lib.DisableWarnings()
}
if len(commonFlags.targetReleases) == 0 {
- commonFlags.targetReleases = rc_lib.StringList{"trunk_staging"}
+ release, ok := os.LookupEnv("TARGET_RELEASE")
+ if ok {
+ commonFlags.targetReleases = rc_lib.StringList{release}
+ } else {
+ commonFlags.targetReleases = rc_lib.StringList{"trunk_staging"}
+ }
}
if err = os.Chdir(commonFlags.top); err != nil {
- panic(err)
+ errorExit(err)
}
// Get the current state of flagging.
relName := commonFlags.targetReleases[0]
if relName == "--all" || relName == "-all" {
- // If the users said `--release --all`, grab trunk staging for simplicity.
- relName = "trunk_staging"
+ commonFlags.allReleases = true
}
- configs, err = rc_lib.ReadReleaseConfigMaps(commonFlags.maps, relName)
+ configs, err = rc_lib.ReadReleaseConfigMaps(commonFlags.maps, relName, commonFlags.useGetBuildVar)
if err != nil {
- panic(err)
+ errorExit(err)
}
if cmd, ok := commandMap[flag.Arg(0)]; ok {
args := flag.Args()
if err = cmd(configs, commonFlags, args[0], args[1:]); err != nil {
- panic(err)
+ errorExit(err)
}
}
}
diff --git a/cmd/release_config/crunch_flags/main.go b/cmd/release_config/crunch_flags/main.go
index 69abba2..4d763c8 100644
--- a/cmd/release_config/crunch_flags/main.go
+++ b/cmd/release_config/crunch_flags/main.go
@@ -15,18 +15,30 @@
"google.golang.org/protobuf/proto"
)
-// 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.
-var manualFlagNamePrefixes []string = []string{
- "RELEASE_ACONFIG_",
- "RELEASE_PLATFORM_",
-}
+var (
+ // 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_",
+ "RELEASE_BUILD_FLAGS_",
+ }
-var defaultFlagNamespace string = "android_UNKNOWN"
+ // Set `aconfig_flags_only: true` in these release configs.
+ aconfigFlagsOnlyConfigs map[string]bool = map[string]bool{
+ "trunk_food": true,
+ }
+
+ // Default namespace value. This is intentionally invalid.
+ defaultFlagNamespace string = "android_UNKNOWN"
+
+ // What is the current name for "next".
+ nextName string = "ap3a"
+)
func RenameNext(name string) string {
if name == "next" {
- return "ap3a"
+ return nextName
}
return name
}
@@ -102,10 +114,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 +130,7 @@
Name: proto.String(declName),
Namespace: proto.String(namespace),
Description: proto.String(description),
- Container: &container,
+ Containers: containers,
}
description = ""
// Most build flags are `workflow: PREBUILT`.
@@ -163,7 +178,7 @@
}
func ProcessBuildConfigs(dir, name string, paths []string, releaseProto *rc_proto.ReleaseConfig) error {
- valRegexp, err := regexp.Compile("[[:space:]]+value.\"(?<name>[A-Z_0-9]+)\",[[:space:]]*(?<value>[^,)]*)")
+ valRegexp, err := regexp.Compile("[[:space:]]+value.\"(?<name>[A-Z_0-9]+)\",[[:space:]]*(?<value>(\"[^\"]*\"|[^\",)]*))")
if err != nil {
return err
}
@@ -202,6 +217,9 @@
fmt.Printf("%s: Unexpected value %s=%s\n", path, valName, valValue)
}
if flagValue != nil {
+ if releaseProto.GetAconfigFlagsOnly() {
+ return fmt.Errorf("%s does not allow build flag overrides", RenameNext(name))
+ }
valPath := filepath.Join(dir, "flag_values", RenameNext(name), fmt.Sprintf("%s.textproto", valName))
err := WriteFile(valPath, flagValue)
if err != nil {
@@ -213,6 +231,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 +259,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)
@@ -276,6 +300,9 @@
releaseConfig := &rc_proto.ReleaseConfig{
Name: proto.String(RenameNext(name)),
}
+ if aconfigFlagsOnlyConfigs[name] {
+ releaseConfig.AconfigFlagsOnly = proto.Bool(true)
+ }
configFiles := config[configRegexp.SubexpIndex("files")]
files := strings.Split(strings.ReplaceAll(configFiles, "$(local_dir)", dir+"/"), " ")
configInherits := config[configRegexp.SubexpIndex("inherits")]
@@ -302,15 +329,26 @@
var dirs rc_lib.StringList
var namespacesFile string
var descriptionsFile string
+ var debug bool
+ defaultTopDir, err := rc_lib.GetTopDir()
- flag.StringVar(&top, "top", ".", "path to top of workspace")
+ flag.StringVar(&top, "top", defaultTopDir, "path to top of workspace")
flag.Var(&dirs, "dir", "directory to process, relative to the top of the workspace")
flag.StringVar(&namespacesFile, "namespaces", "", "location of file with 'flag_name namespace' information")
flag.StringVar(&descriptionsFile, "descriptions", "", "location of file with 'directory description' information")
+ flag.BoolVar(&debug, "debug", false, "turn on debugging output for errors")
flag.Parse()
+ errorExit := func(err error) {
+ if debug {
+ panic(err)
+ }
+ fmt.Fprintf(os.Stderr, "%s\n", err)
+ os.Exit(1)
+ }
+
if err = os.Chdir(top); err != nil {
- panic(err)
+ errorExit(err)
}
if len(dirs) == 0 {
dirs = rc_lib.StringList{"build/release", "vendor/google_shared/build/release", "vendor/google/release"}
@@ -320,12 +358,12 @@
if namespacesFile != "" {
data, err := os.ReadFile(namespacesFile)
if err != nil {
- panic(err)
+ errorExit(err)
}
for idx, line := range strings.Split(string(data), "\n") {
fields := strings.Split(line, " ")
if len(fields) > 2 {
- panic(fmt.Errorf("line %d: too many fields: %s", idx, line))
+ errorExit(fmt.Errorf("line %d: too many fields: %s", idx, line))
}
namespaceMap[fields[0]] = fields[1]
}
@@ -337,7 +375,7 @@
if descriptionsFile != "" {
data, err := os.ReadFile(descriptionsFile)
if err != nil {
- panic(err)
+ errorExit(err)
}
for _, line := range strings.Split(string(data), "\n") {
if strings.TrimSpace(line) != "" {
@@ -351,12 +389,12 @@
for _, dir := range dirs {
err = ProcessBuildFlags(dir, namespaceMap)
if err != nil {
- panic(err)
+ errorExit(err)
}
err = ProcessReleaseConfigMap(dir, descriptionMap)
if err != nil {
- panic(err)
+ errorExit(err)
}
}
}
diff --git a/cmd/release_config/release_config/main.go b/cmd/release_config/release_config/main.go
index a43fdcc..101dbe3 100644
--- a/cmd/release_config/release_config/main.go
+++ b/cmd/release_config/release_config/main.go
@@ -33,6 +33,9 @@
var configs *rc_lib.ReleaseConfigs
var json, pb, textproto bool
var product string
+ var allMake bool
+ var useBuildVar bool
+ var guard bool
defaultRelease := os.Getenv("TARGET_RELEASE")
if defaultRelease == "" {
@@ -48,6 +51,10 @@
flag.BoolVar(&textproto, "textproto", true, "write artifacts as text protobuf")
flag.BoolVar(&json, "json", true, "write artifacts as json")
flag.BoolVar(&pb, "pb", true, "write artifacts as binary protobuf")
+ flag.BoolVar(&allMake, "all_make", true, "write makefiles for all release configs")
+ flag.BoolVar(&useBuildVar, "use_get_build_var", false, "use get_build_var PRODUCT_RELEASE_CONFIG_MAPS")
+ flag.BoolVar(&guard, "guard", true, "whether to guard with RELEASE_BUILD_FLAGS_IN_PROTOBUF")
+
flag.Parse()
if quiet {
@@ -57,7 +64,7 @@
if err = os.Chdir(top); err != nil {
panic(err)
}
- configs, err = rc_lib.ReadReleaseConfigMaps(releaseConfigMapPaths, targetRelease)
+ configs, err = rc_lib.ReadReleaseConfigMaps(releaseConfigMapPaths, targetRelease, useBuildVar)
if err != nil {
panic(err)
}
@@ -65,15 +72,31 @@
if err != nil {
panic(err)
}
- releaseName := config.Name
err = os.MkdirAll(outputDir, 0775)
if err != nil {
panic(err)
}
- makefilePath := filepath.Join(outputDir, fmt.Sprintf("release_config-%s-%s.mk", product, releaseName))
- err = configs.WriteMakefile(makefilePath, targetRelease)
- if err != nil {
- panic(err)
+
+ makefilePath := filepath.Join(outputDir, fmt.Sprintf("release_config-%s-%s.mk", product, targetRelease))
+ useProto, ok := config.FlagArtifacts["RELEASE_BUILD_FLAGS_IN_PROTOBUF"]
+ if guard && (!ok || rc_lib.MarshalValue(useProto.Value) == "") {
+ // We were told to guard operation and either we have no build flag, or it is False.
+ // Write an empty file so that release_config.mk will use the old process.
+ os.WriteFile(makefilePath, []byte{}, 0644)
+ } else if allMake {
+ // Write one makefile per release config, using the canonical release name.
+ for k, _ := range configs.ReleaseConfigs {
+ makefilePath = filepath.Join(outputDir, fmt.Sprintf("release_config-%s-%s.mk", product, k))
+ err = configs.WriteMakefile(makefilePath, k)
+ if err != nil {
+ panic(err)
+ }
+ }
+ } else {
+ err = configs.WriteMakefile(makefilePath, targetRelease)
+ if err != nil {
+ panic(err)
+ }
}
if json {
err = configs.WriteArtifact(outputDir, product, "json")
@@ -93,4 +116,8 @@
panic(err)
}
}
+ if err = config.WritePartitionBuildFlags(outputDir, product, targetRelease); err != nil {
+ panic(err)
+ }
+
}
diff --git a/cmd/release_config/release_config_lib/flag_artifact.go b/cmd/release_config/release_config_lib/flag_artifact.go
index d6a629b..cba1b5c 100644
--- a/cmd/release_config/release_config_lib/flag_artifact.go
+++ b/cmd/release_config/release_config_lib/flag_artifact.go
@@ -129,3 +129,14 @@
Traces: fa.Traces,
}, nil
}
+
+// Marshal the FlagArtifact without Traces.
+func (fa *FlagArtifact) MarshalWithoutTraces() (*rc_proto.FlagArtifact, error) {
+ if fa.Redacted {
+ return nil, nil
+ }
+ return &rc_proto.FlagArtifact{
+ FlagDeclaration: fa.FlagDeclaration,
+ Value: fa.Value,
+ }, nil
+}
diff --git a/cmd/release_config/release_config_lib/flag_value.go b/cmd/release_config/release_config_lib/flag_value.go
index e155e77..59021e2 100644
--- a/cmd/release_config/release_config_lib/flag_value.go
+++ b/cmd/release_config/release_config_lib/flag_value.go
@@ -52,6 +52,9 @@
}
func MarshalValue(value *rc_proto.Value) string {
+ if value == nil {
+ return ""
+ }
switch val := value.Val.(type) {
case *rc_proto.Value_UnspecifiedValue:
// Value was never set.
diff --git a/cmd/release_config/release_config_lib/flag_value_test.go b/cmd/release_config/release_config_lib/flag_value_test.go
index aaa4caf..8a98baf 100644
--- a/cmd/release_config/release_config_lib/flag_value_test.go
+++ b/cmd/release_config/release_config_lib/flag_value_test.go
@@ -24,7 +24,7 @@
"google.golang.org/protobuf/proto"
)
-type testCaseFlagValue struct {
+type testCaseFlagValueFactory struct {
protoPath string
name string
data []byte
@@ -32,14 +32,14 @@
err error
}
-func (tc testCaseFlagValue) assertProtoEqual(t *testing.T, expected, actual proto.Message) {
+func (tc testCaseFlagValueFactory) assertProtoEqual(t *testing.T, expected, actual proto.Message) {
if !proto.Equal(expected, actual) {
t.Errorf("Expected %q found %q", expected, actual)
}
}
-func TestFlagValue(t *testing.T) {
- testCases := []testCaseFlagValue{
+func TestFlagValueFactory(t *testing.T) {
+ testCases := []testCaseFlagValueFactory{
{
name: "stringVal",
protoPath: "build/release/flag_values/test/RELEASE_FOO.textproto",
@@ -65,3 +65,50 @@
tc.assertProtoEqual(t, &tc.expected, &actual.proto)
}
}
+
+type testCaseMarshalValue struct {
+ name string
+ value *rc_proto.Value
+ expected string
+}
+
+func TestMarshalValue(t *testing.T) {
+ testCases := []testCaseMarshalValue{
+ {
+ name: "nil",
+ value: nil,
+ expected: "",
+ },
+ {
+ name: "unspecified",
+ value: &rc_proto.Value{},
+ expected: "",
+ },
+ {
+ name: "false",
+ value: &rc_proto.Value{Val: &rc_proto.Value_BoolValue{false}},
+ expected: "",
+ },
+ {
+ name: "true",
+ value: &rc_proto.Value{Val: &rc_proto.Value_BoolValue{true}},
+ expected: "true",
+ },
+ {
+ name: "string",
+ value: &rc_proto.Value{Val: &rc_proto.Value_StringValue{"BAR"}},
+ expected: "BAR",
+ },
+ {
+ name: "obsolete",
+ value: &rc_proto.Value{Val: &rc_proto.Value_Obsolete{true}},
+ expected: " #OBSOLETE",
+ },
+ }
+ for _, tc := range testCases {
+ actual := MarshalValue(tc.value)
+ if actual != tc.expected {
+ t.Errorf("Expected %q found %q", tc.expected, actual)
+ }
+ }
+}
diff --git a/cmd/release_config/release_config_lib/release_config.go b/cmd/release_config/release_config_lib/release_config.go
index b08b6a3..f25cc6e 100644
--- a/cmd/release_config/release_config_lib/release_config.go
+++ b/cmd/release_config/release_config_lib/release_config.go
@@ -15,7 +15,11 @@
package release_config_lib
import (
+ "cmp"
"fmt"
+ "path/filepath"
+ "slices"
+ "sort"
"strings"
rc_proto "android/soong/cmd/release_config/release_config_proto"
@@ -58,6 +62,10 @@
// The names of release configs that we inherit
InheritNames []string
+ // True if this release config only allows inheritance and aconfig flag
+ // overrides. Build flag value overrides are an error.
+ AconfigFlagsOnly bool
+
// Unmarshalled flag artifacts
FlagArtifacts FlagArtifacts
@@ -66,12 +74,37 @@
// We have begun compiling this release config.
compileInProgress bool
+
+ // Partitioned artifacts for {partition}/etc/build_flags.json
+ PartitionBuildFlags map[string]*rc_proto.FlagArtifacts
}
func ReleaseConfigFactory(name string, index int) (c *ReleaseConfig) {
return &ReleaseConfig{Name: name, DeclarationIndex: index}
}
+func (config *ReleaseConfig) InheritConfig(iConfig *ReleaseConfig) error {
+ for _, fa := range iConfig.FlagArtifacts {
+ name := *fa.FlagDeclaration.Name
+ myFa, ok := config.FlagArtifacts[name]
+ if !ok {
+ return fmt.Errorf("Could not inherit flag %s from %s", name, iConfig.Name)
+ }
+ if name == "RELEASE_ACONFIG_VALUE_SETS" {
+ if len(fa.Traces) > 0 {
+ myFa.Traces = append(myFa.Traces, fa.Traces...)
+ myFa.Value = &rc_proto.Value{Val: &rc_proto.Value_StringValue{
+ myFa.Value.GetStringValue() + " " + fa.Value.GetStringValue()}}
+ }
+ } else if len(fa.Traces) > 1 {
+ // A value was assigned. Set our value.
+ myFa.Traces = append(myFa.Traces, fa.Traces[1:]...)
+ myFa.Value = fa.Value
+ }
+ }
+ return nil
+}
+
func (config *ReleaseConfig) GenerateReleaseConfig(configs *ReleaseConfigs) error {
if config.ReleaseConfigArtifact != nil {
return nil
@@ -82,6 +115,10 @@
config.compileInProgress = true
isRoot := config.Name == "root"
+ // Start with only the flag declarations.
+ config.FlagArtifacts = configs.FlagArtifacts.Clone()
+ releaseAconfigValueSets := config.FlagArtifacts["RELEASE_ACONFIG_VALUE_SETS"]
+
// Generate any configs we need to inherit. This will detect loops in
// the config.
contributionsToApply := []*ReleaseConfigContribution{}
@@ -103,55 +140,37 @@
return err
}
iConfig.GenerateReleaseConfig(configs)
- contributionsToApply = append(contributionsToApply, iConfig.Contributions...)
+ if err := config.InheritConfig(iConfig); err != nil {
+ return err
+ }
}
contributionsToApply = append(contributionsToApply, config.Contributions...)
- myAconfigValueSets := []string{}
- myAconfigValueSetsMap := map[string]bool{}
- myFlags := configs.FlagArtifacts.Clone()
workflowManual := rc_proto.Workflow(rc_proto.Workflow_MANUAL)
- container := rc_proto.Container(rc_proto.Container_ALL)
- releaseAconfigValueSets := FlagArtifact{
- FlagDeclaration: &rc_proto.FlagDeclaration{
- Name: proto.String("RELEASE_ACONFIG_VALUE_SETS"),
- Namespace: proto.String("android_UNKNOWN"),
- Description: proto.String("Aconfig value sets assembled by release-config"),
- Workflow: &workflowManual,
- Container: &container,
- Value: &rc_proto.Value{Val: &rc_proto.Value_StringValue{""}},
- },
- DeclarationIndex: -1,
- Traces: []*rc_proto.Tracepoint{
- &rc_proto.Tracepoint{
- Source: proto.String("$release-config"),
- Value: &rc_proto.Value{Val: &rc_proto.Value_StringValue{""}},
- },
- },
- }
- myFlags["RELEASE_ACONFIG_VALUE_SETS"] = &releaseAconfigValueSets
myDirsMap := make(map[int]bool)
for _, contrib := range contributionsToApply {
- if len(contrib.proto.AconfigValueSets) > 0 {
- contribAconfigValueSets := []string{}
- for _, v := range contrib.proto.AconfigValueSets {
- if _, ok := myAconfigValueSetsMap[v]; !ok {
- contribAconfigValueSets = append(contribAconfigValueSets, v)
- myAconfigValueSetsMap[v] = true
- }
- }
- myAconfigValueSets = append(myAconfigValueSets, contribAconfigValueSets...)
- releaseAconfigValueSets.Traces = append(
- releaseAconfigValueSets.Traces,
- &rc_proto.Tracepoint{
- Source: proto.String(contrib.path),
- Value: &rc_proto.Value{Val: &rc_proto.Value_StringValue{strings.Join(contribAconfigValueSets, " ")}},
- })
+ contribAconfigValueSets := []string{}
+ // Gather the aconfig_value_sets from this contribution, allowing duplicates for simplicity.
+ for _, v := range contrib.proto.AconfigValueSets {
+ contribAconfigValueSets = append(contribAconfigValueSets, v)
}
+ contribAconfigValueSetsString := strings.Join(contribAconfigValueSets, " ")
+ releaseAconfigValueSets.Value = &rc_proto.Value{Val: &rc_proto.Value_StringValue{
+ releaseAconfigValueSets.Value.GetStringValue() + " " + contribAconfigValueSetsString}}
+ releaseAconfigValueSets.Traces = append(
+ releaseAconfigValueSets.Traces,
+ &rc_proto.Tracepoint{
+ Source: proto.String(contrib.path),
+ Value: &rc_proto.Value{Val: &rc_proto.Value_StringValue{contribAconfigValueSetsString}},
+ })
+
myDirsMap[contrib.DeclarationIndex] = true
+ if config.AconfigFlagsOnly && len(contrib.FlagValues) > 0 {
+ return fmt.Errorf("%s does not allow build flag overrides", config.Name)
+ }
for _, value := range contrib.FlagValues {
name := *value.proto.Name
- fa, ok := myFlags[name]
+ fa, ok := config.FlagArtifacts[name]
if !ok {
return fmt.Errorf("Setting value for undefined flag %s in %s\n", name, value.path)
}
@@ -168,11 +187,21 @@
return err
}
if fa.Redacted {
- delete(myFlags, name)
+ delete(config.FlagArtifacts, name)
}
}
}
- releaseAconfigValueSets.Value = &rc_proto.Value{Val: &rc_proto.Value_StringValue{strings.Join(myAconfigValueSets, " ")}}
+ // Now remove any duplicates from the actual value of RELEASE_ACONFIG_VALUE_SETS
+ myAconfigValueSets := []string{}
+ myAconfigValueSetsMap := map[string]bool{}
+ for _, v := range strings.Split(releaseAconfigValueSets.Value.GetStringValue(), " ") {
+ if myAconfigValueSetsMap[v] {
+ continue
+ }
+ myAconfigValueSetsMap[v] = true
+ myAconfigValueSets = append(myAconfigValueSets, v)
+ }
+ releaseAconfigValueSets.Value = &rc_proto.Value{Val: &rc_proto.Value_StringValue{strings.TrimSpace(strings.Join(myAconfigValueSets, " "))}}
directories := []string{}
for idx, confDir := range configs.configDirs {
@@ -181,13 +210,32 @@
}
}
- config.FlagArtifacts = myFlags
+ // Now build the per-partition artifacts
+ config.PartitionBuildFlags = make(map[string]*rc_proto.FlagArtifacts)
+ for _, v := range config.FlagArtifacts {
+ artifact, err := v.MarshalWithoutTraces()
+ if err != nil {
+ return err
+ }
+ for _, container := range v.FlagDeclaration.Containers {
+ if _, ok := config.PartitionBuildFlags[container]; !ok {
+ config.PartitionBuildFlags[container] = &rc_proto.FlagArtifacts{}
+ }
+ config.PartitionBuildFlags[container].FlagArtifacts = append(config.PartitionBuildFlags[container].FlagArtifacts, artifact)
+ }
+ }
config.ReleaseConfigArtifact = &rc_proto.ReleaseConfigArtifact{
Name: proto.String(config.Name),
OtherNames: config.OtherNames,
FlagArtifacts: func() []*rc_proto.FlagArtifact {
ret := []*rc_proto.FlagArtifact{}
- for _, flag := range myFlags {
+ flagNames := []string{}
+ for k := range config.FlagArtifacts {
+ flagNames = append(flagNames, k)
+ }
+ sort.Strings(flagNames)
+ for _, flagName := range flagNames {
+ flag := config.FlagArtifacts[flagName]
ret = append(ret, &rc_proto.FlagArtifact{
FlagDeclaration: flag.FlagDeclaration,
Traces: flag.Traces,
@@ -204,3 +252,16 @@
config.compileInProgress = false
return nil
}
+
+func (config *ReleaseConfig) WritePartitionBuildFlags(outDir, product, targetRelease string) error {
+ var err error
+ for partition, flags := range config.PartitionBuildFlags {
+ slices.SortFunc(flags.FlagArtifacts, func(a, b *rc_proto.FlagArtifact) int {
+ return cmp.Compare(*a.FlagDeclaration.Name, *b.FlagDeclaration.Name)
+ })
+ if err = WriteMessage(filepath.Join(outDir, fmt.Sprintf("build_flags_%s-%s-%s.json", partition, config.Name, product)), flags); err != nil {
+ return err
+ }
+ }
+ return nil
+}
diff --git a/cmd/release_config/release_config_lib/release_configs.go b/cmd/release_config/release_config_lib/release_configs.go
index aba8cd2..3429400 100644
--- a/cmd/release_config/release_config_lib/release_configs.go
+++ b/cmd/release_config/release_config_lib/release_configs.go
@@ -95,7 +95,7 @@
}
func ReleaseConfigsFactory() (c *ReleaseConfigs) {
- return &ReleaseConfigs{
+ configs := ReleaseConfigs{
Aliases: make(map[string]*string),
FlagArtifacts: make(map[string]*FlagArtifact),
ReleaseConfigs: make(map[string]*ReleaseConfig),
@@ -103,6 +103,21 @@
configDirs: []string{},
configDirIndexes: make(ReleaseConfigDirMap),
}
+ workflowManual := rc_proto.Workflow(rc_proto.Workflow_MANUAL)
+ releaseAconfigValueSets := FlagArtifact{
+ FlagDeclaration: &rc_proto.FlagDeclaration{
+ Name: proto.String("RELEASE_ACONFIG_VALUE_SETS"),
+ Namespace: proto.String("android_UNKNOWN"),
+ Description: proto.String("Aconfig value sets assembled by release-config"),
+ Workflow: &workflowManual,
+ Containers: []string{"system", "system_ext", "product", "vendor"},
+ Value: &rc_proto.Value{Val: &rc_proto.Value_UnspecifiedValue{false}},
+ },
+ DeclarationIndex: -1,
+ Traces: []*rc_proto.Tracepoint{},
+ }
+ configs.FlagArtifacts["RELEASE_ACONFIG_VALUE_SETS"] = &releaseAconfigValueSets
+ return &configs
}
func ReleaseConfigMapFactory(protoPath string) (m *ReleaseConfigMap) {
@@ -117,9 +132,17 @@
}
func (configs *ReleaseConfigs) LoadReleaseConfigMap(path string, ConfigDirIndex int) error {
+ if _, err := os.Stat(path); err != nil {
+ return fmt.Errorf("%s does not exist\n", path)
+ }
m := ReleaseConfigMapFactory(path)
- if m.proto.DefaultContainer == nil {
- return fmt.Errorf("Release config map %s lacks default_container", path)
+ if m.proto.DefaultContainers == nil {
+ return fmt.Errorf("Release config map %s lacks default_containers", path)
+ }
+ for _, container := range m.proto.DefaultContainers {
+ if !validContainer(container) {
+ return fmt.Errorf("Release config map %s has invalid container %s", path, container)
+ }
}
dir := filepath.Dir(path)
// Record any aliases, checking for duplicates.
@@ -138,9 +161,16 @@
err = WalkTextprotoFiles(dir, "flag_declarations", func(path string, d fs.DirEntry, err error) error {
flagDeclaration := FlagDeclarationFactory(path)
// Container must be specified.
- if flagDeclaration.Container == nil {
- flagDeclaration.Container = m.proto.DefaultContainer
+ if flagDeclaration.Containers == nil {
+ flagDeclaration.Containers = m.proto.DefaultContainers
+ } else {
+ for _, container := range flagDeclaration.Containers {
+ if !validContainer(container) {
+ return fmt.Errorf("Flag declaration %s has invalid container %s", path, container)
+ }
+ }
}
+
// TODO: once we have namespaces initialized, we can throw an error here.
if flagDeclaration.Namespace == nil {
flagDeclaration.Namespace = proto.String("android_UNKNOWN")
@@ -151,6 +181,9 @@
}
m.FlagDeclarations = append(m.FlagDeclarations, *flagDeclaration)
name := *flagDeclaration.Name
+ if name == "RELEASE_ACONFIG_VALUE_SETS" {
+ return fmt.Errorf("%s: %s is a reserved build flag", path, name)
+ }
if def, ok := configs.FlagArtifacts[name]; !ok {
configs.FlagArtifacts[name] = &FlagArtifact{FlagDeclaration: flagDeclaration, DeclarationIndex: ConfigDirIndex}
} else if !proto.Equal(def.FlagDeclaration, flagDeclaration) {
@@ -161,7 +194,7 @@
FlagValue{path: path, proto: rc_proto.FlagValue{
Name: proto.String(name), Value: flagDeclaration.Value}})
if configs.FlagArtifacts[name].Redacted {
- return fmt.Errorf("%s may not be redacted by default.", *flagDeclaration.Name)
+ return fmt.Errorf("%s may not be redacted by default.", name)
}
return nil
})
@@ -188,12 +221,18 @@
if fmt.Sprintf("%s.textproto", *flagValue.proto.Name) != filepath.Base(path) {
return fmt.Errorf("%s incorrectly sets value for flag %s", path, *flagValue.proto.Name)
}
+ if *flagValue.proto.Name == "RELEASE_ACONFIG_VALUE_SETS" {
+ return fmt.Errorf("%s: %s is a reserved build flag", path, *flagValue.proto.Name)
+ }
releaseConfigContribution.FlagValues = append(releaseConfigContribution.FlagValues, flagValue)
return nil
})
if err2 != nil {
return err2
}
+ if releaseConfigContribution.proto.GetAconfigFlagsOnly() {
+ config.AconfigFlagsOnly = true
+ }
m.ReleaseConfigContributions[name] = releaseConfigContribution
config.Contributions = append(config.Contributions, releaseConfigContribution)
return nil
@@ -253,19 +292,12 @@
flag := myFlagArtifacts[name]
decl := flag.FlagDeclaration
- // cName := strings.ToLower(rc_proto.Container_name[decl.GetContainer()])
- cName := strings.ToLower(decl.Container.String())
- if cName == strings.ToLower(rc_proto.Container_ALL.String()) {
- partitions["product"] = append(partitions["product"], name)
- partitions["system"] = append(partitions["system"], name)
- partitions["system_ext"] = append(partitions["system_ext"], name)
- partitions["vendor"] = append(partitions["vendor"], name)
- } else {
- partitions[cName] = append(partitions[cName], name)
+ for _, container := range decl.Containers {
+ partitions[container] = append(partitions[container], name)
}
value := MarshalValue(flag.Value)
makeVars[name] = value
- addVar(name, "PARTITIONS", cName)
+ addVar(name, "PARTITIONS", strings.Join(decl.Containers, " "))
addVar(name, "DEFAULT", MarshalValue(decl.Value))
addVar(name, "VALUE", value)
addVar(name, "DECLARED_IN", *flag.Traces[0].Source)
@@ -360,23 +392,35 @@
return nil
}
-func ReadReleaseConfigMaps(releaseConfigMapPaths StringList, targetRelease string) (*ReleaseConfigs, error) {
+func ReadReleaseConfigMaps(releaseConfigMapPaths StringList, targetRelease string, useBuildVar bool) (*ReleaseConfigs, error) {
var err error
if len(releaseConfigMapPaths) == 0 {
- releaseConfigMapPaths = GetDefaultMapPaths()
+ releaseConfigMapPaths, err = GetDefaultMapPaths(useBuildVar)
+ if err != nil {
+ return nil, err
+ }
if len(releaseConfigMapPaths) == 0 {
return nil, fmt.Errorf("No maps found")
}
- fmt.Printf("No --map argument provided. Using: --map %s\n", strings.Join(releaseConfigMapPaths, " --map "))
+ if !useBuildVar {
+ warnf("No --map argument provided. Using: --map %s\n", strings.Join(releaseConfigMapPaths, " --map "))
+ }
}
configs := ReleaseConfigsFactory()
+ mapsRead := make(map[string]bool)
for idx, releaseConfigMapPath := range releaseConfigMapPaths {
// Maintain an ordered list of release config directories.
configDir := filepath.Dir(releaseConfigMapPath)
+ if mapsRead[configDir] {
+ continue
+ }
+ mapsRead[configDir] = true
configs.configDirIndexes[configDir] = idx
configs.configDirs = append(configs.configDirs, configDir)
+ // Force the path to be the textproto path, so that both the scl and textproto formats can coexist.
+ releaseConfigMapPath = filepath.Join(configDir, "release_config_map.textproto")
err = configs.LoadReleaseConfigMap(releaseConfigMapPath, idx)
if err != nil {
return nil, err
diff --git a/cmd/release_config/release_config_lib/util.go b/cmd/release_config/release_config_lib/util.go
index 86940da..c0ea789 100644
--- a/cmd/release_config/release_config_lib/util.go
+++ b/cmd/release_config/release_config_lib/util.go
@@ -19,14 +19,19 @@
"fmt"
"io/fs"
"os"
+ "os/exec"
"path/filepath"
+ "regexp"
"strings"
"google.golang.org/protobuf/encoding/prototext"
"google.golang.org/protobuf/proto"
)
-var disableWarnings bool
+var (
+ disableWarnings bool
+ containerRegexp, _ = regexp.Compile("^[a-z][a-z0-9]*([._][a-z][a-z0-9]*)*$")
+)
type StringList []string
@@ -123,11 +128,15 @@
func warnf(format string, args ...any) (n int, err error) {
if !disableWarnings {
- return fmt.Printf(format, args...)
+ return fmt.Fprintf(os.Stderr, format, args...)
}
return 0, nil
}
+func validContainer(container string) bool {
+ return containerRegexp.MatchString(container)
+}
+
// Returns the default value for release config artifacts.
func GetDefaultOutDir() string {
outEnv := os.Getenv("OUT_DIR")
@@ -137,22 +146,64 @@
return filepath.Join(outEnv, "soong", "release-config")
}
+// Find the top of the workspace.
+//
+// This mirrors the logic in build/envsetup.sh's gettop().
+func GetTopDir() (topDir string, err error) {
+ workingDir, err := os.Getwd()
+ if err != nil {
+ return
+ }
+ topFile := "build/make/core/envsetup.mk"
+ for topDir = workingDir; topDir != "/"; topDir = filepath.Dir(topDir) {
+ if _, err = os.Stat(filepath.Join(topDir, topFile)); err == nil {
+ return filepath.Rel(workingDir, topDir)
+ }
+ }
+ return "", fmt.Errorf("Unable to locate top of workspace")
+}
+
// Return the default list of map files to use.
-func GetDefaultMapPaths() StringList {
- var defaultMapPaths StringList
- defaultLocations := StringList{
+func GetDefaultMapPaths(queryMaps bool) (defaultMapPaths StringList, err error) {
+ var defaultLocations StringList
+ workingDir, err := os.Getwd()
+ if err != nil {
+ return
+ }
+ defer func() {
+ os.Chdir(workingDir)
+ }()
+ topDir, err := GetTopDir()
+ os.Chdir(topDir)
+
+ defaultLocations = StringList{
"build/release/release_config_map.textproto",
"vendor/google_shared/build/release/release_config_map.textproto",
"vendor/google/release/release_config_map.textproto",
}
for _, path := range defaultLocations {
- if _, err := os.Stat(path); err == nil {
+ if _, err = os.Stat(path); err == nil {
defaultMapPaths = append(defaultMapPaths, path)
}
}
- prodMaps := os.Getenv("PRODUCT_RELEASE_CONFIG_MAPS")
- if prodMaps != "" {
+
+ var prodMaps string
+ if queryMaps {
+ getBuildVar := exec.Command("build/soong/soong_ui.bash", "--dumpvar-mode", "PRODUCT_RELEASE_CONFIG_MAPS")
+ var stdout strings.Builder
+ getBuildVar.Stdin = strings.NewReader("")
+ getBuildVar.Stdout = &stdout
+ err = getBuildVar.Run()
+ if err != nil {
+ return
+ }
+ prodMaps = stdout.String()
+ } else {
+ prodMaps = os.Getenv("PRODUCT_RELEASE_CONFIG_MAPS")
+ }
+ prodMaps = strings.TrimSpace(prodMaps)
+ if len(prodMaps) > 0 {
defaultMapPaths = append(defaultMapPaths, strings.Split(prodMaps, " ")...)
}
- return defaultMapPaths
+ return
}
diff --git a/cmd/release_config/release_config_proto/build_flags_out.pb.go b/cmd/release_config/release_config_proto/build_flags_out.pb.go
index 77e2069..483cffa 100644
--- a/cmd/release_config/release_config_proto/build_flags_out.pb.go
+++ b/cmd/release_config/release_config_proto/build_flags_out.pb.go
@@ -153,6 +153,54 @@
return nil
}
+type FlagArtifacts struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ // The artifacts
+ FlagArtifacts []*FlagArtifact `protobuf:"bytes,1,rep,name=flag_artifacts,json=flagArtifacts" json:"flag_artifacts,omitempty"`
+}
+
+func (x *FlagArtifacts) Reset() {
+ *x = FlagArtifacts{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_build_flags_out_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *FlagArtifacts) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*FlagArtifacts) ProtoMessage() {}
+
+func (x *FlagArtifacts) ProtoReflect() protoreflect.Message {
+ mi := &file_build_flags_out_proto_msgTypes[2]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use FlagArtifacts.ProtoReflect.Descriptor instead.
+func (*FlagArtifacts) Descriptor() ([]byte, []int) {
+ return file_build_flags_out_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *FlagArtifacts) GetFlagArtifacts() []*FlagArtifact {
+ if x != nil {
+ return x.FlagArtifacts
+ }
+ return nil
+}
+
type ReleaseConfigArtifact struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -179,7 +227,7 @@
func (x *ReleaseConfigArtifact) Reset() {
*x = ReleaseConfigArtifact{}
if protoimpl.UnsafeEnabled {
- mi := &file_build_flags_out_proto_msgTypes[2]
+ mi := &file_build_flags_out_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -192,7 +240,7 @@
func (*ReleaseConfigArtifact) ProtoMessage() {}
func (x *ReleaseConfigArtifact) ProtoReflect() protoreflect.Message {
- mi := &file_build_flags_out_proto_msgTypes[2]
+ mi := &file_build_flags_out_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -205,7 +253,7 @@
// Deprecated: Use ReleaseConfigArtifact.ProtoReflect.Descriptor instead.
func (*ReleaseConfigArtifact) Descriptor() ([]byte, []int) {
- return file_build_flags_out_proto_rawDescGZIP(), []int{2}
+ return file_build_flags_out_proto_rawDescGZIP(), []int{3}
}
func (x *ReleaseConfigArtifact) GetName() string {
@@ -266,7 +314,7 @@
func (x *ReleaseConfigsArtifact) Reset() {
*x = ReleaseConfigsArtifact{}
if protoimpl.UnsafeEnabled {
- mi := &file_build_flags_out_proto_msgTypes[3]
+ mi := &file_build_flags_out_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -279,7 +327,7 @@
func (*ReleaseConfigsArtifact) ProtoMessage() {}
func (x *ReleaseConfigsArtifact) ProtoReflect() protoreflect.Message {
- mi := &file_build_flags_out_proto_msgTypes[3]
+ mi := &file_build_flags_out_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -292,7 +340,7 @@
// Deprecated: Use ReleaseConfigsArtifact.ProtoReflect.Descriptor instead.
func (*ReleaseConfigsArtifact) Descriptor() ([]byte, []int) {
- return file_build_flags_out_proto_rawDescGZIP(), []int{3}
+ return file_build_flags_out_proto_rawDescGZIP(), []int{4}
}
func (x *ReleaseConfigsArtifact) GetReleaseConfig() *ReleaseConfigArtifact {
@@ -344,58 +392,64 @@
0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69,
0x64, 0x2e, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67,
0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x74, 0x72, 0x61, 0x63, 0x65, 0x70, 0x6f, 0x69, 0x6e,
- 0x74, 0x52, 0x06, 0x74, 0x72, 0x61, 0x63, 0x65, 0x73, 0x22, 0x8e, 0x02, 0x0a, 0x17, 0x72, 0x65,
- 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x61, 0x72, 0x74,
- 0x69, 0x66, 0x61, 0x63, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20,
- 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x6f, 0x74, 0x68,
- 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a,
- 0x6f, 0x74, 0x68, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x73, 0x12, 0x52, 0x0a, 0x0e, 0x66, 0x6c,
- 0x61, 0x67, 0x5f, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03,
- 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2e, 0x72, 0x65, 0x6c,
- 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x70, 0x72, 0x6f, 0x74,
- 0x6f, 0x2e, 0x66, 0x6c, 0x61, 0x67, 0x5f, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x52,
- 0x0d, 0x66, 0x6c, 0x61, 0x67, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x73, 0x12, 0x2c,
- 0x0a, 0x12, 0x61, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f,
- 0x73, 0x65, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, 0x61, 0x63, 0x6f, 0x6e,
- 0x66, 0x69, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x53, 0x65, 0x74, 0x73, 0x12, 0x1a, 0x0a, 0x08,
- 0x69, 0x6e, 0x68, 0x65, 0x72, 0x69, 0x74, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08,
- 0x69, 0x6e, 0x68, 0x65, 0x72, 0x69, 0x74, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x69, 0x72, 0x65,
- 0x63, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x64,
- 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x22, 0xe8, 0x03, 0x0a, 0x18, 0x72,
- 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x5f, 0x61,
- 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x12, 0x5c, 0x0a, 0x0e, 0x72, 0x65, 0x6c, 0x65, 0x61,
- 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
- 0x35, 0x2e, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2e, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73,
- 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x72,
- 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x61, 0x72,
- 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x52, 0x0d, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x43,
- 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x69, 0x0a, 0x15, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x5f, 0x72,
- 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x18, 0x02,
- 0x20, 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2e, 0x72,
- 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x70, 0x72,
- 0x6f, 0x74, 0x6f, 0x2e, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66,
- 0x69, 0x67, 0x5f, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x52, 0x13, 0x6f, 0x74, 0x68,
- 0x65, 0x72, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73,
- 0x12, 0x87, 0x01, 0x0a, 0x17, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e,
- 0x66, 0x69, 0x67, 0x5f, 0x6d, 0x61, 0x70, 0x73, 0x5f, 0x6d, 0x61, 0x70, 0x18, 0x03, 0x20, 0x03,
- 0x28, 0x0b, 0x32, 0x50, 0x2e, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2e, 0x72, 0x65, 0x6c,
- 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x70, 0x72, 0x6f, 0x74,
- 0x6f, 0x2e, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67,
- 0x73, 0x5f, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61,
- 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x4d, 0x61, 0x70, 0x73, 0x4d, 0x61, 0x70, 0x45,
- 0x6e, 0x74, 0x72, 0x79, 0x52, 0x14, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x6e,
- 0x66, 0x69, 0x67, 0x4d, 0x61, 0x70, 0x73, 0x4d, 0x61, 0x70, 0x1a, 0x79, 0x0a, 0x19, 0x52, 0x65,
- 0x6c, 0x65, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x4d, 0x61, 0x70, 0x73, 0x4d,
- 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01,
- 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x46, 0x0a, 0x05, 0x76, 0x61, 0x6c,
- 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30, 0x2e, 0x61, 0x6e, 0x64, 0x72, 0x6f,
+ 0x74, 0x52, 0x06, 0x74, 0x72, 0x61, 0x63, 0x65, 0x73, 0x22, 0x64, 0x0a, 0x0e, 0x66, 0x6c, 0x61,
+ 0x67, 0x5f, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x73, 0x12, 0x52, 0x0a, 0x0e, 0x66,
+ 0x6c, 0x61, 0x67, 0x5f, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x73, 0x18, 0x01, 0x20,
+ 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2e, 0x72, 0x65,
+ 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x70, 0x72, 0x6f,
+ 0x74, 0x6f, 0x2e, 0x66, 0x6c, 0x61, 0x67, 0x5f, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74,
+ 0x52, 0x0d, 0x66, 0x6c, 0x61, 0x67, 0x41, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x73, 0x22,
+ 0x8e, 0x02, 0x0a, 0x17, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66,
+ 0x69, 0x67, 0x5f, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e,
+ 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
+ 0x1f, 0x0a, 0x0b, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x18, 0x02,
+ 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x4e, 0x61, 0x6d, 0x65, 0x73,
+ 0x12, 0x52, 0x0a, 0x0e, 0x66, 0x6c, 0x61, 0x67, 0x5f, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63,
+ 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x61, 0x6e, 0x64, 0x72, 0x6f,
+ 0x69, 0x64, 0x2e, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69,
+ 0x67, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x66, 0x6c, 0x61, 0x67, 0x5f, 0x61, 0x72, 0x74,
+ 0x69, 0x66, 0x61, 0x63, 0x74, 0x52, 0x0d, 0x66, 0x6c, 0x61, 0x67, 0x41, 0x72, 0x74, 0x69, 0x66,
+ 0x61, 0x63, 0x74, 0x73, 0x12, 0x2c, 0x0a, 0x12, 0x61, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f,
+ 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x73, 0x65, 0x74, 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x09,
+ 0x52, 0x10, 0x61, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x53, 0x65,
+ 0x74, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x68, 0x65, 0x72, 0x69, 0x74, 0x73, 0x18, 0x05,
+ 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x69, 0x6e, 0x68, 0x65, 0x72, 0x69, 0x74, 0x73, 0x12, 0x20,
+ 0x0a, 0x0b, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73, 0x18, 0x06, 0x20,
+ 0x03, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x69, 0x72, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x69, 0x65, 0x73,
+ 0x22, 0xe8, 0x03, 0x0a, 0x18, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e,
+ 0x66, 0x69, 0x67, 0x73, 0x5f, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x12, 0x5c, 0x0a,
+ 0x0e, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18,
+ 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2e,
+ 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x70,
+ 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e,
+ 0x66, 0x69, 0x67, 0x5f, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74, 0x52, 0x0d, 0x72, 0x65,
+ 0x6c, 0x65, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x69, 0x0a, 0x15, 0x6f,
+ 0x74, 0x68, 0x65, 0x72, 0x5f, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e,
+ 0x66, 0x69, 0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x35, 0x2e, 0x61, 0x6e, 0x64,
+ 0x72, 0x6f, 0x69, 0x64, 0x2e, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e,
+ 0x66, 0x69, 0x67, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73,
+ 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63,
+ 0x74, 0x52, 0x13, 0x6f, 0x74, 0x68, 0x65, 0x72, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x43,
+ 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x12, 0x87, 0x01, 0x0a, 0x17, 0x72, 0x65, 0x6c, 0x65, 0x61,
+ 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x6d, 0x61, 0x70, 0x73, 0x5f, 0x6d,
+ 0x61, 0x70, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x50, 0x2e, 0x61, 0x6e, 0x64, 0x72, 0x6f,
0x69, 0x64, 0x2e, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69,
0x67, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f,
- 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x6d, 0x61, 0x70, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75,
- 0x65, 0x3a, 0x02, 0x38, 0x01, 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,
+ 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x5f, 0x61, 0x72, 0x74, 0x69, 0x66, 0x61, 0x63, 0x74,
+ 0x2e, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x4d, 0x61,
+ 0x70, 0x73, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x14, 0x72, 0x65, 0x6c, 0x65,
+ 0x61, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x4d, 0x61, 0x70, 0x73, 0x4d, 0x61, 0x70,
+ 0x1a, 0x79, 0x0a, 0x19, 0x52, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x43, 0x6f, 0x6e, 0x66, 0x69,
+ 0x67, 0x4d, 0x61, 0x70, 0x73, 0x4d, 0x61, 0x70, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a,
+ 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12,
+ 0x46, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x30,
+ 0x2e, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2e, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65,
+ 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x72, 0x65,
+ 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x6d, 0x61, 0x70,
+ 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 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 (
@@ -410,32 +464,34 @@
return file_build_flags_out_proto_rawDescData
}
-var file_build_flags_out_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
+var file_build_flags_out_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_build_flags_out_proto_goTypes = []interface{}{
(*Tracepoint)(nil), // 0: android.release_config_proto.tracepoint
(*FlagArtifact)(nil), // 1: android.release_config_proto.flag_artifact
- (*ReleaseConfigArtifact)(nil), // 2: android.release_config_proto.release_config_artifact
- (*ReleaseConfigsArtifact)(nil), // 3: android.release_config_proto.release_configs_artifact
- nil, // 4: android.release_config_proto.release_configs_artifact.ReleaseConfigMapsMapEntry
- (*Value)(nil), // 5: android.release_config_proto.value
- (*FlagDeclaration)(nil), // 6: android.release_config_proto.flag_declaration
- (*ReleaseConfigMap)(nil), // 7: android.release_config_proto.release_config_map
+ (*FlagArtifacts)(nil), // 2: android.release_config_proto.flag_artifacts
+ (*ReleaseConfigArtifact)(nil), // 3: android.release_config_proto.release_config_artifact
+ (*ReleaseConfigsArtifact)(nil), // 4: android.release_config_proto.release_configs_artifact
+ nil, // 5: android.release_config_proto.release_configs_artifact.ReleaseConfigMapsMapEntry
+ (*Value)(nil), // 6: android.release_config_proto.value
+ (*FlagDeclaration)(nil), // 7: android.release_config_proto.flag_declaration
+ (*ReleaseConfigMap)(nil), // 8: android.release_config_proto.release_config_map
}
var file_build_flags_out_proto_depIdxs = []int32{
- 5, // 0: android.release_config_proto.tracepoint.value:type_name -> android.release_config_proto.value
- 6, // 1: android.release_config_proto.flag_artifact.flag_declaration:type_name -> android.release_config_proto.flag_declaration
- 5, // 2: android.release_config_proto.flag_artifact.value:type_name -> android.release_config_proto.value
- 0, // 3: android.release_config_proto.flag_artifact.traces:type_name -> android.release_config_proto.tracepoint
- 1, // 4: android.release_config_proto.release_config_artifact.flag_artifacts:type_name -> android.release_config_proto.flag_artifact
- 2, // 5: android.release_config_proto.release_configs_artifact.release_config:type_name -> android.release_config_proto.release_config_artifact
- 2, // 6: android.release_config_proto.release_configs_artifact.other_release_configs:type_name -> android.release_config_proto.release_config_artifact
- 4, // 7: android.release_config_proto.release_configs_artifact.release_config_maps_map:type_name -> android.release_config_proto.release_configs_artifact.ReleaseConfigMapsMapEntry
- 7, // 8: android.release_config_proto.release_configs_artifact.ReleaseConfigMapsMapEntry.value:type_name -> android.release_config_proto.release_config_map
- 9, // [9:9] is the sub-list for method output_type
- 9, // [9:9] is the sub-list for method input_type
- 9, // [9:9] is the sub-list for extension type_name
- 9, // [9:9] is the sub-list for extension extendee
- 0, // [0:9] is the sub-list for field type_name
+ 6, // 0: android.release_config_proto.tracepoint.value:type_name -> android.release_config_proto.value
+ 7, // 1: android.release_config_proto.flag_artifact.flag_declaration:type_name -> android.release_config_proto.flag_declaration
+ 6, // 2: android.release_config_proto.flag_artifact.value:type_name -> android.release_config_proto.value
+ 0, // 3: android.release_config_proto.flag_artifact.traces:type_name -> android.release_config_proto.tracepoint
+ 1, // 4: android.release_config_proto.flag_artifacts.flag_artifacts:type_name -> android.release_config_proto.flag_artifact
+ 1, // 5: android.release_config_proto.release_config_artifact.flag_artifacts:type_name -> android.release_config_proto.flag_artifact
+ 3, // 6: android.release_config_proto.release_configs_artifact.release_config:type_name -> android.release_config_proto.release_config_artifact
+ 3, // 7: android.release_config_proto.release_configs_artifact.other_release_configs:type_name -> android.release_config_proto.release_config_artifact
+ 5, // 8: android.release_config_proto.release_configs_artifact.release_config_maps_map:type_name -> android.release_config_proto.release_configs_artifact.ReleaseConfigMapsMapEntry
+ 8, // 9: android.release_config_proto.release_configs_artifact.ReleaseConfigMapsMapEntry.value:type_name -> android.release_config_proto.release_config_map
+ 10, // [10:10] is the sub-list for method output_type
+ 10, // [10:10] is the sub-list for method input_type
+ 10, // [10:10] is the sub-list for extension type_name
+ 10, // [10:10] is the sub-list for extension extendee
+ 0, // [0:10] is the sub-list for field type_name
}
func init() { file_build_flags_out_proto_init() }
@@ -470,7 +526,7 @@
}
}
file_build_flags_out_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*ReleaseConfigArtifact); i {
+ switch v := v.(*FlagArtifacts); i {
case 0:
return &v.state
case 1:
@@ -482,6 +538,18 @@
}
}
file_build_flags_out_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ReleaseConfigArtifact); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_build_flags_out_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ReleaseConfigsArtifact); i {
case 0:
return &v.state
@@ -500,7 +568,7 @@
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_build_flags_out_proto_rawDesc,
NumEnums: 0,
- NumMessages: 5,
+ NumMessages: 6,
NumExtensions: 0,
NumServices: 0,
},
diff --git a/cmd/release_config/release_config_proto/build_flags_out.proto b/cmd/release_config/release_config_proto/build_flags_out.proto
index 05e770f..6f34d6f 100644
--- a/cmd/release_config/release_config_proto/build_flags_out.proto
+++ b/cmd/release_config/release_config_proto/build_flags_out.proto
@@ -52,6 +52,11 @@
repeated tracepoint traces = 8;
}
+message flag_artifacts {
+ // The artifacts
+ repeated flag_artifact flag_artifacts = 1;
+}
+
message release_config_artifact {
// The name of the release config.
// See # name for format detail
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 ca2005c..dded975 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
@@ -98,76 +98,6 @@
return file_build_flags_src_proto_rawDescGZIP(), []int{0}
}
-type Container int32
-
-const (
- Container_UNSPECIFIED_container Container = 0
- // All containers
- Container_ALL Container = 1
- // Specific containers
- Container_PRODUCT Container = 2
- Container_SYSTEM Container = 3
- Container_SYSTEM_EXT Container = 4
- Container_VENDOR Container = 5
-)
-
-// Enum value maps for Container.
-var (
- Container_name = map[int32]string{
- 0: "UNSPECIFIED_container",
- 1: "ALL",
- 2: "PRODUCT",
- 3: "SYSTEM",
- 4: "SYSTEM_EXT",
- 5: "VENDOR",
- }
- Container_value = map[string]int32{
- "UNSPECIFIED_container": 0,
- "ALL": 1,
- "PRODUCT": 2,
- "SYSTEM": 3,
- "SYSTEM_EXT": 4,
- "VENDOR": 5,
- }
-)
-
-func (x Container) Enum() *Container {
- p := new(Container)
- *p = x
- return p
-}
-
-func (x Container) String() string {
- return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
-}
-
-func (Container) Descriptor() protoreflect.EnumDescriptor {
- return file_build_flags_src_proto_enumTypes[1].Descriptor()
-}
-
-func (Container) Type() protoreflect.EnumType {
- return &file_build_flags_src_proto_enumTypes[1]
-}
-
-func (x Container) Number() protoreflect.EnumNumber {
- return protoreflect.EnumNumber(x)
-}
-
-// Deprecated: Do not use.
-func (x *Container) UnmarshalJSON(b []byte) error {
- num, err := protoimpl.X.UnmarshalJSONEnum(x.Descriptor(), b)
- if err != nil {
- return err
- }
- *x = Container(num)
- return nil
-}
-
-// Deprecated: Use Container.Descriptor instead.
-func (Container) EnumDescriptor() ([]byte, []int) {
- return file_build_flags_src_proto_rawDescGZIP(), []int{1}
-}
-
type Value struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@@ -298,7 +228,7 @@
Workflow *Workflow `protobuf:"varint,205,opt,name=workflow,enum=android.release_config_proto.Workflow" json:"workflow,omitempty"`
// The container for this flag. This overrides any default container given
// in the release_config_map message.
- Container *Container `protobuf:"varint,206,opt,name=container,enum=android.release_config_proto.Container" json:"container,omitempty"`
+ Containers []string `protobuf:"bytes,206,rep,name=containers" json:"containers,omitempty"`
}
func (x *FlagDeclaration) Reset() {
@@ -368,11 +298,11 @@
return Workflow_UNSPECIFIED_workflow
}
-func (x *FlagDeclaration) GetContainer() Container {
- if x != nil && x.Container != nil {
- return *x.Container
+func (x *FlagDeclaration) GetContainers() []string {
+ if x != nil {
+ return x.Containers
}
- return Container_UNSPECIFIED_container
+ return nil
}
type FlagValue struct {
@@ -457,6 +387,8 @@
// List of names of the aconfig_value_set soong module(s) for this
// contribution.
AconfigValueSets []string `protobuf:"bytes,3,rep,name=aconfig_value_sets,json=aconfigValueSets" json:"aconfig_value_sets,omitempty"`
+ // Only aconfig flags are allowed in this release config.
+ AconfigFlagsOnly *bool `protobuf:"varint,4,opt,name=aconfig_flags_only,json=aconfigFlagsOnly" json:"aconfig_flags_only,omitempty"`
}
func (x *ReleaseConfig) Reset() {
@@ -512,6 +444,13 @@
return nil
}
+func (x *ReleaseConfig) GetAconfigFlagsOnly() bool {
+ if x != nil && x.AconfigFlagsOnly != nil {
+ return *x.AconfigFlagsOnly
+ }
+ return false
+}
+
// Any aliases. These are used for continuous integration builder config.
type ReleaseAlias struct {
state protoimpl.MessageState
@@ -581,7 +520,7 @@
// Description of this map and its intended use.
Description *string `protobuf:"bytes,2,opt,name=description" json:"description,omitempty"`
// The default container for flags declared here.
- DefaultContainer *Container `protobuf:"varint,3,opt,name=default_container,json=defaultContainer,enum=android.release_config_proto.Container" json:"default_container,omitempty"`
+ DefaultContainers []string `protobuf:"bytes,3,rep,name=default_containers,json=defaultContainers" json:"default_containers,omitempty"`
}
func (x *ReleaseConfigMap) Reset() {
@@ -630,11 +569,11 @@
return ""
}
-func (x *ReleaseConfigMap) GetDefaultContainer() Container {
- if x != nil && x.DefaultContainer != nil {
- return *x.DefaultContainer
+func (x *ReleaseConfigMap) GetDefaultContainers() []string {
+ if x != nil {
+ return x.DefaultContainers
}
- return Container_UNSPECIFIED_container
+ return nil
}
var File_build_flags_src_proto protoreflect.FileDescriptor
@@ -653,7 +592,7 @@
0x6c, 0x75, 0x65, 0x18, 0xca, 0x01, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x09, 0x62, 0x6f,
0x6f, 0x6c, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1d, 0x0a, 0x08, 0x6f, 0x62, 0x73, 0x6f, 0x6c,
0x65, 0x74, 0x65, 0x18, 0xcb, 0x01, 0x20, 0x01, 0x28, 0x08, 0x48, 0x00, 0x52, 0x08, 0x6f, 0x62,
- 0x73, 0x6f, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x05, 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x22, 0xbd, 0x02,
+ 0x73, 0x6f, 0x6c, 0x65, 0x74, 0x65, 0x42, 0x05, 0x0a, 0x03, 0x76, 0x61, 0x6c, 0x22, 0x96, 0x02,
0x0a, 0x10, 0x66, 0x6c, 0x61, 0x67, 0x5f, 0x64, 0x65, 0x63, 0x6c, 0x61, 0x72, 0x61, 0x74, 0x69,
0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x6e, 0x61, 0x6d, 0x65, 0x73, 0x70,
@@ -668,59 +607,50 @@
0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x26, 0x2e, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2e,
0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x52, 0x08, 0x77,
- 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x46, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61,
- 0x69, 0x6e, 0x65, 0x72, 0x18, 0xce, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x27, 0x2e, 0x61, 0x6e,
- 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2e, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f,
- 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x61,
- 0x69, 0x6e, 0x65, 0x72, 0x52, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x4a,
- 0x04, 0x08, 0x04, 0x10, 0x05, 0x4a, 0x06, 0x08, 0xcf, 0x01, 0x10, 0xd0, 0x01, 0x22, 0x79, 0x0a,
- 0x0a, 0x66, 0x6c, 0x61, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e,
- 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12,
- 0x3a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0xc9, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32,
- 0x23, 0x2e, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2e, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73,
- 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x76,
- 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1b, 0x0a, 0x08, 0x72,
- 0x65, 0x64, 0x61, 0x63, 0x74, 0x65, 0x64, 0x18, 0xca, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08,
- 0x72, 0x65, 0x64, 0x61, 0x63, 0x74, 0x65, 0x64, 0x22, 0x6e, 0x0a, 0x0e, 0x72, 0x65, 0x6c, 0x65,
- 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61,
- 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a,
- 0x0a, 0x08, 0x69, 0x6e, 0x68, 0x65, 0x72, 0x69, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09,
- 0x52, 0x08, 0x69, 0x6e, 0x68, 0x65, 0x72, 0x69, 0x74, 0x73, 0x12, 0x2c, 0x0a, 0x12, 0x61, 0x63,
- 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x73, 0x65, 0x74, 0x73,
- 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x10, 0x61, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x56,
- 0x61, 0x6c, 0x75, 0x65, 0x53, 0x65, 0x74, 0x73, 0x22, 0x3b, 0x0a, 0x0d, 0x72, 0x65, 0x6c, 0x65,
- 0x61, 0x73, 0x65, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d,
- 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a,
- 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74,
- 0x61, 0x72, 0x67, 0x65, 0x74, 0x22, 0xd3, 0x01, 0x0a, 0x12, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73,
- 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x6d, 0x61, 0x70, 0x12, 0x45, 0x0a, 0x07,
- 0x61, 0x6c, 0x69, 0x61, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e,
- 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2e, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f,
- 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x72, 0x65, 0x6c,
- 0x65, 0x61, 0x73, 0x65, 0x5f, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x52, 0x07, 0x61, 0x6c, 0x69, 0x61,
- 0x73, 0x65, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69,
- 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x64, 0x65, 0x73, 0x63, 0x72, 0x69,
- 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x54, 0x0a, 0x11, 0x64, 0x65, 0x66, 0x61, 0x75, 0x6c, 0x74,
- 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0e,
- 0x32, 0x27, 0x2e, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2e, 0x72, 0x65, 0x6c, 0x65, 0x61,
- 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e,
- 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x52, 0x10, 0x64, 0x65, 0x66, 0x61, 0x75,
- 0x6c, 0x74, 0x43, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x2a, 0x4a, 0x0a, 0x08, 0x77,
- 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x18, 0x0a, 0x14, 0x55, 0x4e, 0x53, 0x50, 0x45,
- 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x5f, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 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, 0x2a, 0x64, 0x0a, 0x09, 0x63, 0x6f, 0x6e, 0x74, 0x61,
- 0x69, 0x6e, 0x65, 0x72, 0x12, 0x19, 0x0a, 0x15, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46,
- 0x49, 0x45, 0x44, 0x5f, 0x63, 0x6f, 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x10, 0x00, 0x12,
- 0x07, 0x0a, 0x03, 0x41, 0x4c, 0x4c, 0x10, 0x01, 0x12, 0x0b, 0x0a, 0x07, 0x50, 0x52, 0x4f, 0x44,
- 0x55, 0x43, 0x54, 0x10, 0x02, 0x12, 0x0a, 0x0a, 0x06, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x10,
- 0x03, 0x12, 0x0e, 0x0a, 0x0a, 0x53, 0x59, 0x53, 0x54, 0x45, 0x4d, 0x5f, 0x45, 0x58, 0x54, 0x10,
- 0x04, 0x12, 0x0a, 0x0a, 0x06, 0x56, 0x45, 0x4e, 0x44, 0x4f, 0x52, 0x10, 0x05, 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,
+ 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x1f, 0x0a, 0x0a, 0x63, 0x6f, 0x6e, 0x74, 0x61,
+ 0x69, 0x6e, 0x65, 0x72, 0x73, 0x18, 0xce, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f,
+ 0x6e, 0x74, 0x61, 0x69, 0x6e, 0x65, 0x72, 0x73, 0x4a, 0x04, 0x08, 0x04, 0x10, 0x05, 0x4a, 0x06,
+ 0x08, 0xcf, 0x01, 0x10, 0xd0, 0x01, 0x22, 0x79, 0x0a, 0x0a, 0x66, 0x6c, 0x61, 0x67, 0x5f, 0x76,
+ 0x61, 0x6c, 0x75, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x3a, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75,
+ 0x65, 0x18, 0xc9, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x61, 0x6e, 0x64, 0x72, 0x6f,
+ 0x69, 0x64, 0x2e, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69,
+ 0x67, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x52, 0x05, 0x76,
+ 0x61, 0x6c, 0x75, 0x65, 0x12, 0x1b, 0x0a, 0x08, 0x72, 0x65, 0x64, 0x61, 0x63, 0x74, 0x65, 0x64,
+ 0x18, 0xca, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x08, 0x72, 0x65, 0x64, 0x61, 0x63, 0x74, 0x65,
+ 0x64, 0x22, 0x9c, 0x01, 0x0a, 0x0e, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f,
+ 0x6e, 0x66, 0x69, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x6e, 0x68, 0x65,
+ 0x72, 0x69, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x08, 0x69, 0x6e, 0x68, 0x65,
+ 0x72, 0x69, 0x74, 0x73, 0x12, 0x2c, 0x0a, 0x12, 0x61, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f,
+ 0x76, 0x61, 0x6c, 0x75, 0x65, 0x5f, 0x73, 0x65, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x09,
+ 0x52, 0x10, 0x61, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x53, 0x65,
+ 0x74, 0x73, 0x12, 0x2c, 0x0a, 0x12, 0x61, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x66, 0x6c,
+ 0x61, 0x67, 0x73, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x10,
+ 0x61, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x46, 0x6c, 0x61, 0x67, 0x73, 0x4f, 0x6e, 0x6c, 0x79,
+ 0x22, 0x3b, 0x0a, 0x0d, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x61, 0x6c, 0x69, 0x61,
+ 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18,
+ 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x22, 0xac, 0x01,
+ 0x0a, 0x12, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67,
+ 0x5f, 0x6d, 0x61, 0x70, 0x12, 0x45, 0x0a, 0x07, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x65, 0x73, 0x18,
+ 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x61, 0x6e, 0x64, 0x72, 0x6f, 0x69, 0x64, 0x2e,
+ 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x5f, 0x70,
+ 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x72, 0x65, 0x6c, 0x65, 0x61, 0x73, 0x65, 0x5f, 0x61, 0x6c, 0x69,
+ 0x61, 0x73, 0x52, 0x07, 0x61, 0x6c, 0x69, 0x61, 0x73, 0x65, 0x73, 0x12, 0x20, 0x0a, 0x0b, 0x64,
+ 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09,
+ 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, 0x4a, 0x0a, 0x08,
+ 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77, 0x12, 0x18, 0x0a, 0x14, 0x55, 0x4e, 0x53, 0x50,
+ 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x5f, 0x77, 0x6f, 0x72, 0x6b, 0x66, 0x6c, 0x6f, 0x77,
+ 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 (
@@ -735,30 +665,27 @@
return file_build_flags_src_proto_rawDescData
}
-var file_build_flags_src_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
+var file_build_flags_src_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_build_flags_src_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
var file_build_flags_src_proto_goTypes = []interface{}{
(Workflow)(0), // 0: android.release_config_proto.workflow
- (Container)(0), // 1: android.release_config_proto.container
- (*Value)(nil), // 2: android.release_config_proto.value
- (*FlagDeclaration)(nil), // 3: android.release_config_proto.flag_declaration
- (*FlagValue)(nil), // 4: android.release_config_proto.flag_value
- (*ReleaseConfig)(nil), // 5: android.release_config_proto.release_config
- (*ReleaseAlias)(nil), // 6: android.release_config_proto.release_alias
- (*ReleaseConfigMap)(nil), // 7: android.release_config_proto.release_config_map
+ (*Value)(nil), // 1: android.release_config_proto.value
+ (*FlagDeclaration)(nil), // 2: android.release_config_proto.flag_declaration
+ (*FlagValue)(nil), // 3: android.release_config_proto.flag_value
+ (*ReleaseConfig)(nil), // 4: android.release_config_proto.release_config
+ (*ReleaseAlias)(nil), // 5: android.release_config_proto.release_alias
+ (*ReleaseConfigMap)(nil), // 6: android.release_config_proto.release_config_map
}
var file_build_flags_src_proto_depIdxs = []int32{
- 2, // 0: android.release_config_proto.flag_declaration.value:type_name -> android.release_config_proto.value
+ 1, // 0: android.release_config_proto.flag_declaration.value:type_name -> android.release_config_proto.value
0, // 1: android.release_config_proto.flag_declaration.workflow:type_name -> android.release_config_proto.workflow
- 1, // 2: android.release_config_proto.flag_declaration.container:type_name -> android.release_config_proto.container
- 2, // 3: android.release_config_proto.flag_value.value:type_name -> android.release_config_proto.value
- 6, // 4: android.release_config_proto.release_config_map.aliases:type_name -> android.release_config_proto.release_alias
- 1, // 5: android.release_config_proto.release_config_map.default_container:type_name -> android.release_config_proto.container
- 6, // [6:6] is the sub-list for method output_type
- 6, // [6:6] is the sub-list for method input_type
- 6, // [6:6] is the sub-list for extension type_name
- 6, // [6:6] is the sub-list for extension extendee
- 0, // [0:6] is the sub-list for field type_name
+ 1, // 2: android.release_config_proto.flag_value.value:type_name -> android.release_config_proto.value
+ 5, // 3: android.release_config_proto.release_config_map.aliases:type_name -> android.release_config_proto.release_alias
+ 4, // [4:4] is the sub-list for method output_type
+ 4, // [4:4] is the sub-list for method input_type
+ 4, // [4:4] is the sub-list for extension type_name
+ 4, // [4:4] is the sub-list for extension extendee
+ 0, // [0:4] is the sub-list for field type_name
}
func init() { file_build_flags_src_proto_init() }
@@ -851,7 +778,7 @@
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_build_flags_src_proto_rawDesc,
- NumEnums: 2,
+ NumEnums: 1,
NumMessages: 6,
NumExtensions: 0,
NumServices: 0,
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 92edc2a..0ef1a5f 100644
--- a/cmd/release_config/release_config_proto/build_flags_src.proto
+++ b/cmd/release_config/release_config_proto/build_flags_src.proto
@@ -53,19 +53,6 @@
MANUAL = 3;
}
-enum container {
- UNSPECIFIED_container = 0;
-
- // All containers
- ALL = 1;
-
- // Specific containers
- PRODUCT = 2;
- SYSTEM = 3;
- SYSTEM_EXT = 4;
- VENDOR = 5;
-}
-
message value {
oneof val {
bool unspecified_value = 200;
@@ -100,7 +87,7 @@
// The container for this flag. This overrides any default container given
// in the release_config_map message.
- optional container container = 206;
+ repeated string containers = 206;
// The package associated with this flag.
// (when Gantry is ready for it) optional string package = 207;
@@ -132,6 +119,9 @@
// List of names of the aconfig_value_set soong module(s) for this
// contribution.
repeated string aconfig_value_sets = 3;
+
+ // Only aconfig flags are allowed in this release config.
+ optional bool aconfig_flags_only = 4;
}
// Any aliases. These are used for continuous integration builder config.
@@ -152,7 +142,7 @@
optional string description = 2;
// The default container for flags declared here.
- optional container default_container = 3;
+ repeated string default_containers = 3;
// If needed, we can add these fields instead of hardcoding the location.
// Flag declarations: `flag_declarations/*.textproto`
diff --git a/etc/prebuilt_etc.go b/etc/prebuilt_etc.go
index d1c1d85..025ba27 100644
--- a/etc/prebuilt_etc.go
+++ b/etc/prebuilt_etc.go
@@ -55,6 +55,9 @@
ctx.RegisterModuleType("prebuilt_usr_share", PrebuiltUserShareFactory)
ctx.RegisterModuleType("prebuilt_usr_share_host", PrebuiltUserShareHostFactory)
ctx.RegisterModuleType("prebuilt_usr_hyphendata", PrebuiltUserHyphenDataFactory)
+ ctx.RegisterModuleType("prebuilt_usr_keylayout", PrebuiltUserKeyLayoutFactory)
+ ctx.RegisterModuleType("prebuilt_usr_keychars", PrebuiltUserKeyCharsFactory)
+ ctx.RegisterModuleType("prebuilt_usr_idc", PrebuiltUserIdcFactory)
ctx.RegisterModuleType("prebuilt_font", PrebuiltFontFactory)
ctx.RegisterModuleType("prebuilt_firmware", PrebuiltFirmwareFactory)
ctx.RegisterModuleType("prebuilt_dsp", PrebuiltDSPFactory)
@@ -609,6 +612,39 @@
return module
}
+// prebuilt_usr_keylayout is for a prebuilt artifact that is installed in
+// <partition>/usr/keylayout/<sub_dir> directory.
+func PrebuiltUserKeyLayoutFactory() android.Module {
+ module := &PrebuiltEtc{}
+ InitPrebuiltEtcModule(module, "usr/keylayout")
+ // This module is device-only
+ android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
+ android.InitDefaultableModule(module)
+ return module
+}
+
+// prebuilt_usr_keychars is for a prebuilt artifact that is installed in
+// <partition>/usr/keychars/<sub_dir> directory.
+func PrebuiltUserKeyCharsFactory() android.Module {
+ module := &PrebuiltEtc{}
+ InitPrebuiltEtcModule(module, "usr/keychars")
+ // This module is device-only
+ android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
+ android.InitDefaultableModule(module)
+ return module
+}
+
+// prebuilt_usr_idc is for a prebuilt artifact that is installed in
+// <partition>/usr/idc/<sub_dir> directory.
+func PrebuiltUserIdcFactory() android.Module {
+ module := &PrebuiltEtc{}
+ InitPrebuiltEtcModule(module, "usr/idc")
+ // This module is device-only
+ android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibFirst)
+ android.InitDefaultableModule(module)
+ return module
+}
+
// prebuilt_font installs a font in <partition>/fonts directory.
func PrebuiltFontFactory() android.Module {
module := &PrebuiltEtc{}
diff --git a/etc/prebuilt_etc_test.go b/etc/prebuilt_etc_test.go
index dd9958c..3ee2340 100644
--- a/etc/prebuilt_etc_test.go
+++ b/etc/prebuilt_etc_test.go
@@ -287,6 +287,48 @@
android.AssertPathRelativeToTopEquals(t, "install dir", expected, p.installDirPath)
}
+func TestPrebuiltPrebuiltUserKeyLayoutInstallDirPath(t *testing.T) {
+ result := prepareForPrebuiltEtcTest.RunTestWithBp(t, `
+ prebuilt_usr_keylayout {
+ name: "foo.conf",
+ src: "foo.conf",
+ sub_dir: "bar",
+ }
+ `)
+
+ p := result.Module("foo.conf", "android_arm64_armv8-a").(*PrebuiltEtc)
+ expected := "out/soong/target/product/test_device/system/usr/keylayout/bar"
+ android.AssertPathRelativeToTopEquals(t, "install dir", expected, p.installDirPath)
+}
+
+func TestPrebuiltPrebuiltUserKeyCharsInstallDirPath(t *testing.T) {
+ result := prepareForPrebuiltEtcTest.RunTestWithBp(t, `
+ prebuilt_usr_keychars {
+ name: "foo.conf",
+ src: "foo.conf",
+ sub_dir: "bar",
+ }
+ `)
+
+ p := result.Module("foo.conf", "android_arm64_armv8-a").(*PrebuiltEtc)
+ expected := "out/soong/target/product/test_device/system/usr/keychars/bar"
+ android.AssertPathRelativeToTopEquals(t, "install dir", expected, p.installDirPath)
+}
+
+func TestPrebuiltPrebuiltUserIdcInstallDirPath(t *testing.T) {
+ result := prepareForPrebuiltEtcTest.RunTestWithBp(t, `
+ prebuilt_usr_idc {
+ name: "foo.conf",
+ src: "foo.conf",
+ sub_dir: "bar",
+ }
+ `)
+
+ p := result.Module("foo.conf", "android_arm64_armv8-a").(*PrebuiltEtc)
+ expected := "out/soong/target/product/test_device/system/usr/idc/bar"
+ android.AssertPathRelativeToTopEquals(t, "install dir", expected, p.installDirPath)
+}
+
func TestPrebuiltFontInstallDirPath(t *testing.T) {
result := prepareForPrebuiltEtcTest.RunTestWithBp(t, `
prebuilt_font {
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go
index cadf9c24..b342ae9 100644
--- a/filesystem/filesystem.go
+++ b/filesystem/filesystem.go
@@ -127,6 +127,10 @@
// the make version.
Include_make_built_files string
+ // When set, builds etc/event-log-tags file by merging logtags from all dependencies.
+ // Default is false
+ Build_logtags *bool
+
Fsverity fsverityProperties
}
@@ -137,6 +141,7 @@
// partitions like system.img. For example, cc_library modules are placed under ./lib[64] directory.
func filesystemFactory() android.Module {
module := &filesystem{}
+ module.filterPackagingSpec = module.filterInstallablePackagingSpec
initFilesystemModule(module)
return module
}
@@ -189,6 +194,12 @@
return proptools.StringDefault(f.properties.Partition_name, f.Name())
}
+func (f *filesystem) filterInstallablePackagingSpec(ps android.PackagingSpec) bool {
+ // Filesystem module respects the installation semantic. A PackagingSpec from a module with
+ // IsSkipInstall() is skipped.
+ return !ps.SkipInstall()
+}
+
var pctx = android.NewPackageContext("android/soong/filesystem")
func (f *filesystem) GenerateAndroidBuildActions(ctx android.ModuleContext) {
@@ -288,6 +299,7 @@
f.buildNonDepsFiles(ctx, builder, rootDir)
f.addMakeBuiltFiles(ctx, builder, rootDir)
f.buildFsverityMetadataFiles(ctx, builder, specs, rootDir, rebasedDir)
+ f.buildEventLogtagsFile(ctx, builder, rebasedDir)
// run host_init_verifier
// Ideally we should have a concept of pluggable linters that verify the generated image.
@@ -428,6 +440,7 @@
f.buildNonDepsFiles(ctx, builder, rootDir)
f.buildFsverityMetadataFiles(ctx, builder, specs, rootDir, rebasedDir)
+ f.buildEventLogtagsFile(ctx, builder, rebasedDir)
output := android.PathForModuleOut(ctx, f.installFileName()).OutputPath
cmd := builder.Command().
@@ -485,6 +498,37 @@
Text(android.PathForArbitraryOutput(ctx, stagingDir).String())
}
+func (f *filesystem) buildEventLogtagsFile(ctx android.ModuleContext, builder *android.RuleBuilder, rebasedDir android.OutputPath) {
+ if !proptools.Bool(f.properties.Build_logtags) {
+ return
+ }
+
+ logtagsFilePaths := make(map[string]bool)
+ ctx.WalkDeps(func(child, parent android.Module) bool {
+ if logtagsInfo, ok := android.OtherModuleProvider(ctx, child, android.LogtagsProviderKey); ok {
+ for _, path := range logtagsInfo.Logtags {
+ logtagsFilePaths[path.String()] = true
+ }
+ }
+ return true
+ })
+
+ if len(logtagsFilePaths) == 0 {
+ return
+ }
+
+ etcPath := rebasedDir.Join(ctx, "etc")
+ eventLogtagsPath := etcPath.Join(ctx, "event-log-tags")
+ builder.Command().Text("mkdir").Flag("-p").Text(etcPath.String())
+ cmd := builder.Command().BuiltTool("merge-event-log-tags").
+ FlagWithArg("-o ", eventLogtagsPath.String()).
+ FlagWithInput("-m ", android.MergedLogtagsPath(ctx))
+
+ for _, path := range android.SortedKeys(logtagsFilePaths) {
+ cmd.Text(path)
+ }
+}
+
type partition interface {
PartitionType() string
}
diff --git a/filesystem/filesystem_test.go b/filesystem/filesystem_test.go
index 3a5071d..acd4813 100644
--- a/filesystem/filesystem_test.go
+++ b/filesystem/filesystem_test.go
@@ -299,43 +299,6 @@
cmd, "--include_descriptors_from_image ")
}
-func TestFileSystemShouldInstallCoreVariantIfTargetBuildAppsIsSet(t *testing.T) {
- context := android.GroupFixturePreparers(
- fixture,
- android.FixtureModifyProductVariables(func(variables android.FixtureProductVariables) {
- variables.Unbundled_build_apps = []string{"bar"}
- }),
- )
- result := context.RunTestWithBp(t, `
- android_system_image {
- name: "myfilesystem",
- deps: [
- "libfoo",
- ],
- linker_config_src: "linker.config.json",
- }
-
- cc_library {
- name: "libfoo",
- shared_libs: [
- "libbar",
- ],
- stl: "none",
- }
-
- cc_library {
- name: "libbar",
- sdk_version: "9",
- stl: "none",
- }
- `)
-
- inputs := result.ModuleForTests("myfilesystem", "android_common").Output("myfilesystem.img").Implicits
- android.AssertStringListContains(t, "filesystem should have libbar even for unbundled build",
- inputs.Strings(),
- "out/soong/.intermediates/libbar/android_arm64_armv8-a_shared/libbar.so")
-}
-
func TestFileSystemWithCoverageVariants(t *testing.T) {
context := android.GroupFixturePreparers(
fixture,
@@ -479,3 +442,26 @@
}
`)
}
+
+func TestPreventDuplicatedEntries(t *testing.T) {
+ fixture.ExtendWithErrorHandler(android.FixtureExpectsOneErrorPattern(
+ "packaging conflict at")).
+ RunTestWithBp(t, `
+ android_filesystem {
+ name: "fs",
+ deps: [
+ "foo",
+ "foo_dup",
+ ],
+ }
+
+ cc_binary {
+ name: "foo",
+ }
+
+ cc_binary {
+ name: "foo_dup",
+ stem: "foo",
+ }
+ `)
+}
diff --git a/filesystem/system_image.go b/filesystem/system_image.go
index 5028a49..15cacfb 100644
--- a/filesystem/system_image.go
+++ b/filesystem/system_image.go
@@ -98,5 +98,5 @@
// Note that "apex" module installs its contents to "apex"(fake partition) as well
// for symbol lookup by imitating "activated" paths.
func (s *systemImage) filterPackagingSpec(ps android.PackagingSpec) bool {
- return ps.Partition() == "system"
+ return s.filesystem.filterInstallablePackagingSpec(ps) && ps.Partition() == "system"
}
diff --git a/genrule/genrule.go b/genrule/genrule.go
index 43f4fe5..4ff82e6 100644
--- a/genrule/genrule.go
+++ b/genrule/genrule.go
@@ -714,13 +714,13 @@
rule := getSandboxedRuleBuilder(ctx, android.NewRuleBuilder(pctx, ctx).Sbox(genDir, nil))
for _, in := range shard {
- outFile := android.GenPathWithExt(ctx, finalSubDir, in, String(properties.Output_extension))
+ outFile := android.GenPathWithExtAndTrimExt(ctx, finalSubDir, in, String(properties.Output_extension), String(properties.Trim_extension))
// If sharding is enabled, then outFile is the path to the output file in
// the shard directory, and copyTo is the path to the output file in the
// final directory.
if len(shards) > 1 {
- shardFile := android.GenPathWithExt(ctx, genSubDir, in, String(properties.Output_extension))
+ shardFile := android.GenPathWithExtAndTrimExt(ctx, genSubDir, in, String(properties.Output_extension), String(properties.Trim_extension))
copyTo = append(copyTo, outFile)
outFile = shardFile
}
@@ -786,6 +786,9 @@
// Additional files needed for build that are not tooling related.
Data []string `android:"path"`
+
+ // Trim the matched extension for each input file, and it should start with ".".
+ Trim_extension *string
}
const defaultShardSize = 50
diff --git a/genrule/genrule_test.go b/genrule/genrule_test.go
index 2dc6a79..1df887b 100644
--- a/genrule/genrule_test.go
+++ b/genrule/genrule_test.go
@@ -894,6 +894,155 @@
)
}
+func TestGenSrcsWithTrimExtAndOutpuExtension(t *testing.T) {
+ result := android.GroupFixturePreparers(
+ prepareForGenRuleTest,
+ android.FixtureMergeMockFs(android.MockFS{
+ "external-protos/path/Android.bp": []byte(`
+ filegroup {
+ name: "external-protos",
+ srcs: [
+ "baz.a.b.c.proto/baz.a.b.c.proto",
+ "bar.a.b.c.proto",
+ "qux.ext.a.b.c.proto",
+ ],
+ }
+ `),
+ "package-dir/Android.bp": []byte(`
+ gensrcs {
+ name: "module-name",
+ cmd: "mkdir -p $(genDir) && cat $(in) >> $(genDir)/$(out)",
+ srcs: [
+ "src/foo.a.b.c.proto",
+ ":external-protos",
+ ],
+
+ trim_extension: ".a.b.c.proto",
+ output_extension: "proto.h",
+ }
+ `),
+ }),
+ ).RunTest(t)
+
+ exportedIncludeDir := "out/soong/.intermediates/package-dir/module-name/gen/gensrcs"
+ gen := result.Module("module-name", "").(*Module)
+
+ android.AssertPathsRelativeToTopEquals(
+ t,
+ "include path",
+ []string{exportedIncludeDir},
+ gen.exportedIncludeDirs,
+ )
+ android.AssertPathsRelativeToTopEquals(
+ t,
+ "files",
+ []string{
+ exportedIncludeDir + "/package-dir/src/foo.proto.h",
+ exportedIncludeDir + "/external-protos/path/baz.a.b.c.proto/baz.proto.h",
+ exportedIncludeDir + "/external-protos/path/bar.proto.h",
+ exportedIncludeDir + "/external-protos/path/qux.ext.proto.h",
+ },
+ gen.outputFiles,
+ )
+}
+
+func TestGenSrcsWithTrimExtButNoOutpuExtension(t *testing.T) {
+ result := android.GroupFixturePreparers(
+ prepareForGenRuleTest,
+ android.FixtureMergeMockFs(android.MockFS{
+ "external-protos/path/Android.bp": []byte(`
+ filegroup {
+ name: "external-protos",
+ srcs: [
+ "baz.a.b.c.proto/baz.a.b.c.proto",
+ "bar.a.b.c.proto",
+ "qux.ext.a.b.c.proto",
+ ],
+ }
+ `),
+ "package-dir/Android.bp": []byte(`
+ gensrcs {
+ name: "module-name",
+ cmd: "mkdir -p $(genDir) && cat $(in) >> $(genDir)/$(out)",
+ srcs: [
+ "src/foo.a.b.c.proto",
+ ":external-protos",
+ ],
+
+ trim_extension: ".a.b.c.proto",
+ }
+ `),
+ }),
+ ).RunTest(t)
+
+ exportedIncludeDir := "out/soong/.intermediates/package-dir/module-name/gen/gensrcs"
+ gen := result.Module("module-name", "").(*Module)
+
+ android.AssertPathsRelativeToTopEquals(
+ t,
+ "include path",
+ []string{exportedIncludeDir},
+ gen.exportedIncludeDirs,
+ )
+ android.AssertPathsRelativeToTopEquals(
+ t,
+ "files",
+ []string{
+ exportedIncludeDir + "/package-dir/src/foo",
+ exportedIncludeDir + "/external-protos/path/baz.a.b.c.proto/baz",
+ exportedIncludeDir + "/external-protos/path/bar",
+ exportedIncludeDir + "/external-protos/path/qux.ext",
+ },
+ gen.outputFiles,
+ )
+}
+
+func TestGenSrcsWithOutpuExtension(t *testing.T) {
+ result := android.GroupFixturePreparers(
+ prepareForGenRuleTest,
+ android.FixtureMergeMockFs(android.MockFS{
+ "external-protos/path/Android.bp": []byte(`
+ filegroup {
+ name: "external-protos",
+ srcs: ["baz/baz.a.b.c.proto", "bar.a.b.c.proto"],
+ }
+ `),
+ "package-dir/Android.bp": []byte(`
+ gensrcs {
+ name: "module-name",
+ cmd: "mkdir -p $(genDir) && cat $(in) >> $(genDir)/$(out)",
+ srcs: [
+ "src/foo.a.b.c.proto",
+ ":external-protos",
+ ],
+
+ output_extension: "proto.h",
+ }
+ `),
+ }),
+ ).RunTest(t)
+
+ exportedIncludeDir := "out/soong/.intermediates/package-dir/module-name/gen/gensrcs"
+ gen := result.Module("module-name", "").(*Module)
+
+ android.AssertPathsRelativeToTopEquals(
+ t,
+ "include path",
+ []string{exportedIncludeDir},
+ gen.exportedIncludeDirs,
+ )
+ android.AssertPathsRelativeToTopEquals(
+ t,
+ "files",
+ []string{
+ exportedIncludeDir + "/package-dir/src/foo.a.b.c.proto.h",
+ exportedIncludeDir + "/external-protos/path/baz/baz.a.b.c.proto.h",
+ exportedIncludeDir + "/external-protos/path/bar.a.b.c.proto.h",
+ },
+ gen.outputFiles,
+ )
+}
+
func TestPrebuiltTool(t *testing.T) {
testcases := []struct {
name string
diff --git a/java/aar.go b/java/aar.go
index 0a91ff4..47c64bf 100644
--- a/java/aar.go
+++ b/java/aar.go
@@ -971,6 +971,9 @@
// will be passed transitively through android_libraries to an android_app.
//TODO(b/241138093) evaluate whether we can have this flag default to true for Bazel conversion
Extract_jni *bool
+
+ // If set, overrides the manifest extracted from the AAR with the provided path.
+ Manifest *string `android:"path"`
}
type AARImport struct {
@@ -993,7 +996,7 @@
exportPackage android.WritablePath
transitiveAaptResourcePackagesFile android.Path
extraAaptPackagesFile android.WritablePath
- manifest android.WritablePath
+ manifest android.Path
assetsPackage android.WritablePath
rTxt android.WritablePath
rJar android.WritablePath
@@ -1169,7 +1172,15 @@
jarName := ctx.ModuleName() + ".jar"
extractedAARDir := android.PathForModuleOut(ctx, "aar")
classpathFile := extractedAARDir.Join(ctx, jarName)
- a.manifest = extractedAARDir.Join(ctx, "AndroidManifest.xml")
+
+ extractedManifest := extractedAARDir.Join(ctx, "AndroidManifest.xml")
+ providedManifest := android.OptionalPathForModuleSrc(ctx, a.properties.Manifest)
+ if providedManifest.Valid() {
+ a.manifest = providedManifest.Path()
+ } else {
+ a.manifest = extractedManifest
+ }
+
a.rTxt = extractedAARDir.Join(ctx, "R.txt")
a.assetsPackage = android.PathForModuleOut(ctx, "assets.zip")
a.proguardFlags = extractedAARDir.Join(ctx, "proguard.txt")
@@ -1190,7 +1201,7 @@
ctx.Build(pctx, android.BuildParams{
Rule: unzipAAR,
Input: a.aarPath,
- Outputs: android.WritablePaths{classpathFile, a.proguardFlags, a.manifest, a.assetsPackage, a.rTxt},
+ Outputs: android.WritablePaths{classpathFile, a.proguardFlags, extractedManifest, a.assetsPackage, a.rTxt},
Description: "unzip AAR",
Args: map[string]string{
"outDir": extractedAARDir.String(),
diff --git a/java/aar_test.go b/java/aar_test.go
index d6dbe3c..18efd20 100644
--- a/java/aar_test.go
+++ b/java/aar_test.go
@@ -15,8 +15,9 @@
package java
import (
- "android/soong/android"
"testing"
+
+ "android/soong/android"
)
func TestAarImportProducesJniPackages(t *testing.T) {
@@ -98,6 +99,7 @@
aconfig_declarations {
name: "bar",
package: "com.example.package.bar",
+ container: "com.android.foo",
srcs: [
"bar.aconfig",
],
@@ -105,6 +107,7 @@
aconfig_declarations {
name: "baz",
package: "com.example.package.baz",
+ container: "com.android.foo",
srcs: [
"baz.aconfig",
],
diff --git a/java/androidmk.go b/java/androidmk.go
index a52d439..9cd0baf 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -92,11 +92,7 @@
ExtraEntries: []android.AndroidMkExtraEntriesFunc{
func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
if len(library.logtagsSrcs) > 0 {
- var logtags []string
- for _, l := range library.logtagsSrcs {
- logtags = append(logtags, l.Rel())
- }
- entries.AddStrings("LOCAL_LOGTAGS_FILES", logtags...)
+ entries.AddStrings("LOCAL_SOONG_LOGTAGS_FILES", library.logtagsSrcs.Strings()...)
}
if library.installFile == nil {
@@ -457,6 +453,8 @@
if app.Name() != "framework-res" {
android.SetAconfigFileMkEntries(&app.ModuleBase, entries, app.mergedAconfigFiles)
}
+
+ entries.AddStrings("LOCAL_SOONG_LOGTAGS_FILES", app.logtagsSrcs.Strings()...)
},
},
ExtraFooters: []android.AndroidMkExtraFootersFunc{
diff --git a/java/app_test.go b/java/app_test.go
index eab40e7..a7c48a1 100644
--- a/java/app_test.go
+++ b/java/app_test.go
@@ -4382,6 +4382,7 @@
aconfig_declarations {
name: "bar",
package: "com.example.package.bar",
+ container: "com.android.foo",
srcs: [
"bar.aconfig",
],
@@ -4389,6 +4390,7 @@
aconfig_declarations {
name: "baz",
package: "com.example.package.baz",
+ container: "com.android.foo",
srcs: [
"baz.aconfig",
],
diff --git a/java/classpath_fragment.go b/java/classpath_fragment.go
index 0ebab4d..07bc5c1 100644
--- a/java/classpath_fragment.go
+++ b/java/classpath_fragment.go
@@ -151,10 +151,14 @@
return jars
}
+func (c *ClasspathFragmentBase) outputFilename() string {
+ return strings.ToLower(c.classpathType.String()) + ".pb"
+}
+
func (c *ClasspathFragmentBase) generateClasspathProtoBuildActions(ctx android.ModuleContext, configuredJars android.ConfiguredJarList, jars []classpathJar) {
generateProto := proptools.BoolDefault(c.properties.Generate_classpaths_proto, true)
if generateProto {
- outputFilename := strings.ToLower(c.classpathType.String()) + ".pb"
+ outputFilename := c.outputFilename()
c.outputFilepath = android.PathForModuleOut(ctx, outputFilename).OutputPath
c.installDirPath = android.PathForModuleInstall(ctx, "etc", "classpaths")
@@ -181,6 +185,10 @@
android.SetProvider(ctx, ClasspathFragmentProtoContentInfoProvider, classpathProtoInfo)
}
+func (c *ClasspathFragmentBase) installClasspathProto(ctx android.ModuleContext) android.InstallPath {
+ return ctx.InstallFile(c.installDirPath, c.outputFilename(), c.outputFilepath)
+}
+
func writeClasspathsTextproto(ctx android.ModuleContext, output android.WritablePath, jars []classpathJar) {
var content strings.Builder
diff --git a/java/droidstubs.go b/java/droidstubs.go
index ffd3caf..730be14 100644
--- a/java/droidstubs.go
+++ b/java/droidstubs.go
@@ -604,6 +604,11 @@
}
}
+// AndroidPlusUpdatableJar is the name of some extra jars added into `module-lib` and
+// `system-server` directories that contain all the APIs provided by the platform and updatable
+// modules because the `android.jar` files do not. See b/337836752.
+const AndroidPlusUpdatableJar = "android-plus-updatable.jar"
+
func (d *Droidstubs) apiLevelsGenerationFlags(ctx android.ModuleContext, cmd *android.RuleBuilderCommand, stubsType StubsType, apiVersionsXml android.WritablePath) {
if len(d.properties.Api_levels_annotations_dirs) == 0 {
ctx.PropertyErrorf("api_levels_annotations_dirs",
@@ -614,25 +619,72 @@
filename := proptools.StringDefault(d.properties.Api_levels_jar_filename, "android.jar")
+ // TODO: Avoid the duplication of API surfaces, reuse apiScope.
+ // Add all relevant --android-jar-pattern patterns for Metalava.
+ // When parsing a stub jar for a specific version, Metalava picks the first pattern that defines
+ // an actual file present on disk (in the order the patterns were passed). For system APIs for
+ // privileged apps that are only defined since API level 21 (Lollipop), fallback to public stubs
+ // for older releases. Similarly, module-lib falls back to system API.
+ var sdkDirs []string
+ apiLevelsSdkType := proptools.StringDefault(d.properties.Api_levels_sdk_type, "public")
+ switch apiLevelsSdkType {
+ case "system-server":
+ sdkDirs = []string{"system-server", "module-lib", "system", "public"}
+ case "module-lib":
+ sdkDirs = []string{"module-lib", "system", "public"}
+ case "system":
+ sdkDirs = []string{"system", "public"}
+ case "public":
+ sdkDirs = []string{"public"}
+ default:
+ ctx.PropertyErrorf("api_levels_sdk_type", "needs to be one of %v", allowedApiLevelSdkTypes)
+ return
+ }
+
+ // Construct a pattern to match the appropriate extensions that should be included in the
+ // generated api-versions.xml file.
+ //
+ // Use the first item in the sdkDirs array as that is the sdk type for the target API levels
+ // being generated but has the advantage over `Api_levels_sdk_type` as it has been validated.
+ // The exception is for system-server which needs to include module-lib and system-server. That
+ // is because while system-server extends module-lib the system-server extension directory only
+ // contains service-* modules which provide system-server APIs it does not list the modules which
+ // only provide a module-lib, so they have to be included separately.
+ extensionSurfacesPattern := sdkDirs[0]
+ if apiLevelsSdkType == "system-server" {
+ // Take the first two items in sdkDirs, which are system-server and module-lib, and construct
+ // a pattern that will match either.
+ extensionSurfacesPattern = strings.Join(sdkDirs[0:2], "|")
+ }
+ extensionsPattern := fmt.Sprintf(`/extensions/[0-9]+/(%s)/.*\.jar`, extensionSurfacesPattern)
+
var dirs []string
var extensions_dir string
ctx.VisitDirectDepsWithTag(metalavaAPILevelsAnnotationsDirTag, func(m android.Module) {
if t, ok := m.(*ExportedDroiddocDir); ok {
- extRegex := regexp.MustCompile(t.dir.String() + `/extensions/[0-9]+/public/.*\.jar`)
+ extRegex := regexp.MustCompile(t.dir.String() + extensionsPattern)
// Grab the first extensions_dir and we find while scanning ExportedDroiddocDir.deps;
// ideally this should be read from prebuiltApis.properties.Extensions_*
for _, dep := range t.deps {
+ // Check to see if it matches an extension first.
+ depBase := dep.Base()
if extRegex.MatchString(dep.String()) && d.properties.Extensions_info_file != nil {
if extensions_dir == "" {
extensions_dir = t.dir.String() + "/extensions"
}
cmd.Implicit(dep)
- }
- if dep.Base() == filename {
+ } else if depBase == filename {
+ // Check to see if it matches a dessert release for an SDK, e.g. Android, Car, Wear, etc..
cmd.Implicit(dep)
- }
- if filename != "android.jar" && dep.Base() == "android.jar" {
+ } else if depBase == AndroidPlusUpdatableJar && d.properties.Extensions_info_file != nil {
+ // The output api-versions.xml has been requested to include information on SDK
+ // extensions. That means it also needs to include
+ // so
+ // The module-lib and system-server directories should use `android-plus-updatable.jar`
+ // instead of `android.jar`. See AndroidPlusUpdatableJar for more information.
+ cmd.Implicit(dep)
+ } else if filename != "android.jar" && depBase == "android.jar" {
// Metalava implicitly searches these patterns:
// prebuilts/tools/common/api-versions/android-%/android.jar
// prebuilts/sdk/%/public/android.jar
@@ -650,29 +702,25 @@
}
})
- // Add all relevant --android-jar-pattern patterns for Metalava.
- // When parsing a stub jar for a specific version, Metalava picks the first pattern that defines
- // an actual file present on disk (in the order the patterns were passed). For system APIs for
- // privileged apps that are only defined since API level 21 (Lollipop), fallback to public stubs
- // for older releases. Similarly, module-lib falls back to system API.
- var sdkDirs []string
- switch proptools.StringDefault(d.properties.Api_levels_sdk_type, "public") {
- case "system-server":
- sdkDirs = []string{"system-server", "module-lib", "system", "public"}
- case "module-lib":
- sdkDirs = []string{"module-lib", "system", "public"}
- case "system":
- sdkDirs = []string{"system", "public"}
- case "public":
- sdkDirs = []string{"public"}
- default:
- ctx.PropertyErrorf("api_levels_sdk_type", "needs to be one of %v", allowedApiLevelSdkTypes)
- return
- }
-
+ // Generate the list of --android-jar-pattern options. The order matters so the first one which
+ // matches will be the one that is used for a specific api level..
for _, sdkDir := range sdkDirs {
for _, dir := range dirs {
- cmd.FlagWithArg("--android-jar-pattern ", fmt.Sprintf("%s/%%/%s/%s", dir, sdkDir, filename))
+ addPattern := func(jarFilename string) {
+ cmd.FlagWithArg("--android-jar-pattern ", fmt.Sprintf("%s/%%/%s/%s", dir, sdkDir, jarFilename))
+ }
+
+ if sdkDir == "module-lib" || sdkDir == "system-server" {
+ // The module-lib and system-server android.jars do not include the updatable modules (as
+ // doing so in the source would introduce dependency cycles and the prebuilts have to
+ // match the sources). So, instead an additional `android-plus-updatable.jar` will be used
+ // that does include the updatable modules and this pattern will match that. This pattern
+ // is added in addition to the following pattern to decouple this change from the change
+ // to add the `android-plus-updatable.jar`.
+ addPattern(AndroidPlusUpdatableJar)
+ }
+
+ addPattern(filename)
}
}
@@ -1322,7 +1370,7 @@
// use a strict naming convention
var (
droidstubsModuleNamingToSdkKind = map[string]android.SdkKind{
- //public is commented out since the core libraries use public in their java_sdk_library names
+ // public is commented out since the core libraries use public in their java_sdk_library names
"intracore": android.SdkIntraCore,
"intra.core": android.SdkIntraCore,
"system_server": android.SdkSystemServer,
diff --git a/java/droidstubs_test.go b/java/droidstubs_test.go
index 8da695f..6a14f36 100644
--- a/java/droidstubs_test.go
+++ b/java/droidstubs_test.go
@@ -379,6 +379,7 @@
aconfig_declarations {
name: "bar",
package: "com.example.package",
+ container: "com.android.foo",
srcs: [
"bar.aconfig",
],
@@ -434,6 +435,7 @@
aconfig_declarations {
name: "bar",
package: "com.example.package",
+ container: "com.android.foo",
srcs: [
"bar.aconfig",
],
diff --git a/java/gen.go b/java/gen.go
index 68a9b53..1b4f4c7 100644
--- a/java/gen.go
+++ b/java/gen.go
@@ -27,7 +27,6 @@
func init() {
pctx.SourcePathVariable("logtagsCmd", "build/make/tools/java-event-log-tags.py")
- pctx.SourcePathVariable("mergeLogtagsCmd", "build/make/tools/merge-event-log-tags.py")
pctx.SourcePathVariable("logtagsLib", "build/make/tools/event_log_tags.py")
}
@@ -37,12 +36,6 @@
Command: "$logtagsCmd -o $out $in",
CommandDeps: []string{"$logtagsCmd", "$logtagsLib"},
})
-
- mergeLogtags = pctx.AndroidStaticRule("mergeLogtags",
- blueprint.RuleParams{
- Command: "$mergeLogtagsCmd -o $out $in",
- CommandDeps: []string{"$mergeLogtagsCmd", "$logtagsLib"},
- })
)
func genAidl(ctx android.ModuleContext, aidlFiles android.Paths, aidlGlobalFlags string, aidlIndividualFlags map[string]string, deps android.Paths) android.Paths {
@@ -178,37 +171,9 @@
outSrcFiles = append(outSrcFiles, srcJarFiles...)
}
+ android.SetProvider(ctx, android.LogtagsProviderKey, &android.LogtagsInfo{
+ Logtags: j.logtagsSrcs,
+ })
+
return outSrcFiles
}
-
-func LogtagsSingleton() android.Singleton {
- return &logtagsSingleton{}
-}
-
-type logtagsProducer interface {
- logtags() android.Paths
-}
-
-func (j *Module) logtags() android.Paths {
- return j.logtagsSrcs
-}
-
-var _ logtagsProducer = (*Module)(nil)
-
-type logtagsSingleton struct{}
-
-func (l *logtagsSingleton) GenerateBuildActions(ctx android.SingletonContext) {
- var allLogtags android.Paths
- ctx.VisitAllModules(func(module android.Module) {
- if logtags, ok := module.(logtagsProducer); ok {
- allLogtags = append(allLogtags, logtags.logtags()...)
- }
- })
-
- ctx.Build(pctx, android.BuildParams{
- Rule: mergeLogtags,
- Description: "merge logtags",
- Output: android.PathForIntermediates(ctx, "all-event-log-tags.txt"),
- Inputs: allLogtags,
- })
-}
diff --git a/java/java.go b/java/java.go
index 725e25a..30581f2 100644
--- a/java/java.go
+++ b/java/java.go
@@ -75,7 +75,6 @@
ctx.BottomUp("jacoco_deps", jacocoDepsMutator).Parallel()
})
- ctx.RegisterParallelSingletonType("logtags", LogtagsSingleton)
ctx.RegisterParallelSingletonType("kythe_java_extract", kytheExtractJavaFactory)
}
diff --git a/java/java_test.go b/java/java_test.go
index a1192bb..2f27932 100644
--- a/java/java_test.go
+++ b/java/java_test.go
@@ -2801,6 +2801,7 @@
aconfig_declarations {
name: "bar",
package: "com.example.package",
+ container: "com.android.foo",
srcs: [
"bar.aconfig",
],
diff --git a/java/lint.go b/java/lint.go
index 31e7f35..82fac91 100644
--- a/java/lint.go
+++ b/java/lint.go
@@ -612,7 +612,7 @@
apiVersionsDb := findModuleOrErr(ctx, files.apiVersionsModule)
if apiVersionsDb == nil {
if !ctx.Config().AllowMissingDependencies() {
- ctx.Errorf("lint: missing module api_versions_public")
+ ctx.Errorf("lint: missing module %s", files.apiVersionsModule)
}
return
}
@@ -620,7 +620,7 @@
sdkAnnotations := findModuleOrErr(ctx, files.annotationsModule)
if sdkAnnotations == nil {
if !ctx.Config().AllowMissingDependencies() {
- ctx.Errorf("lint: missing module sdk-annotations.zip")
+ ctx.Errorf("lint: missing module %s", files.annotationsModule)
}
return
}
diff --git a/java/platform_bootclasspath.go b/java/platform_bootclasspath.go
index 4db426e..b3c9ce5 100644
--- a/java/platform_bootclasspath.go
+++ b/java/platform_bootclasspath.go
@@ -221,6 +221,7 @@
// ART and platform boot jars must have a corresponding entry in DEX2OATBOOTCLASSPATH
classpathJars := configuredJarListToClasspathJars(ctx, configuredJars, BOOTCLASSPATH, DEX2OATBOOTCLASSPATH)
b.classpathFragmentBase().generateClasspathProtoBuildActions(ctx, configuredJars, classpathJars)
+ b.classpathFragmentBase().installClasspathProto(ctx)
}
func (b *platformBootclasspathModule) configuredJars(ctx android.ModuleContext) android.ConfiguredJarList {
diff --git a/java/rro_test.go b/java/rro_test.go
index d697ec6..742c839 100644
--- a/java/rro_test.go
+++ b/java/rro_test.go
@@ -421,6 +421,7 @@
aconfig_declarations {
name: "bar",
package: "com.example.package.bar",
+ container: "com.android.foo",
srcs: [
"bar.aconfig",
],
@@ -428,6 +429,7 @@
aconfig_declarations {
name: "baz",
package: "com.example.package.baz",
+ container: "com.android.foo",
srcs: [
"baz.aconfig",
],
diff --git a/java/sdk_library_test.go b/java/sdk_library_test.go
index 0f163e6..34c63ac 100644
--- a/java/sdk_library_test.go
+++ b/java/sdk_library_test.go
@@ -1715,6 +1715,7 @@
aconfig_declarations {
name: "bar",
package: "com.example.package",
+ container: "com.android.foo",
srcs: [
"bar.aconfig",
],
diff --git a/java/systemserver_classpath_fragment.go b/java/systemserver_classpath_fragment.go
index b291e70..bad2cf1 100644
--- a/java/systemserver_classpath_fragment.go
+++ b/java/systemserver_classpath_fragment.go
@@ -69,6 +69,7 @@
configuredJars = configuredJars.AppendList(&standaloneConfiguredJars)
classpathJars = append(classpathJars, standaloneClasspathJars...)
p.classpathFragmentBase().generateClasspathProtoBuildActions(ctx, configuredJars, classpathJars)
+ p.classpathFragmentBase().installClasspathProto(ctx)
}
func (p *platformSystemServerClasspathModule) configuredJars(ctx android.ModuleContext) android.ConfiguredJarList {
diff --git a/python/scripts/precompile_python.py b/python/scripts/precompile_python.py
index 07b8fe9..b3cf950 100644
--- a/python/scripts/precompile_python.py
+++ b/python/scripts/precompile_python.py
@@ -30,6 +30,7 @@
# Date was chosen to be the same as
# https://cs.android.com/android/platform/superproject/main/+/main:build/soong/jar/jar.go;l=36;drc=2863e4535eb65e15f955dc8ed48fa99b1d2a1db5
info = zipfile.ZipInfo(filename=name, date_time=(2008, 1, 1, 0, 0, 0))
+ info.compress_type = zipfile.ZIP_DEFLATED
if not info.filename.endswith('.py'):
outzip.writestr(info, infile.read())
diff --git a/rust/bindgen.go b/rust/bindgen.go
index eaed1b9..4277753 100644
--- a/rust/bindgen.go
+++ b/rust/bindgen.go
@@ -102,8 +102,17 @@
// "my_bindgen [flags] wrapper_header.h -o [output_path] -- [clang flags]"
Custom_bindgen string
- // flag to indicate if bindgen should handle `static inline` functions (default is false)
- Handle_static_inline bool
+ // flag to indicate if bindgen should handle `static inline` functions (default is false).
+ // If true, Static_inline_library must be set.
+ Handle_static_inline *bool
+
+ // module name of the corresponding cc_library_static which includes the static_inline wrapper
+ // generated functions from bindgen. Must be used together with handle_static_inline.
+ //
+ // If there are no static inline functions provided through the header file,
+ // then bindgen (as of 0.69.2) will silently fail to output a .c file, and
+ // the cc_library_static depending on this module will fail compilation.
+ Static_inline_library *string
}
type bindgenDecorator struct {
@@ -159,6 +168,18 @@
var cflags []string
var implicits android.Paths
+ var implicitOutputs android.WritablePaths
+ var validations android.Paths
+
+ if Bool(b.Properties.Handle_static_inline) && b.Properties.Static_inline_library == nil {
+ ctx.PropertyErrorf("handle_static_inline",
+ "requires declaring static_inline_library to the corresponding cc_library module that includes the generated C source from bindgen.")
+ }
+
+ if b.Properties.Static_inline_library != nil && !Bool(b.Properties.Handle_static_inline) {
+ ctx.PropertyErrorf("static_inline_library",
+ "requires declaring handle_static_inline.")
+ }
implicits = append(implicits, deps.depGeneratedHeaders...)
@@ -235,8 +256,11 @@
bindgenFlags := defaultBindgenFlags
bindgenFlags = append(bindgenFlags, esc(b.Properties.Bindgen_flags)...)
- if b.Properties.Handle_static_inline {
- bindgenFlags = append(bindgenFlags, "--experimental --wrap-static-fns")
+ if Bool(b.Properties.Handle_static_inline) {
+ outputStaticFnsFile := android.PathForModuleOut(ctx, b.BaseSourceProvider.getStem(ctx)+".c")
+ implicitOutputs = append(implicitOutputs, outputStaticFnsFile)
+ validations = append(validations, outputStaticFnsFile)
+ bindgenFlags = append(bindgenFlags, []string{"--experimental", "--wrap-static-fns", "--wrap-static-fns-path=" + outputStaticFnsFile.String()}...)
}
// cat reads from stdin if its command line is empty,
@@ -285,11 +309,13 @@
}
ctx.Build(pctx, android.BuildParams{
- Rule: bindgen,
- Description: strings.Join([]string{cmdDesc, wrapperFile.Path().Rel()}, " "),
- Output: outputFile,
- Input: wrapperFile.Path(),
- Implicits: implicits,
+ Rule: bindgen,
+ Description: strings.Join([]string{cmdDesc, wrapperFile.Path().Rel()}, " "),
+ Output: outputFile,
+ Input: wrapperFile.Path(),
+ Implicits: implicits,
+ ImplicitOutputs: implicitOutputs,
+ Validations: validations,
Args: map[string]string{
"cmd": cmd,
"flags": strings.Join(bindgenFlags, " "),
@@ -299,6 +325,14 @@
})
b.BaseSourceProvider.OutputFiles = android.Paths{outputFile}
+
+ // Append any additional implicit outputs after the entry point source.
+ // We append any generated .c file here so it can picked up by cc_library_static modules.
+ // Those CC modules need to be sure not to pass any included .rs files to Clang.
+ // We don't have to worry about the additional .c files for Rust modules as only the entry point
+ // is passed to rustc.
+ b.BaseSourceProvider.OutputFiles = append(b.BaseSourceProvider.OutputFiles, implicitOutputs.Paths()...)
+
return outputFile
}
@@ -350,6 +384,14 @@
deps = muslDeps(ctx, deps, false)
}
+ if !ctx.RustModule().Source() && b.Properties.Static_inline_library != nil {
+ // This is not the source variant, so add the static inline library as a dependency.
+ //
+ // This is necessary to avoid a circular dependency between the source variant and the
+ // dependent cc module.
+ deps.StaticLibs = append(deps.StaticLibs, String(b.Properties.Static_inline_library))
+ }
+
deps.SharedLibs = append(deps.SharedLibs, b.ClangProperties.Shared_libs...)
deps.StaticLibs = append(deps.StaticLibs, b.ClangProperties.Static_libs...)
deps.HeaderLibs = append(deps.HeaderLibs, b.ClangProperties.Header_libs...)
diff --git a/rust/bindgen_test.go b/rust/bindgen_test.go
index 11cfe4e..2b7362f 100644
--- a/rust/bindgen_test.go
+++ b/rust/bindgen_test.go
@@ -228,7 +228,6 @@
// we may be able to check libbinder.RuleParams.Command to see if it contains $(cat /dev/null flag_file.txt)
}
-
func TestBindgenHandleStaticInlining(t *testing.T) {
ctx := testRust(t, `
rust_bindgen {
@@ -237,12 +236,54 @@
crate_name: "bindgen",
stem: "libbindgen",
source_stem: "bindings",
+ handle_static_inline: true,
+ static_inline_library: "libbindgen_staticfns"
+ }
+
+ cc_library_static {
+ name: "libbindgen_staticfns",
+ srcs: [":libbindgen"],
+ include_dirs: ["src/"],
+ }
+ `)
+ libbindgen := ctx.ModuleForTests("libbindgen", "android_arm64_armv8-a_source").Output("bindings.rs")
+ // Make sure the flag to support `static inline` functions is present
+ if !strings.Contains(libbindgen.Args["flags"], "--wrap-static-fns") {
+ t.Errorf("missing flag to handle static inlining in rust_bindgen rule: flags %#v", libbindgen.Args["flags"])
+ }
+
+ if !strings.Contains(libbindgen.Args["flags"], "--wrap-static-fns-path") {
+ t.Errorf("missing flag to define path for static inlining C source from bindgen (--wrap-static-fns-path): flags %#v", libbindgen.Args["flags"])
+ }
+
+}
+
+func TestBindgenStaticInlineProperties(t *testing.T) {
+ // Make sure handle_static_inline without static_inline_library generates an error
+ testRustError(t, "requires declaring static_inline_library to the corresponding cc_library module that includes the generated C source from bindgen", `
+ rust_bindgen {
+ name: "libbindgen",
+ wrapper_src: "src/any.h",
+ crate_name: "bindgen",
+ stem: "libbindgen",
+ source_stem: "bindings",
handle_static_inline: true
}
`)
- libbindgen := ctx.ModuleForTests("libbindgen", "android_arm64_armv8-a_source").Output("bindings.rs")
- // Make sure the flag to support `static inline` functions is present
- if !strings.Contains(libbindgen.Args["flags"], "--wrap-static-fns") {
- t.Errorf("missing flag to handle static inlining in rust_bindgen rule: flags %#v", libbindgen.Args["flags"])
- }
+ testRustError(t, "requires declaring handle_static_inline", `
+ rust_bindgen {
+ name: "libbindgen",
+ wrapper_src: "src/any.h",
+ crate_name: "bindgen",
+ stem: "libbindgen",
+ source_stem: "bindings",
+ static_inline_library: "libbindgen_staticfns"
+ }
+
+ cc_library_static {
+ name: "libbindgen_staticfns",
+ srcs: [":libbindgen"],
+ include_dirs: ["src/"],
+ }
+ `)
}
diff --git a/rust/config/global.go b/rust/config/global.go
index ba08560..03333b8 100644
--- a/rust/config/global.go
+++ b/rust/config/global.go
@@ -53,6 +53,9 @@
"--color=always",
"-Z dylib-lto",
"-Z link-native-libraries=no",
+
+ // cfg flag to indicate that we are building in AOSP with Soong
+ "--cfg soong",
}
LinuxHostGlobalLinkFlags = []string{
diff --git a/rust/coverage.go b/rust/coverage.go
index bc6504d..91a7806 100644
--- a/rust/coverage.go
+++ b/rust/coverage.go
@@ -39,9 +39,11 @@
func (cov *coverage) deps(ctx DepsContext, deps Deps) Deps {
if cov.Properties.NeedCoverageVariant {
- ctx.AddVariationDependencies([]blueprint.Variation{
- {Mutator: "link", Variation: "static"},
- }, cc.CoverageDepTag, CovLibraryName)
+ if ctx.Device() {
+ ctx.AddVariationDependencies([]blueprint.Variation{
+ {Mutator: "link", Variation: "static"},
+ }, cc.CoverageDepTag, CovLibraryName)
+ }
// no_std modules are missing libprofiler_builtins which provides coverage, so we need to add it as a dependency.
if rustModule, ok := ctx.Module().(*Module); ok && rustModule.compiler.noStdlibs() {
@@ -60,12 +62,14 @@
if cov.Properties.CoverageEnabled {
flags.Coverage = true
- coverage := ctx.GetDirectDepWithTag(CovLibraryName, cc.CoverageDepTag).(cc.LinkableInterface)
flags.RustFlags = append(flags.RustFlags,
"-C instrument-coverage", "-g")
- flags.LinkFlags = append(flags.LinkFlags,
- profileInstrFlag, "-g", coverage.OutputFile().Path().String(), "-Wl,--wrap,open")
- deps.StaticLibs = append(deps.StaticLibs, coverage.OutputFile().Path())
+ if ctx.Device() {
+ coverage := ctx.GetDirectDepWithTag(CovLibraryName, cc.CoverageDepTag).(cc.LinkableInterface)
+ flags.LinkFlags = append(flags.LinkFlags,
+ profileInstrFlag, "-g", coverage.OutputFile().Path().String(), "-Wl,--wrap,open")
+ deps.StaticLibs = append(deps.StaticLibs, coverage.OutputFile().Path())
+ }
// no_std modules are missing libprofiler_builtins which provides coverage, so we need to add it as a dependency.
if rustModule, ok := ctx.Module().(*Module); ok && rustModule.compiler.noStdlibs() {
diff --git a/rust/project_json.go b/rust/project_json.go
index ad9b690..05fc09b 100644
--- a/rust/project_json.go
+++ b/rust/project_json.go
@@ -96,7 +96,7 @@
var childId int
cInfo, known := singleton.knownCrates[rChild.Name()]
if !known {
- childId, ok = singleton.addCrate(ctx, rChild, make(map[string]int))
+ childId, ok = singleton.addCrate(ctx, rChild)
if !ok {
return
}
@@ -128,7 +128,8 @@
// addCrate adds a crate to singleton.project.Crates ensuring that required
// dependencies are also added. It returns the index of the new crate in
// singleton.project.Crates
-func (singleton *projectGeneratorSingleton) addCrate(ctx android.SingletonContext, rModule *Module, deps map[string]int) (int, bool) {
+func (singleton *projectGeneratorSingleton) addCrate(ctx android.SingletonContext, rModule *Module) (int, bool) {
+ deps := make(map[string]int)
rootModule, err := rModule.compiler.checkedCrateRootPath()
if err != nil {
return 0, false
@@ -180,7 +181,7 @@
if cInfo, ok := singleton.knownCrates[module.Name()]; ok {
// If we have a new device variant, override the old one
if !cInfo.Device && rModule.Device() {
- singleton.addCrate(ctx, rModule, cInfo.Deps)
+ singleton.addCrate(ctx, rModule)
return
}
crate := singleton.project.Crates[cInfo.Idx]
@@ -188,7 +189,7 @@
singleton.project.Crates[cInfo.Idx] = crate
return
}
- singleton.addCrate(ctx, rModule, make(map[string]int))
+ singleton.addCrate(ctx, rModule)
}
func (singleton *projectGeneratorSingleton) GenerateBuildActions(ctx android.SingletonContext) {
diff --git a/scripts/gen-kotlin-build-file.py b/scripts/gen-kotlin-build-file.py
index 83b4cd8..99afdca 100644
--- a/scripts/gen-kotlin-build-file.py
+++ b/scripts/gen-kotlin-build-file.py
@@ -79,7 +79,7 @@
elif src.endswith('.kt'):
f.write(' <sources path="%s"/>\n' % path)
else:
- raise RuntimeError('unknown source file type %s' % file)
+ raise RuntimeError(f'unknown source file type {src} from rspfile {rsp_file}')
for rsp_file in args.common_srcs:
for src in NinjaRspFileReader(rsp_file):
diff --git a/scripts/run-soong-tests-with-go-tools.sh b/scripts/run-soong-tests-with-go-tools.sh
index 93c622e..1fbb1fc 100755
--- a/scripts/run-soong-tests-with-go-tools.sh
+++ b/scripts/run-soong-tests-with-go-tools.sh
@@ -74,6 +74,6 @@
(cd "$dir";
eval ${network_jail} -- ${GOROOT}/bin/go build ./...
eval ${network_jail} -- ${GOROOT}/bin/go test ./...
- eval ${network_jail} -- ${GOROOT}/bin/go test -race -short ./...
+ eval ${network_jail} -- ${GOROOT}/bin/go test -race -timeout 20m -short ./...
)
done
diff --git a/tradefed_modules/test_module_config.go b/tradefed_modules/test_module_config.go
index 9127f67..b2d5631 100644
--- a/tradefed_modules/test_module_config.go
+++ b/tradefed_modules/test_module_config.go
@@ -160,35 +160,17 @@
}
-// Any test suites in base should not be repeated in the derived class, except "general-tests".
-// We may restrict derived tests to only be "general-tests" as it doesn't make sense to add a slice
-// of a test to compatibility suite.
+// Ensure at least one test_suite is listed. Ideally it should be general-tests
+// or device-tests, whichever is listed in base and prefer general-tests if both are listed.
+// However this is not enforced yet.
//
-// Returns ErrorMessage, false on problems
-// Returns _, true if okay.
+// Returns true if okay and reports errors via ModuleErrorf.
func (m *testModuleConfigModule) validateTestSuites(ctx android.ModuleContext) bool {
if len(m.tradefedProperties.Test_suites) == 0 {
- ctx.ModuleErrorf("At least one test-suite must be set or this won't run. Use \"general-tests\"")
+ ctx.ModuleErrorf("At least one test-suite must be set or this won't run. Use \"general-tests\" or \"device-tests\"")
return false
}
- derivedSuites := make(map[string]bool)
- // See if any suites in base is also in derived (other than general-tests)
- for _, s := range m.tradefedProperties.Test_suites {
- if s != "general-tests" {
- derivedSuites[s] = true
- }
- }
- if len(derivedSuites) == 0 {
- return true
- }
- for _, baseSuite := range m.provider.TestSuites {
- if derivedSuites[baseSuite] {
- ctx.ModuleErrorf("TestSuite %s exists in the base, do not add it here", baseSuite)
- return false
- }
- }
-
return true
}
diff --git a/tradefed_modules/test_module_config_test.go b/tradefed_modules/test_module_config_test.go
index 6997228..b2049b1 100644
--- a/tradefed_modules/test_module_config_test.go
+++ b/tradefed_modules/test_module_config_test.go
@@ -325,30 +325,6 @@
RunTestWithBp(t, badBp)
}
-func TestModuleConfigHostDuplicateTestSuitesGiveErrors(t *testing.T) {
- badBp := `
- java_test_host {
- name: "base",
- srcs: ["a.java"],
- test_suites: ["general-tests", "some-compat"],
- }
-
- test_module_config_host {
- name: "derived_test",
- base: "base",
- exclude_filters: ["android.test.example.devcodelab.DevCodelabTest#testHelloFail"],
- include_annotations: ["android.platform.test.annotations.LargeTest"],
- test_suites: ["general-tests", "some-compat"],
- }`
-
- android.GroupFixturePreparers(
- java.PrepareForTestWithJavaDefaultModules,
- android.FixtureRegisterWithContext(RegisterTestModuleConfigBuildComponents),
- ).ExtendWithErrorHandler(
- android.FixtureExpectsAtLeastOneErrorMatchingPattern("TestSuite some-compat exists in the base")).
- RunTestWithBp(t, badBp)
-}
-
func TestTestOnlyProvider(t *testing.T) {
t.Parallel()
ctx := android.GroupFixturePreparers(
diff --git a/ui/build/rbe.go b/ui/build/rbe.go
index 5142a41..8fa147f 100644
--- a/ui/build/rbe.go
+++ b/ui/build/rbe.go
@@ -159,12 +159,6 @@
fmt.Fprintln(ctx.Writer, "")
return
}
- if config.GoogleProdCredsExist() {
- return
- }
- fmt.Fprintln(ctx.Writer, "")
- fmt.Fprintln(ctx.Writer, "\033[33mWARNING: Missing LOAS credentials, please run `gcert`. This is required for a successful build execution. See go/rbe-android-default-announcement for more information.\033[0m")
- fmt.Fprintln(ctx.Writer, "")
}
// DumpRBEMetrics creates a metrics protobuf file containing RBE related metrics.