Merge "release_config: Do not force ranking in inheritance graph" into main
diff --git a/android/config.go b/android/config.go
index 5a6d40f..a18cb8b 100644
--- a/android/config.go
+++ b/android/config.go
@@ -370,6 +370,7 @@
} else {
// Make a decoder for it
jsonDecoder := json.NewDecoder(configFileReader)
+ jsonDecoder.DisallowUnknownFields()
err = jsonDecoder.Decode(configurable)
if err != nil {
return fmt.Errorf("config file: %s did not parse correctly: %s", filename, err.Error())
@@ -1333,10 +1334,6 @@
return c.productVariables.SourceRootDirs
}
-func (c *config) IncludeTags() []string {
- return c.productVariables.IncludeTags
-}
-
func (c *config) HostStaticBinaries() bool {
return Bool(c.productVariables.HostStaticBinaries)
}
@@ -1912,10 +1909,10 @@
}
func (c *deviceConfig) ShippingApiLevel() ApiLevel {
- if c.config.productVariables.ShippingApiLevel == nil {
+ if c.config.productVariables.Shipping_api_level == nil {
return NoneApiLevel
}
- apiLevel, _ := strconv.Atoi(*c.config.productVariables.ShippingApiLevel)
+ apiLevel, _ := strconv.Atoi(*c.config.productVariables.Shipping_api_level)
return uncheckedFinalApiLevel(apiLevel)
}
diff --git a/android/module.go b/android/module.go
index fed1d0e..dc585d2 100644
--- a/android/module.go
+++ b/android/module.go
@@ -915,6 +915,10 @@
// moduleInfoJSON can be filled out by GenerateAndroidBuildActions to write a JSON file that will
// be included in the final module-info.json produced by Make.
moduleInfoJSON *ModuleInfoJSON
+
+ // outputFiles stores the output of a module by tag and is used to set
+ // the OutputFilesProvider in GenerateBuildActions
+ outputFiles OutputFilesInfo
}
func (m *ModuleBase) AddJSONData(d *map[string]interface{}) {
@@ -1996,6 +2000,10 @@
m.buildParams = ctx.buildParams
m.ruleParams = ctx.ruleParams
m.variables = ctx.variables
+
+ if m.outputFiles.DefaultOutputFiles != nil || m.outputFiles.TaggedOutputFiles != nil {
+ SetProvider(ctx, OutputFilesProvider, m.outputFiles)
+ }
}
func SetJarJarPrefixHandler(handler func(ModuleContext)) {
@@ -2445,11 +2453,15 @@
}
func outputFilesForModule(ctx PathContext, module blueprint.Module, tag string) (Paths, error) {
+ outputFilesFromProvider, err := outputFilesForModuleFromProvider(ctx, module, tag)
+ if outputFilesFromProvider != nil || err != nil {
+ return outputFilesFromProvider, err
+ }
if outputFileProducer, ok := module.(OutputFileProducer); ok {
paths, err := outputFileProducer.OutputFiles(tag)
if err != nil {
- return nil, fmt.Errorf("failed to get output file from module %q: %s",
- pathContextName(ctx, module), err.Error())
+ return nil, fmt.Errorf("failed to get output file from module %q at tag %q: %s",
+ pathContextName(ctx, module), tag, err.Error())
}
return paths, nil
} else if sourceFileProducer, ok := module.(SourceFileProducer); ok {
@@ -2459,10 +2471,54 @@
paths := sourceFileProducer.Srcs()
return paths, nil
} else {
- return nil, fmt.Errorf("module %q is not an OutputFileProducer", pathContextName(ctx, module))
+ return nil, fmt.Errorf("module %q is not an OutputFileProducer or SourceFileProducer", pathContextName(ctx, module))
}
}
+// This method uses OutputFilesProvider for output files
+// *inter-module-communication*.
+// If mctx module is the same as the param module the output files are obtained
+// from outputFiles property of module base, to avoid both setting and
+// reading OutputFilesProvider before GenerateBuildActions is finished. Also
+// only empty-string-tag is supported in this case.
+// If a module doesn't have the OutputFilesProvider, nil is returned.
+func outputFilesForModuleFromProvider(ctx PathContext, module blueprint.Module, tag string) (Paths, error) {
+ // TODO: support OutputFilesProvider for singletons
+ mctx, ok := ctx.(ModuleContext)
+ if !ok {
+ return nil, nil
+ }
+ if mctx.Module() != module {
+ if outputFilesProvider, ok := OtherModuleProvider(mctx, module, OutputFilesProvider); ok {
+ if tag == "" {
+ return outputFilesProvider.DefaultOutputFiles, nil
+ } else if taggedOutputFiles, hasTag := outputFilesProvider.TaggedOutputFiles[tag]; hasTag {
+ return taggedOutputFiles, nil
+ } else {
+ return nil, fmt.Errorf("unsupported module reference tag %q", tag)
+ }
+ }
+ } else {
+ if tag == "" {
+ return mctx.Module().base().outputFiles.DefaultOutputFiles, nil
+ } else {
+ return nil, fmt.Errorf("unsupported tag %q for module getting its own output files", tag)
+ }
+ }
+ // TODO: Add a check for param module not having OutputFilesProvider set
+ return nil, nil
+}
+
+type OutputFilesInfo struct {
+ // default output files when tag is an empty string ""
+ DefaultOutputFiles Paths
+
+ // the corresponding output files for given tags
+ TaggedOutputFiles map[string]Paths
+}
+
+var OutputFilesProvider = blueprint.NewProvider[OutputFilesInfo]()
+
// Modules can implement HostToolProvider and return a valid OptionalPath from HostToolPath() to
// specify that they can be used as a tool by a genrule module.
type HostToolProvider interface {
diff --git a/android/module_context.go b/android/module_context.go
index 18adb30..591e270 100644
--- a/android/module_context.go
+++ b/android/module_context.go
@@ -212,6 +212,10 @@
// GenerateAndroidBuildActions. If it is called then the struct will be written out and included in
// the module-info.json generated by Make, and Make will not generate its own data for this module.
ModuleInfoJSON() *ModuleInfoJSON
+
+ // SetOutputFiles stores the outputFiles to outputFiles property, which is used
+ // to set the OutputFilesProvider later.
+ SetOutputFiles(outputFiles Paths, tag string)
}
type moduleContext struct {
@@ -707,6 +711,24 @@
return moduleInfoJSON
}
+func (m *moduleContext) SetOutputFiles(outputFiles Paths, tag string) {
+ if tag == "" {
+ if len(m.module.base().outputFiles.DefaultOutputFiles) > 0 {
+ m.ModuleErrorf("Module %s default OutputFiles cannot be overwritten", m.ModuleName())
+ }
+ m.module.base().outputFiles.DefaultOutputFiles = outputFiles
+ } else {
+ if m.module.base().outputFiles.TaggedOutputFiles == nil {
+ m.module.base().outputFiles.TaggedOutputFiles = make(map[string]Paths)
+ }
+ if _, exists := m.module.base().outputFiles.TaggedOutputFiles[tag]; exists {
+ m.ModuleErrorf("Module %s OutputFiles at tag %s cannot be overwritten", m.ModuleName(), tag)
+ } else {
+ m.module.base().outputFiles.TaggedOutputFiles[tag] = outputFiles
+ }
+ }
+}
+
// Returns a list of paths expanded from globs and modules referenced using ":module" syntax. The property must
// be tagged with `android:"path" to support automatic source module dependency resolution.
//
diff --git a/android/paths.go b/android/paths.go
index 8d92aa4..edc0700 100644
--- a/android/paths.go
+++ b/android/paths.go
@@ -565,21 +565,15 @@
if aModule, ok := module.(Module); ok && !aModule.Enabled(ctx) {
return nil, missingDependencyError{[]string{moduleName}}
}
- if outProducer, ok := module.(OutputFileProducer); ok {
- outputFiles, err := outProducer.OutputFiles(tag)
- if err != nil {
- return nil, fmt.Errorf("path dependency %q: %s", path, err)
- }
- return outputFiles, nil
- } else if tag != "" {
- return nil, fmt.Errorf("path dependency %q is not an output file producing module", path)
- } else if goBinary, ok := module.(bootstrap.GoBinaryTool); ok {
+ if goBinary, ok := module.(bootstrap.GoBinaryTool); ok && tag == "" {
goBinaryPath := PathForGoBinary(ctx, goBinary)
return Paths{goBinaryPath}, nil
- } else if srcProducer, ok := module.(SourceFileProducer); ok {
- return srcProducer.Srcs(), nil
+ }
+ outputFiles, err := outputFilesForModule(ctx, module, tag)
+ if outputFiles != nil && err == nil {
+ return outputFiles, nil
} else {
- return nil, fmt.Errorf("path dependency %q is not a source file producing module", path)
+ return nil, err
}
}
diff --git a/android/register.go b/android/register.go
index aeb3b4c..eb6a35e 100644
--- a/android/register.go
+++ b/android/register.go
@@ -156,7 +156,6 @@
func NewContext(config Config) *Context {
ctx := &Context{blueprint.NewContext(), config}
ctx.SetSrcDir(absSrcDir)
- ctx.AddIncludeTags(config.IncludeTags()...)
ctx.AddSourceRootDirs(config.SourceRootDirs()...)
return ctx
}
diff --git a/android/test_config.go b/android/test_config.go
index a15343a..f251038 100644
--- a/android/test_config.go
+++ b/android/test_config.go
@@ -50,7 +50,7 @@
AAPTCharacteristics: stringPtr("nosdcard"),
AAPTPrebuiltDPI: []string{"xhdpi", "xxhdpi"},
UncompressPrivAppDex: boolPtr(true),
- ShippingApiLevel: stringPtr("30"),
+ Shipping_api_level: stringPtr("30"),
},
outDir: buildDir,
diff --git a/android/variable.go b/android/variable.go
index 9a95563..1633816 100644
--- a/android/variable.go
+++ b/android/variable.go
@@ -55,6 +55,10 @@
Base_dir *string
}
+ Shipping_api_level struct {
+ Cflags []string
+ }
+
// unbundled_build is a catch-all property to annotate modules that don't build in one or
// more unbundled branches, usually due to dependencies missing from the manifest.
Unbundled_build struct {
@@ -440,7 +444,7 @@
PrebuiltHiddenApiDir *string `json:",omitempty"`
- ShippingApiLevel *string `json:",omitempty"`
+ Shipping_api_level *string `json:",omitempty"`
BuildBrokenPluginValidation []string `json:",omitempty"`
BuildBrokenClangAsFlags bool `json:",omitempty"`
@@ -472,7 +476,6 @@
IgnorePrefer32OnDevice bool `json:",omitempty"`
- IncludeTags []string `json:",omitempty"`
SourceRootDirs []string `json:",omitempty"`
AfdoProfiles []string `json:",omitempty"`
diff --git a/apex/apex.go b/apex/apex.go
index 1dec61b..e79afad 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -2112,7 +2112,7 @@
}
case bpfTag:
if bpfProgram, ok := child.(bpf.BpfModule); ok {
- filesToCopy, _ := bpfProgram.OutputFiles("")
+ filesToCopy := android.OutputFilesForModule(ctx, bpfProgram, "")
apex_sub_dir := bpfProgram.SubDir()
for _, bpfFile := range filesToCopy {
vctx.filesInfo = append(vctx.filesInfo, apexFileForBpfProgram(ctx, bpfFile, apex_sub_dir, bpfProgram))
diff --git a/apex/bootclasspath_fragment_test.go b/apex/bootclasspath_fragment_test.go
index 778c20a..af9123e 100644
--- a/apex/bootclasspath_fragment_test.go
+++ b/apex/bootclasspath_fragment_test.go
@@ -197,6 +197,12 @@
updatable: false,
}
+ override_apex {
+ name: "com.mycompany.android.art",
+ base: "com.android.art",
+ min_sdk_version: "33", // mycompany overrides the min_sdk_version
+ }
+
apex_key {
name: "com.android.art.key",
public_key: "testkey.avbpubkey",
@@ -325,6 +331,26 @@
checkCopiesToPredefinedLocationForArt(t, result.Config, module, "bar", "foo")
})
+ t.Run("boot image files from source of override apex", func(t *testing.T) {
+ result := android.GroupFixturePreparers(
+ commonPreparer,
+
+ // Configure some libraries in the art bootclasspath_fragment that match the source
+ // bootclasspath_fragment's contents property.
+ java.FixtureConfigureBootJars("com.android.art:foo", "com.android.art:bar"),
+ dexpreopt.FixtureSetTestOnlyArtBootImageJars("com.android.art:foo", "com.android.art:bar"),
+ addSource("foo", "bar"),
+ java.FixtureSetBootImageInstallDirOnDevice("art", "apex/com.android.art/javalib"),
+ ).RunTest(t)
+
+ ensureExactContents(t, result.TestContext, "com.android.art", "android_common_com.mycompany.android.art_com.mycompany.android.art", []string{
+ "etc/boot-image.prof",
+ "etc/classpaths/bootclasspath.pb",
+ "javalib/bar.jar",
+ "javalib/foo.jar",
+ })
+ })
+
t.Run("generate boot image profile even if dexpreopt is disabled", func(t *testing.T) {
result := android.GroupFixturePreparers(
commonPreparer,
diff --git a/bpf/bpf.go b/bpf/bpf.go
index 38fbd88..2eb869e 100644
--- a/bpf/bpf.go
+++ b/bpf/bpf.go
@@ -65,8 +65,6 @@
type BpfModule interface {
android.Module
- OutputFiles(tag string) (android.Paths, error)
-
// Returns the sub install directory if the bpf module is included by apex.
SubDir() string
}
@@ -213,6 +211,8 @@
}
android.SetProvider(ctx, blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: srcs.Strings()})
+
+ ctx.SetOutputFiles(bpf.objs, "")
}
func (bpf *bpf) AndroidMk() android.AndroidMkData {
@@ -255,23 +255,10 @@
}
}
-// Implements OutputFileFileProducer interface so that the obj output can be used in the data property
-// of other modules.
-func (bpf *bpf) OutputFiles(tag string) (android.Paths, error) {
- switch tag {
- case "":
- return bpf.objs, nil
- default:
- return nil, fmt.Errorf("unsupported module reference tag %q", tag)
- }
-}
-
func (bpf *bpf) SubDir() string {
return bpf.properties.Sub_dir
}
-var _ android.OutputFileProducer = (*bpf)(nil)
-
func BpfFactory() android.Module {
module := &bpf{}
diff --git a/cmd/soong_build/main.go b/cmd/soong_build/main.go
index 4490dd2..3dac8bd 100644
--- a/cmd/soong_build/main.go
+++ b/cmd/soong_build/main.go
@@ -98,7 +98,6 @@
ctx := android.NewContext(configuration)
ctx.SetNameInterface(newNameResolver(configuration))
ctx.SetAllowMissingDependencies(configuration.AllowMissingDependencies())
- ctx.AddIncludeTags(configuration.IncludeTags()...)
ctx.AddSourceRootDirs(configuration.SourceRootDirs()...)
return ctx
}
diff --git a/java/bootclasspath_fragment.go b/java/bootclasspath_fragment.go
index 4d3d794..16209b7 100644
--- a/java/bootclasspath_fragment.go
+++ b/java/bootclasspath_fragment.go
@@ -524,10 +524,16 @@
}
// Bootclasspath fragment modules that are for the platform do not produce boot related files.
- apexInfo, _ := android.ModuleProvider(ctx, android.ApexInfoProvider)
- for _, apex := range apexInfo.InApexVariants {
- if isProfileProviderApex(ctx, apex) {
- return apex
+ apexInfos, _ := android.ModuleProvider(ctx, android.AllApexInfoProvider)
+ if apexInfos == nil {
+ return ""
+ }
+
+ for _, apexInfo := range apexInfos.ApexInfos {
+ for _, apex := range apexInfo.InApexVariants {
+ if isProfileProviderApex(ctx, apex) {
+ return apex
+ }
}
}
diff --git a/java/sdk_library_test.go b/java/sdk_library_test.go
index d240e70..39f8c76 100644
--- a/java/sdk_library_test.go
+++ b/java/sdk_library_test.go
@@ -492,7 +492,7 @@
PrepareForTestWithJavaSdkLibraryFiles,
FixtureWithLastReleaseApis("foo"),
).
- ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(`module "bar" variant "android_common": path dependency ":foo{.public.annotations.zip}": annotations.zip not available for api scope public`)).
+ ExtendWithErrorHandler(android.FixtureExpectsAtLeastOneErrorMatchingPattern(`module "bar" variant "android_common": failed to get output file from module "foo" at tag ".public.annotations.zip": annotations.zip not available for api scope public`)).
RunTestWithBp(t, `
java_sdk_library {
name: "foo",
diff --git a/ui/build/config.go b/ui/build/config.go
index 7426a78..feded1c 100644
--- a/ui/build/config.go
+++ b/ui/build/config.go
@@ -1164,14 +1164,6 @@
c.sourceRootDirs = i
}
-func (c *configImpl) GetIncludeTags() []string {
- return c.includeTags
-}
-
-func (c *configImpl) SetIncludeTags(i []string) {
- c.includeTags = i
-}
-
func (c *configImpl) GetLogsPrefix() string {
return c.logsPrefix
}
diff --git a/ui/build/dumpvars.go b/ui/build/dumpvars.go
index e17bd54..6691db8 100644
--- a/ui/build/dumpvars.go
+++ b/ui/build/dumpvars.go
@@ -301,6 +301,5 @@
config.SetBuildBrokenDupRules(makeVars["BUILD_BROKEN_DUP_RULES"] == "true")
config.SetBuildBrokenUsesNetwork(makeVars["BUILD_BROKEN_USES_NETWORK"] == "true")
config.SetBuildBrokenNinjaUsesEnvVars(strings.Fields(makeVars["BUILD_BROKEN_NINJA_USES_ENV_VARS"]))
- config.SetIncludeTags(strings.Fields(makeVars["PRODUCT_INCLUDE_TAGS"]))
config.SetSourceRootDirs(strings.Fields(makeVars["PRODUCT_SOURCE_ROOT_DIRS"]))
}
diff --git a/ui/build/soong.go b/ui/build/soong.go
index 9955b1f..2f3150d 100644
--- a/ui/build/soong.go
+++ b/ui/build/soong.go
@@ -401,7 +401,6 @@
}
blueprintCtx := blueprint.NewContext()
- blueprintCtx.AddIncludeTags(config.GetIncludeTags()...)
blueprintCtx.AddSourceRootDirs(config.GetSourceRootDirs()...)
blueprintCtx.SetIgnoreUnknownModuleTypes(true)
blueprintConfig := BlueprintConfig{