summaryrefslogtreecommitdiff
path: root/java/base.go
diff options
context:
space:
mode:
author Zi Wang <mrziwang@google.com> 2024-07-11 01:24:10 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2024-07-11 01:24:10 +0000
commit256772f02c96cedbad1d1d135f55f48b33bf9afc (patch)
treead8cf69cd4817730cc2ffe72b25ee8091c50d3bc /java/base.go
parent05f3927c090e32ab2ff4260f1e2d847dfef13a9a (diff)
parent9f7b9f4a9ab77d1816e8ae30ac8339e335fb7e92 (diff)
Merge "Use OutputFilesProvider on java modules" into main
Diffstat (limited to 'java/base.go')
-rw-r--r--java/base.go38
1 files changed, 12 insertions, 26 deletions
diff --git a/java/base.go b/java/base.go
index ee8df3e76..fc68d2018 100644
--- a/java/base.go
+++ b/java/base.go
@@ -652,35 +652,21 @@ func (j *Module) provideHiddenAPIPropertyInfo(ctx android.ModuleContext) {
android.SetProvider(ctx, hiddenAPIPropertyInfoProvider, hiddenAPIInfo)
}
-func (j *Module) OutputFiles(tag string) (android.Paths, error) {
- switch tag {
- case "":
- return append(android.Paths{j.outputFile}, j.extraOutputFiles...), nil
- case android.DefaultDistTag:
- return android.Paths{j.outputFile}, nil
- case ".jar":
- return android.Paths{j.implementationAndResourcesJar}, nil
- case ".hjar":
- return android.Paths{j.headerJarFile}, nil
- case ".proguard_map":
- if j.dexer.proguardDictionary.Valid() {
- return android.Paths{j.dexer.proguardDictionary.Path()}, nil
- }
- return nil, fmt.Errorf("%q was requested, but no output file was found.", tag)
- case ".generated_srcjars":
- return j.properties.Generated_srcjars, nil
- case ".lint":
- if j.linter.outputs.xml != nil {
- return android.Paths{j.linter.outputs.xml}, nil
- }
- return nil, fmt.Errorf("%q was requested, but no output file was found.", tag)
- default:
- return nil, fmt.Errorf("unsupported module reference tag %q", tag)
+// helper method for java modules to set OutputFilesProvider
+func setOutputFiles(ctx android.ModuleContext, m Module) {
+ ctx.SetOutputFiles(append(android.Paths{m.outputFile}, m.extraOutputFiles...), "")
+ ctx.SetOutputFiles(android.Paths{m.outputFile}, android.DefaultDistTag)
+ ctx.SetOutputFiles(android.Paths{m.implementationAndResourcesJar}, ".jar")
+ ctx.SetOutputFiles(android.Paths{m.headerJarFile}, ".hjar")
+ if m.dexer.proguardDictionary.Valid() {
+ ctx.SetOutputFiles(android.Paths{m.dexer.proguardDictionary.Path()}, ".proguard_map")
+ }
+ ctx.SetOutputFiles(m.properties.Generated_srcjars, ".generated_srcjars")
+ if m.linter.outputs.xml != nil {
+ ctx.SetOutputFiles(android.Paths{m.linter.outputs.xml}, ".lint")
}
}
-var _ android.OutputFileProducer = (*Module)(nil)
-
func InitJavaModule(module android.DefaultableModule, hod android.HostOrDeviceSupported) {
initJavaModule(module, hod, false)
}