Merge "Simplify aconfig_declarations_group" into main
This commit is contained in:
commit
791733fad4
2 changed files with 22 additions and 41 deletions
|
@ -39,11 +39,6 @@ type AconfigDeclarationsGroup struct {
|
||||||
android.DefaultableModuleBase
|
android.DefaultableModuleBase
|
||||||
|
|
||||||
properties AconfigDeclarationsGroupProperties
|
properties AconfigDeclarationsGroupProperties
|
||||||
|
|
||||||
aconfigDeclarationNames []string
|
|
||||||
intermediateCacheOutputPaths android.Paths
|
|
||||||
javaSrcjars android.Paths
|
|
||||||
modeInfos map[string]android.ModeInfo
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type AconfigDeclarationsGroupProperties struct {
|
type AconfigDeclarationsGroupProperties struct {
|
||||||
|
@ -76,53 +71,45 @@ func (adg *AconfigDeclarationsGroup) DepsMutator(ctx android.BottomUpMutatorCont
|
||||||
ctx.AddDependency(ctx.Module(), rustAconfigLibraryTag, adg.properties.Rust_aconfig_libraries...)
|
ctx.AddDependency(ctx.Module(), rustAconfigLibraryTag, adg.properties.Rust_aconfig_libraries...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (adg *AconfigDeclarationsGroup) VisitDeps(ctx android.ModuleContext) {
|
func (adg *AconfigDeclarationsGroup) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
adg.modeInfos = make(map[string]android.ModeInfo)
|
modeInfos := make(map[string]android.ModeInfo)
|
||||||
|
var aconfigDeclarationNames []string
|
||||||
|
var intermediateCacheOutputPaths android.Paths
|
||||||
|
var javaSrcjars android.Paths
|
||||||
ctx.VisitDirectDeps(func(dep android.Module) {
|
ctx.VisitDirectDeps(func(dep android.Module) {
|
||||||
tag := ctx.OtherModuleDependencyTag(dep)
|
tag := ctx.OtherModuleDependencyTag(dep)
|
||||||
if provider, ok := android.OtherModuleProvider(ctx, dep, android.CodegenInfoProvider); ok {
|
if provider, ok := android.OtherModuleProvider(ctx, dep, android.CodegenInfoProvider); ok {
|
||||||
|
|
||||||
// aconfig declaration names and cache files are collected for all aconfig library dependencies
|
// aconfig declaration names and cache files are collected for all aconfig library dependencies
|
||||||
adg.aconfigDeclarationNames = append(adg.aconfigDeclarationNames, provider.AconfigDeclarations...)
|
aconfigDeclarationNames = append(aconfigDeclarationNames, provider.AconfigDeclarations...)
|
||||||
adg.intermediateCacheOutputPaths = append(adg.intermediateCacheOutputPaths, provider.IntermediateCacheOutputPaths...)
|
intermediateCacheOutputPaths = append(intermediateCacheOutputPaths, provider.IntermediateCacheOutputPaths...)
|
||||||
|
|
||||||
switch tag {
|
switch tag {
|
||||||
case aconfigDeclarationsGroupTag:
|
case aconfigDeclarationsGroupTag:
|
||||||
// Will retrieve outputs from another language codegen modules when support is added
|
// Will retrieve outputs from another language codegen modules when support is added
|
||||||
adg.javaSrcjars = append(adg.javaSrcjars, provider.Srcjars...)
|
javaSrcjars = append(javaSrcjars, provider.Srcjars...)
|
||||||
maps.Copy(adg.modeInfos, provider.ModeInfos)
|
maps.Copy(modeInfos, provider.ModeInfos)
|
||||||
case javaAconfigLibraryTag:
|
case javaAconfigLibraryTag:
|
||||||
adg.javaSrcjars = append(adg.javaSrcjars, provider.Srcjars...)
|
javaSrcjars = append(javaSrcjars, provider.Srcjars...)
|
||||||
maps.Copy(adg.modeInfos, provider.ModeInfos)
|
maps.Copy(modeInfos, provider.ModeInfos)
|
||||||
case ccAconfigLibraryTag:
|
case ccAconfigLibraryTag:
|
||||||
maps.Copy(adg.modeInfos, provider.ModeInfos)
|
maps.Copy(modeInfos, provider.ModeInfos)
|
||||||
case rustAconfigLibraryTag:
|
case rustAconfigLibraryTag:
|
||||||
maps.Copy(adg.modeInfos, provider.ModeInfos)
|
maps.Copy(modeInfos, provider.ModeInfos)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
|
||||||
|
|
||||||
func (adg *AconfigDeclarationsGroup) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
aconfigDeclarationNames = android.FirstUniqueStrings(aconfigDeclarationNames)
|
||||||
adg.VisitDeps(ctx)
|
intermediateCacheOutputPaths = android.FirstUniquePaths(intermediateCacheOutputPaths)
|
||||||
adg.aconfigDeclarationNames = android.FirstUniqueStrings(adg.aconfigDeclarationNames)
|
|
||||||
adg.intermediateCacheOutputPaths = android.FirstUniquePaths(adg.intermediateCacheOutputPaths)
|
|
||||||
|
|
||||||
android.SetProvider(ctx, android.CodegenInfoProvider, android.CodegenInfo{
|
android.SetProvider(ctx, android.CodegenInfoProvider, android.CodegenInfo{
|
||||||
AconfigDeclarations: adg.aconfigDeclarationNames,
|
AconfigDeclarations: aconfigDeclarationNames,
|
||||||
IntermediateCacheOutputPaths: adg.intermediateCacheOutputPaths,
|
IntermediateCacheOutputPaths: intermediateCacheOutputPaths,
|
||||||
Srcjars: adg.javaSrcjars,
|
Srcjars: javaSrcjars,
|
||||||
ModeInfos: adg.modeInfos,
|
ModeInfos: modeInfos,
|
||||||
})
|
})
|
||||||
|
|
||||||
ctx.SetOutputFiles(adg.intermediateCacheOutputPaths, "")
|
ctx.SetOutputFiles(intermediateCacheOutputPaths, "")
|
||||||
ctx.SetOutputFiles(adg.javaSrcjars, ".srcjars")
|
ctx.SetOutputFiles(javaSrcjars, ".srcjars")
|
||||||
}
|
|
||||||
|
|
||||||
func (adg *AconfigDeclarationsGroup) Srcjars() android.Paths {
|
|
||||||
return adg.javaSrcjars
|
|
||||||
}
|
|
||||||
|
|
||||||
func (adg *AconfigDeclarationsGroup) AconfigDeclarations() []string {
|
|
||||||
return adg.aconfigDeclarationNames
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,8 +15,6 @@
|
||||||
package codegen
|
package codegen
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
|
|
||||||
"android/soong/android"
|
"android/soong/android"
|
||||||
"android/soong/java"
|
"android/soong/java"
|
||||||
|
|
||||||
|
@ -80,7 +78,7 @@ func (callbacks *JavaAconfigDeclarationsLibraryCallbacks) GenerateSourceJarBuild
|
||||||
// Get the values that came from the global RELEASE_ACONFIG_VALUE_SETS flag
|
// Get the values that came from the global RELEASE_ACONFIG_VALUE_SETS flag
|
||||||
declarationsModules := ctx.GetDirectDepsWithTag(declarationsTag)
|
declarationsModules := ctx.GetDirectDepsWithTag(declarationsTag)
|
||||||
if len(declarationsModules) != 1 {
|
if len(declarationsModules) != 1 {
|
||||||
panic(fmt.Errorf("Exactly one aconfig_declarations property required"))
|
panic("Exactly one aconfig_declarations property required")
|
||||||
}
|
}
|
||||||
declarations, _ := android.OtherModuleProvider(ctx, declarationsModules[0], android.AconfigDeclarationsProviderKey)
|
declarations, _ := android.OtherModuleProvider(ctx, declarationsModules[0], android.AconfigDeclarationsProviderKey)
|
||||||
|
|
||||||
|
@ -133,10 +131,6 @@ func (callbacks *JavaAconfigDeclarationsLibraryCallbacks) GenerateSourceJarBuild
|
||||||
return srcJarPath, declarations.IntermediateCacheOutputPath
|
return srcJarPath, declarations.IntermediateCacheOutputPath
|
||||||
}
|
}
|
||||||
|
|
||||||
func (callbacks *JavaAconfigDeclarationsLibraryCallbacks) AconfigDeclarations() *string {
|
|
||||||
return proptools.StringPtr(callbacks.properties.Aconfig_declarations)
|
|
||||||
}
|
|
||||||
|
|
||||||
func isModeSupported(mode string) bool {
|
func isModeSupported(mode string) bool {
|
||||||
return android.InList(mode, aconfigSupportedModes)
|
return android.InList(mode, aconfigSupportedModes)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue