Merge "Use and export proguard flags from static dependencies"
This commit is contained in:
committed by
Gerrit Code Review
commit
1873f39223
19
java/aar.go
19
java/aar.go
@@ -25,6 +25,7 @@ import (
|
|||||||
type AndroidLibraryDependency interface {
|
type AndroidLibraryDependency interface {
|
||||||
Dependency
|
Dependency
|
||||||
ExportPackage() android.Path
|
ExportPackage() android.Path
|
||||||
|
ExportedProguardFlagFiles() android.Paths
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@@ -247,6 +248,12 @@ type AndroidLibrary struct {
|
|||||||
androidLibraryProperties androidLibraryProperties
|
androidLibraryProperties androidLibraryProperties
|
||||||
|
|
||||||
aarFile android.WritablePath
|
aarFile android.WritablePath
|
||||||
|
|
||||||
|
exportedProguardFlagFiles android.Paths
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *AndroidLibrary) ExportedProguardFlagFiles() android.Paths {
|
||||||
|
return a.exportedProguardFlagFiles
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ AndroidLibraryDependency = (*AndroidLibrary)(nil)
|
var _ AndroidLibraryDependency = (*AndroidLibrary)(nil)
|
||||||
@@ -279,6 +286,14 @@ func (a *AndroidLibrary) GenerateAndroidBuildActions(ctx android.ModuleContext)
|
|||||||
BuildAAR(ctx, a.aarFile, a.outputFile, a.manifestPath, a.rTxt, res)
|
BuildAAR(ctx, a.aarFile, a.outputFile, a.manifestPath, a.rTxt, res)
|
||||||
ctx.CheckbuildFile(a.aarFile)
|
ctx.CheckbuildFile(a.aarFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ctx.VisitDirectDeps(func(m android.Module) {
|
||||||
|
if lib, ok := m.(AndroidLibraryDependency); ok && ctx.OtherModuleDependencyTag(m) == staticLibTag {
|
||||||
|
a.exportedProguardFlagFiles = append(a.exportedProguardFlagFiles, lib.ExportedProguardFlagFiles()...)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
a.exportedProguardFlagFiles = android.FirstUniquePaths(a.exportedProguardFlagFiles)
|
||||||
}
|
}
|
||||||
|
|
||||||
func AndroidLibraryFactory() android.Module {
|
func AndroidLibraryFactory() android.Module {
|
||||||
@@ -327,6 +342,10 @@ func (a *AARImport) ExportPackage() android.Path {
|
|||||||
return a.exportPackage
|
return a.exportPackage
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *AARImport) ExportedProguardFlagFiles() android.Paths {
|
||||||
|
return android.Paths{a.proguardFlags}
|
||||||
|
}
|
||||||
|
|
||||||
func (a *AARImport) Prebuilt() *android.Prebuilt {
|
func (a *AARImport) Prebuilt() *android.Prebuilt {
|
||||||
return &a.prebuilt
|
return &a.prebuilt
|
||||||
}
|
}
|
||||||
|
@@ -244,7 +244,8 @@ func (a *AndroidLibrary) AndroidMk() android.AndroidMkData {
|
|||||||
|
|
||||||
fmt.Fprintln(w, "LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE :=", a.exportPackage.String())
|
fmt.Fprintln(w, "LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE :=", a.exportPackage.String())
|
||||||
fmt.Fprintln(w, "LOCAL_FULL_MANIFEST_FILE :=", a.manifestPath.String())
|
fmt.Fprintln(w, "LOCAL_FULL_MANIFEST_FILE :=", a.manifestPath.String())
|
||||||
fmt.Fprintln(w, "LOCAL_SOONG_EXPORT_PROGUARD_FLAGS :=", a.proguardOptionsFile.String())
|
fmt.Fprintln(w, "LOCAL_SOONG_EXPORT_PROGUARD_FLAGS :=",
|
||||||
|
strings.Join(a.exportedProguardFlagFiles.Strings(), " "))
|
||||||
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true")
|
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true")
|
||||||
fmt.Fprintln(w, "LOCAL_DEX_PREOPT := false")
|
fmt.Fprintln(w, "LOCAL_DEX_PREOPT := false")
|
||||||
})
|
})
|
||||||
|
17
java/app.go
17
java/app.go
@@ -63,6 +63,10 @@ type AndroidApp struct {
|
|||||||
appProperties appProperties
|
appProperties appProperties
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *AndroidApp) ExportedProguardFlagFiles() android.Paths {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
var _ AndroidLibraryDependency = (*AndroidApp)(nil)
|
var _ AndroidLibraryDependency = (*AndroidApp)(nil)
|
||||||
|
|
||||||
type certificate struct {
|
type certificate struct {
|
||||||
@@ -116,8 +120,17 @@ func (a *AndroidApp) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
|||||||
// apps manifests are handled by aapt, don't let Module see them
|
// apps manifests are handled by aapt, don't let Module see them
|
||||||
a.properties.Manifest = nil
|
a.properties.Manifest = nil
|
||||||
|
|
||||||
a.Module.extraProguardFlagFiles = append(a.Module.extraProguardFlagFiles,
|
var staticLibProguardFlagFiles android.Paths
|
||||||
a.proguardOptionsFile)
|
ctx.VisitDirectDeps(func(m android.Module) {
|
||||||
|
if lib, ok := m.(AndroidLibraryDependency); ok && ctx.OtherModuleDependencyTag(m) == staticLibTag {
|
||||||
|
staticLibProguardFlagFiles = append(staticLibProguardFlagFiles, lib.ExportedProguardFlagFiles()...)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
staticLibProguardFlagFiles = android.FirstUniquePaths(staticLibProguardFlagFiles)
|
||||||
|
|
||||||
|
a.Module.extraProguardFlagFiles = append(a.Module.extraProguardFlagFiles, staticLibProguardFlagFiles...)
|
||||||
|
a.Module.extraProguardFlagFiles = append(a.Module.extraProguardFlagFiles, a.proguardOptionsFile)
|
||||||
|
|
||||||
if ctx.ModuleName() != "framework-res" {
|
if ctx.ModuleName() != "framework-res" {
|
||||||
a.Module.compile(ctx, a.aaptSrcJar)
|
a.Module.compile(ctx, a.aaptSrcJar)
|
||||||
|
Reference in New Issue
Block a user