Convert JavaInfoProvider to *JavaInfo
Convert JavaInfoProvider to return a *JavaInfo instead of a JavaInfo. This will reduce copying when reading the provider, and also allows JavaInfo to recursively contain a depset of JavaInfos from dependencies. Bug: 308016794 Test: go test ./java/... Flag: EXEMPT refactor Change-Id: Ibf6d9b797f760ad1fe815d59839839fdfad91733
This commit is contained in:
23
java/java.go
23
java/java.go
@@ -315,14 +315,14 @@ type JavaInfo struct {
|
||||
AconfigIntermediateCacheOutputPaths android.Paths
|
||||
}
|
||||
|
||||
var JavaInfoProvider = blueprint.NewProvider[JavaInfo]()
|
||||
var JavaInfoProvider = blueprint.NewProvider[*JavaInfo]()
|
||||
|
||||
// SyspropPublicStubInfo contains info about the sysprop public stub library that corresponds to
|
||||
// the sysprop implementation library.
|
||||
type SyspropPublicStubInfo struct {
|
||||
// JavaInfo is the JavaInfoProvider of the sysprop public stub library that corresponds to
|
||||
// the sysprop implementation library.
|
||||
JavaInfo JavaInfo
|
||||
JavaInfo *JavaInfo
|
||||
}
|
||||
|
||||
var SyspropPublicStubInfoProvider = blueprint.NewProvider[SyspropPublicStubInfo]()
|
||||
@@ -2249,14 +2249,17 @@ func (al *ApiLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
}
|
||||
srcFilesInfo = append(srcFilesInfo, provider)
|
||||
case libTag:
|
||||
provider, _ := android.OtherModuleProvider(ctx, dep, JavaInfoProvider)
|
||||
classPaths = append(classPaths, provider.HeaderJars...)
|
||||
if provider, ok := android.OtherModuleProvider(ctx, dep, JavaInfoProvider); ok {
|
||||
classPaths = append(classPaths, provider.HeaderJars...)
|
||||
}
|
||||
case bootClasspathTag:
|
||||
provider, _ := android.OtherModuleProvider(ctx, dep, JavaInfoProvider)
|
||||
bootclassPaths = append(bootclassPaths, provider.HeaderJars...)
|
||||
if provider, ok := android.OtherModuleProvider(ctx, dep, JavaInfoProvider); ok {
|
||||
bootclassPaths = append(bootclassPaths, provider.HeaderJars...)
|
||||
}
|
||||
case staticLibTag:
|
||||
provider, _ := android.OtherModuleProvider(ctx, dep, JavaInfoProvider)
|
||||
staticLibs = append(staticLibs, provider.HeaderJars...)
|
||||
if provider, ok := android.OtherModuleProvider(ctx, dep, JavaInfoProvider); ok {
|
||||
staticLibs = append(staticLibs, provider.HeaderJars...)
|
||||
}
|
||||
case systemModulesTag:
|
||||
module := dep.(SystemModulesProvider)
|
||||
systemModulesPaths = append(systemModulesPaths, module.HeaderJars()...)
|
||||
@@ -2358,7 +2361,7 @@ func (al *ApiLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
|
||||
ctx.Phony(ctx.ModuleName(), al.stubsJar)
|
||||
|
||||
android.SetProvider(ctx, JavaInfoProvider, JavaInfo{
|
||||
android.SetProvider(ctx, JavaInfoProvider, &JavaInfo{
|
||||
HeaderJars: android.PathsIfNonNil(al.stubsJar),
|
||||
ImplementationAndResourcesJars: android.PathsIfNonNil(al.stubsJar),
|
||||
ImplementationJars: android.PathsIfNonNil(al.stubsJar),
|
||||
@@ -2787,7 +2790,7 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
}
|
||||
}
|
||||
|
||||
android.SetProvider(ctx, JavaInfoProvider, JavaInfo{
|
||||
android.SetProvider(ctx, JavaInfoProvider, &JavaInfo{
|
||||
HeaderJars: android.PathsIfNonNil(j.combinedHeaderFile),
|
||||
TransitiveLibsHeaderJars: j.transitiveLibsHeaderJars,
|
||||
TransitiveStaticLibsHeaderJars: j.transitiveStaticLibsHeaderJars,
|
||||
|
Reference in New Issue
Block a user