Merge "Include proguard flag files from transitive java_library deps"

This commit is contained in:
Treehugger Robot
2022-12-17 01:39:08 +00:00
committed by Gerrit Code Review
4 changed files with 87 additions and 13 deletions

View File

@@ -29,8 +29,8 @@ import (
)
type AndroidLibraryDependency interface {
LibraryDependency
ExportPackage() android.Path
ExportedProguardFlagFiles() android.Paths
ExportedRRODirs() []rroDir
ExportedStaticPackages() android.Paths
ExportedManifests() android.Paths
@@ -498,8 +498,7 @@ type AndroidLibrary struct {
aarFile android.WritablePath
exportedProguardFlagFiles android.Paths
exportedStaticPackages android.Paths
exportedStaticPackages android.Paths
}
var _ android.OutputFileProducer = (*AndroidLibrary)(nil)
@@ -514,10 +513,6 @@ func (a *AndroidLibrary) OutputFiles(tag string) (android.Paths, error) {
}
}
func (a *AndroidLibrary) ExportedProguardFlagFiles() android.Paths {
return a.exportedProguardFlagFiles
}
func (a *AndroidLibrary) ExportedStaticPackages() android.Paths {
return a.exportedStaticPackages
}
@@ -566,13 +561,16 @@ func (a *AndroidLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext)
a.exportedProguardFlagFiles = append(a.exportedProguardFlagFiles,
android.PathsForModuleSrc(ctx, a.dexProperties.Optimize.Proguard_flags_files)...)
ctx.VisitDirectDeps(func(m android.Module) {
if lib, ok := m.(AndroidLibraryDependency); ok && ctx.OtherModuleDependencyTag(m) == staticLibTag {
a.exportedProguardFlagFiles = append(a.exportedProguardFlagFiles, lib.ExportedProguardFlagFiles()...)
a.exportedStaticPackages = append(a.exportedStaticPackages, lib.ExportPackage())
a.exportedStaticPackages = append(a.exportedStaticPackages, lib.ExportedStaticPackages()...)
if ctx.OtherModuleDependencyTag(m) == staticLibTag {
if lib, ok := m.(LibraryDependency); ok {
a.exportedProguardFlagFiles = append(a.exportedProguardFlagFiles, lib.ExportedProguardFlagFiles()...)
}
if alib, ok := m.(AndroidLibraryDependency); ok {
a.exportedStaticPackages = append(a.exportedStaticPackages, alib.ExportPackage())
a.exportedStaticPackages = append(a.exportedStaticPackages, alib.ExportedStaticPackages()...)
}
}
})
a.exportedProguardFlagFiles = android.FirstUniquePaths(a.exportedProguardFlagFiles)
a.exportedStaticPackages = android.FirstUniquePaths(a.exportedStaticPackages)