Merge "Add container property to aconfig_declarations." into main am: 9dc6b1025d
am: 4d6d371aee
am: 34b5c38c44
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/2835990 Change-Id: Ibeed93cf217168eeecf9568d1c3c3a5ee568327f Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -9,6 +9,7 @@ bootstrap_go_package {
|
||||
"blueprint",
|
||||
"blueprint-pathtools",
|
||||
"soong",
|
||||
"soong-aconfig",
|
||||
"soong-android",
|
||||
"soong-bazel",
|
||||
"soong-cc",
|
||||
|
@@ -128,8 +128,8 @@ func (library *Library) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
if library.dexpreopter.configPath != nil {
|
||||
entries.SetPath("LOCAL_SOONG_DEXPREOPT_CONFIG", library.dexpreopter.configPath)
|
||||
}
|
||||
|
||||
entries.SetOptionalPaths("LOCAL_ACONFIG_FILES", library.getTransitiveAconfigFiles().ToList())
|
||||
// TODO(b/311155208): The container here should be system.
|
||||
entries.SetOptionalPaths("LOCAL_ACONFIG_FILES", library.getTransitiveAconfigFiles(""))
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -306,7 +306,8 @@ func (binary *Binary) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
if len(binary.dexpreopter.builtInstalled) > 0 {
|
||||
entries.SetString("LOCAL_SOONG_BUILT_INSTALLED", binary.dexpreopter.builtInstalled)
|
||||
}
|
||||
entries.SetOptionalPaths("LOCAL_ACONFIG_FILES", binary.getTransitiveAconfigFiles().ToList())
|
||||
// TODO(b/311155208): The container here should be system.
|
||||
entries.SetOptionalPaths("LOCAL_ACONFIG_FILES", binary.getTransitiveAconfigFiles(""))
|
||||
},
|
||||
},
|
||||
ExtraFooters: []android.AndroidMkExtraFootersFunc{
|
||||
@@ -459,7 +460,8 @@ func (app *AndroidApp) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
entries.SetOptionalPaths("LOCAL_SOONG_LINT_REPORTS", app.linter.reports)
|
||||
|
||||
if app.Name() != "framework-res" {
|
||||
entries.SetOptionalPaths("LOCAL_ACONFIG_FILES", app.getTransitiveAconfigFiles().ToList())
|
||||
// TODO(b/311155208): The container here should be system.
|
||||
entries.SetOptionalPaths("LOCAL_ACONFIG_FILES", app.getTransitiveAconfigFiles(""))
|
||||
}
|
||||
},
|
||||
},
|
||||
@@ -537,7 +539,8 @@ func (a *AndroidLibrary) AndroidMkEntries() []android.AndroidMkEntries {
|
||||
entries.SetPath("LOCAL_FULL_MANIFEST_FILE", a.mergedManifestFile)
|
||||
entries.SetPath("LOCAL_SOONG_EXPORT_PROGUARD_FLAGS", a.combinedExportedProguardFlagsFile)
|
||||
entries.SetBoolIfTrue("LOCAL_UNINSTALLABLE_MODULE", true)
|
||||
entries.SetOptionalPaths("LOCAL_ACONFIG_FILES", a.getTransitiveAconfigFiles().ToList())
|
||||
// TODO(b/311155208): The container here should be system.
|
||||
entries.SetOptionalPaths("LOCAL_ACONFIG_FILES", a.getTransitiveAconfigFiles(""))
|
||||
})
|
||||
|
||||
return entriesList
|
||||
|
41
java/base.go
41
java/base.go
@@ -25,6 +25,7 @@ import (
|
||||
"github.com/google/blueprint/pathtools"
|
||||
"github.com/google/blueprint/proptools"
|
||||
|
||||
"android/soong/aconfig"
|
||||
"android/soong/android"
|
||||
"android/soong/dexpreopt"
|
||||
"android/soong/java/config"
|
||||
@@ -512,13 +513,8 @@ type Module struct {
|
||||
// or the module should override Stem().
|
||||
stem string
|
||||
|
||||
// Aconfig "cache files" that went directly into this module. Transitive ones are
|
||||
// tracked via JavaInfo.TransitiveAconfigFiles
|
||||
// TODO: Extract to something standalone to propagate tags via GeneratedJavaLibraryModule
|
||||
aconfigIntermediates android.Paths
|
||||
|
||||
// Aconfig files for all transitive deps. Also exposed via JavaInfo
|
||||
transitiveAconfigFiles *android.DepSet[android.Path]
|
||||
// Aconfig files for all transitive deps. Also exposed via TransitiveDeclarationsInfo
|
||||
transitiveAconfigFiles map[string]*android.DepSet[android.Path]
|
||||
}
|
||||
|
||||
func (j *Module) CheckStableSdkVersion(ctx android.BaseModuleContext) error {
|
||||
@@ -1723,7 +1719,7 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
|
||||
|
||||
ctx.CheckbuildFile(outputFile)
|
||||
|
||||
j.collectTransitiveAconfigFiles(ctx)
|
||||
aconfig.CollectTransitiveAconfigFiles(ctx, &j.transitiveAconfigFiles)
|
||||
|
||||
ctx.SetProvider(JavaInfoProvider, JavaInfo{
|
||||
HeaderJars: android.PathsIfNonNil(j.headerJarFile),
|
||||
@@ -1740,7 +1736,6 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
|
||||
ExportedPluginClasses: j.exportedPluginClasses,
|
||||
ExportedPluginDisableTurbine: j.exportedDisableTurbine,
|
||||
JacocoReportClassesFile: j.jacocoReportClassesFile,
|
||||
TransitiveAconfigFiles: j.transitiveAconfigFiles,
|
||||
})
|
||||
|
||||
// Save the output file with no relative path so that it doesn't end up in a subdirectory when used as a resource
|
||||
@@ -2081,32 +2076,8 @@ func (j *Module) IsInstallable() bool {
|
||||
return Bool(j.properties.Installable)
|
||||
}
|
||||
|
||||
func (j *Module) collectTransitiveAconfigFiles(ctx android.ModuleContext) {
|
||||
// Aconfig files from this module
|
||||
mine := j.aconfigIntermediates
|
||||
|
||||
// Aconfig files from transitive dependencies
|
||||
fromDeps := []*android.DepSet[android.Path]{}
|
||||
ctx.VisitDirectDeps(func(module android.Module) {
|
||||
dep := ctx.OtherModuleProvider(module, JavaInfoProvider).(JavaInfo)
|
||||
if dep.TransitiveAconfigFiles != nil {
|
||||
fromDeps = append(fromDeps, dep.TransitiveAconfigFiles)
|
||||
}
|
||||
})
|
||||
|
||||
// DepSet containing aconfig files myself and from dependencies
|
||||
j.transitiveAconfigFiles = android.NewDepSet(android.POSTORDER, mine, fromDeps)
|
||||
}
|
||||
|
||||
func (j *Module) AddAconfigIntermediate(path android.Path) {
|
||||
j.aconfigIntermediates = append(j.aconfigIntermediates, path)
|
||||
}
|
||||
|
||||
func (j *Module) getTransitiveAconfigFiles() *android.DepSet[android.Path] {
|
||||
if j.transitiveAconfigFiles == nil {
|
||||
panic(fmt.Errorf("java.Moduile: getTransitiveAconfigFiles called before collectTransitiveAconfigFiles module=%s", j.Name()))
|
||||
}
|
||||
return j.transitiveAconfigFiles
|
||||
func (j *Module) getTransitiveAconfigFiles(container string) []android.Path {
|
||||
return j.transitiveAconfigFiles[container].ToList()
|
||||
}
|
||||
|
||||
type sdkLinkType int
|
||||
|
@@ -37,7 +37,6 @@ func (callbacks *JavaGenLibTestCallbacks) DepsMutator(module *GeneratedJavaLibra
|
||||
}
|
||||
|
||||
func (callbacks *JavaGenLibTestCallbacks) GenerateSourceJarBuildActions(module *GeneratedJavaLibraryModule, ctx android.ModuleContext) android.Path {
|
||||
module.AddAconfigIntermediate(android.PathForOutput(ctx, "aconfig_cache_file"))
|
||||
return android.PathForOutput(ctx, "blah.srcjar")
|
||||
}
|
||||
|
||||
|
@@ -297,15 +297,6 @@ type JavaInfo struct {
|
||||
// JacocoReportClassesFile is the path to a jar containing uninstrumented classes that will be
|
||||
// instrumented by jacoco.
|
||||
JacocoReportClassesFile android.Path
|
||||
|
||||
// set of aconfig flags for all transitive libs deps
|
||||
// TODO(joeo): It would be nice if this were over in the aconfig package instead of here.
|
||||
// In order to do that, generated_java_library would need a way doing
|
||||
// collectTransitiveAconfigFiles with one of the callbacks, and having that automatically
|
||||
// propagated. If we were to clean up more of the stuff on JavaInfo that's not part of
|
||||
// core java rules (e.g. AidlIncludeDirs), then maybe adding more framework to do that would be
|
||||
// worth it.
|
||||
TransitiveAconfigFiles *android.DepSet[android.Path]
|
||||
}
|
||||
|
||||
var JavaInfoProvider = blueprint.NewProvider(JavaInfo{})
|
||||
|
Reference in New Issue
Block a user