Propagate intermediateCacheFiles in java modules and filegroup
This change propagates the intermediateCacheFiles generated by the aconfig_declarations to the static rdeps that are java modules or the rdeps that are filegroups. Test: m nothing Bug: 329284345 Change-Id: I02431336c1aa0378d03248f3bb6edf2f57ec3b7f
This commit is contained in:
parent
f11f786571
commit
705e63e362
3 changed files with 53 additions and 24 deletions
|
@ -15,6 +15,7 @@
|
|||
package android
|
||||
|
||||
import (
|
||||
"maps"
|
||||
"strings"
|
||||
|
||||
"github.com/google/blueprint"
|
||||
|
@ -97,6 +98,25 @@ func (fg *fileGroup) GenerateAndroidBuildActions(ctx ModuleContext) {
|
|||
}
|
||||
SetProvider(ctx, blueprint.SrcsFileProviderKey, blueprint.SrcsFileProviderData{SrcPaths: fg.srcs.Strings()})
|
||||
CollectDependencyAconfigFiles(ctx, &fg.mergedAconfigFiles)
|
||||
|
||||
var aconfigDeclarations []string
|
||||
var intermediateCacheOutputPaths Paths
|
||||
var srcjars Paths
|
||||
modeInfos := make(map[string]ModeInfo)
|
||||
ctx.VisitDirectDeps(func(module Module) {
|
||||
if dep, ok := OtherModuleProvider(ctx, module, CodegenInfoProvider); ok {
|
||||
aconfigDeclarations = append(aconfigDeclarations, dep.AconfigDeclarations...)
|
||||
intermediateCacheOutputPaths = append(intermediateCacheOutputPaths, dep.IntermediateCacheOutputPaths...)
|
||||
srcjars = append(srcjars, dep.Srcjars...)
|
||||
maps.Copy(modeInfos, dep.ModeInfos)
|
||||
}
|
||||
})
|
||||
SetProvider(ctx, CodegenInfoProvider, CodegenInfo{
|
||||
AconfigDeclarations: aconfigDeclarations,
|
||||
IntermediateCacheOutputPaths: intermediateCacheOutputPaths,
|
||||
Srcjars: srcjars,
|
||||
ModeInfos: modeInfos,
|
||||
})
|
||||
}
|
||||
|
||||
func (fg *fileGroup) Srcs() Paths {
|
||||
|
|
53
java/base.go
53
java/base.go
|
@ -1219,14 +1219,15 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
|
|||
}
|
||||
|
||||
android.SetProvider(ctx, JavaInfoProvider, JavaInfo{
|
||||
HeaderJars: android.PathsIfNonNil(j.headerJarFile),
|
||||
TransitiveLibsHeaderJars: j.transitiveLibsHeaderJars,
|
||||
TransitiveStaticLibsHeaderJars: j.transitiveStaticLibsHeaderJars,
|
||||
AidlIncludeDirs: j.exportAidlIncludeDirs,
|
||||
ExportedPlugins: j.exportedPluginJars,
|
||||
ExportedPluginClasses: j.exportedPluginClasses,
|
||||
ExportedPluginDisableTurbine: j.exportedDisableTurbine,
|
||||
StubsLinkType: j.stubsLinkType,
|
||||
HeaderJars: android.PathsIfNonNil(j.headerJarFile),
|
||||
TransitiveLibsHeaderJars: j.transitiveLibsHeaderJars,
|
||||
TransitiveStaticLibsHeaderJars: j.transitiveStaticLibsHeaderJars,
|
||||
AidlIncludeDirs: j.exportAidlIncludeDirs,
|
||||
ExportedPlugins: j.exportedPluginJars,
|
||||
ExportedPluginClasses: j.exportedPluginClasses,
|
||||
ExportedPluginDisableTurbine: j.exportedDisableTurbine,
|
||||
StubsLinkType: j.stubsLinkType,
|
||||
AconfigIntermediateCacheOutputPaths: deps.aconfigProtoFiles,
|
||||
})
|
||||
|
||||
j.outputFile = j.headerJarFile
|
||||
|
@ -1729,22 +1730,23 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars, extraClasspath
|
|||
android.CollectDependencyAconfigFiles(ctx, &j.mergedAconfigFiles)
|
||||
|
||||
android.SetProvider(ctx, JavaInfoProvider, JavaInfo{
|
||||
HeaderJars: android.PathsIfNonNil(j.headerJarFile),
|
||||
RepackagedHeaderJars: android.PathsIfNonNil(j.repackagedHeaderJarFile),
|
||||
TransitiveLibsHeaderJars: j.transitiveLibsHeaderJars,
|
||||
TransitiveStaticLibsHeaderJars: j.transitiveStaticLibsHeaderJars,
|
||||
ImplementationAndResourcesJars: android.PathsIfNonNil(j.implementationAndResourcesJar),
|
||||
ImplementationJars: android.PathsIfNonNil(j.implementationJarFile),
|
||||
ResourceJars: android.PathsIfNonNil(j.resourceJar),
|
||||
AidlIncludeDirs: j.exportAidlIncludeDirs,
|
||||
SrcJarArgs: j.srcJarArgs,
|
||||
SrcJarDeps: j.srcJarDeps,
|
||||
TransitiveSrcFiles: j.transitiveSrcFiles,
|
||||
ExportedPlugins: j.exportedPluginJars,
|
||||
ExportedPluginClasses: j.exportedPluginClasses,
|
||||
ExportedPluginDisableTurbine: j.exportedDisableTurbine,
|
||||
JacocoReportClassesFile: j.jacocoReportClassesFile,
|
||||
StubsLinkType: j.stubsLinkType,
|
||||
HeaderJars: android.PathsIfNonNil(j.headerJarFile),
|
||||
RepackagedHeaderJars: android.PathsIfNonNil(j.repackagedHeaderJarFile),
|
||||
TransitiveLibsHeaderJars: j.transitiveLibsHeaderJars,
|
||||
TransitiveStaticLibsHeaderJars: j.transitiveStaticLibsHeaderJars,
|
||||
ImplementationAndResourcesJars: android.PathsIfNonNil(j.implementationAndResourcesJar),
|
||||
ImplementationJars: android.PathsIfNonNil(j.implementationJarFile),
|
||||
ResourceJars: android.PathsIfNonNil(j.resourceJar),
|
||||
AidlIncludeDirs: j.exportAidlIncludeDirs,
|
||||
SrcJarArgs: j.srcJarArgs,
|
||||
SrcJarDeps: j.srcJarDeps,
|
||||
TransitiveSrcFiles: j.transitiveSrcFiles,
|
||||
ExportedPlugins: j.exportedPluginJars,
|
||||
ExportedPluginClasses: j.exportedPluginClasses,
|
||||
ExportedPluginDisableTurbine: j.exportedDisableTurbine,
|
||||
JacocoReportClassesFile: j.jacocoReportClassesFile,
|
||||
StubsLinkType: j.stubsLinkType,
|
||||
AconfigIntermediateCacheOutputPaths: deps.aconfigProtoFiles,
|
||||
})
|
||||
|
||||
// Save the output file with no relative path so that it doesn't end up in a subdirectory when used as a resource
|
||||
|
@ -2295,6 +2297,7 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
|
|||
// annotation processor that generates API is incompatible with the turbine
|
||||
// optimization.
|
||||
deps.disableTurbine = deps.disableTurbine || dep.ExportedPluginDisableTurbine
|
||||
deps.aconfigProtoFiles = append(deps.aconfigProtoFiles, dep.AconfigIntermediateCacheOutputPaths...)
|
||||
case pluginTag:
|
||||
if plugin, ok := module.(*Plugin); ok {
|
||||
if plugin.pluginProperties.Processor_class != nil {
|
||||
|
@ -2353,6 +2356,8 @@ func (j *Module) collectDeps(ctx android.ModuleContext) deps {
|
|||
deps.staticJars = append(deps.staticJars, dep.Srcs()...)
|
||||
deps.staticHeaderJars = append(deps.staticHeaderJars, dep.Srcs()...)
|
||||
}
|
||||
} else if dep, ok := android.OtherModuleProvider(ctx, module, android.CodegenInfoProvider); ok {
|
||||
deps.aconfigProtoFiles = append(deps.aconfigProtoFiles, dep.IntermediateCacheOutputPaths...)
|
||||
} else {
|
||||
switch tag {
|
||||
case bootClasspathTag:
|
||||
|
|
|
@ -309,6 +309,10 @@ type JavaInfo struct {
|
|||
// implementation jars. If the provider is set by java_sdk_library, the link type is "unknown"
|
||||
// and selection between the stub jar vs implementation jar is deferred to SdkLibrary.sdkJars(...)
|
||||
StubsLinkType StubsLinkType
|
||||
|
||||
// AconfigIntermediateCacheOutputPaths is a path to the cache files collected from the
|
||||
// java_aconfig_library modules that are statically linked to this module.
|
||||
AconfigIntermediateCacheOutputPaths android.Paths
|
||||
}
|
||||
|
||||
var JavaInfoProvider = blueprint.NewProvider[JavaInfo]()
|
||||
|
|
Loading…
Reference in a new issue