Use OutputFilesProvider on java modules

In the context of incremental soong, the output files
inter-module-communication will be through OutputFilesProvider.
The OutputFileProducer interface will be deprecated.

Test: CI
Bug: 339477385
Change-Id: I3c9f0b766325dd490bc903dc65259c3953d34606
This commit is contained in:
mrziwang
2024-07-10 12:18:06 -07:00
parent 8dfc2bf163
commit 9f7b9f4a9a
10 changed files with 82 additions and 155 deletions

View File

@@ -1017,6 +1017,22 @@ func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) {
isPrebuilt: false,
},
)
a.setOutputFiles(ctx)
}
func (a *AndroidApp) setOutputFiles(ctx android.ModuleContext) {
ctx.SetOutputFiles([]android.Path{a.proguardOptionsFile}, ".aapt.proguardOptionsFile")
if a.aaptSrcJar != nil {
ctx.SetOutputFiles([]android.Path{a.aaptSrcJar}, ".aapt.srcjar")
}
if a.rJar != nil {
ctx.SetOutputFiles([]android.Path{a.rJar}, ".aapt.jar")
}
ctx.SetOutputFiles([]android.Path{a.outputFile}, ".apk")
ctx.SetOutputFiles([]android.Path{a.exportPackage}, ".export-package.apk")
ctx.SetOutputFiles([]android.Path{a.aapt.manifestPath}, ".manifest.xml")
setOutputFiles(ctx, a.Library.Module)
}
type appDepsInterface interface {
@@ -1207,31 +1223,6 @@ func (a *AndroidApp) DepIsInSameApex(ctx android.BaseModuleContext, dep android.
return a.Library.DepIsInSameApex(ctx, dep)
}
// For OutputFileProducer interface
func (a *AndroidApp) OutputFiles(tag string) (android.Paths, error) {
switch tag {
// In some instances, it can be useful to reference the aapt-generated flags from another
// target, e.g., system server implements services declared in the framework-res manifest.
case ".aapt.proguardOptionsFile":
return []android.Path{a.proguardOptionsFile}, nil
case ".aapt.srcjar":
if a.aaptSrcJar != nil {
return []android.Path{a.aaptSrcJar}, nil
}
case ".aapt.jar":
if a.rJar != nil {
return []android.Path{a.rJar}, nil
}
case ".apk":
return []android.Path{a.outputFile}, nil
case ".export-package.apk":
return []android.Path{a.exportPackage}, nil
case ".manifest.xml":
return []android.Path{a.aapt.manifestPath}, nil
}
return a.Library.OutputFiles(tag)
}
func (a *AndroidApp) Privileged() bool {
return Bool(a.appProperties.Privileged)
}