Use OutputFilesProvider on genrule
Test: CI
Bug: 339477385
Change-Id: I06955584517ce0ec7402047ffdac0e07b954e93e
diff --git a/genrule/genrule.go b/genrule/genrule.go
index 26dad01..12dcb4a 100644
--- a/genrule/genrule.go
+++ b/genrule/genrule.go
@@ -213,21 +213,7 @@
return g.outputDeps
}
-func (g *Module) OutputFiles(tag string) (android.Paths, error) {
- if tag == "" {
- return append(android.Paths{}, g.outputFiles...), nil
- }
- // otherwise, tag should match one of outputs
- for _, outputFile := range g.outputFiles {
- if outputFile.Rel() == tag {
- return android.Paths{outputFile}, nil
- }
- }
- return nil, fmt.Errorf("unsupported module reference tag %q", tag)
-}
-
var _ android.SourceFileProducer = (*Module)(nil)
-var _ android.OutputFileProducer = (*Module)(nil)
func toolDepsMutator(ctx android.BottomUpMutatorContext) {
if g, ok := ctx.Module().(*Module); ok {
@@ -585,6 +571,19 @@
})
g.outputDeps = android.Paths{phonyFile}
}
+
+ g.setOutputFiles(ctx)
+}
+
+func (g *Module) setOutputFiles(ctx android.ModuleContext) {
+ if len(g.outputFiles) == 0 {
+ return
+ }
+ ctx.SetOutputFiles(g.outputFiles, "")
+ // non-empty-string-tag should match one of the outputs
+ for _, files := range g.outputFiles {
+ ctx.SetOutputFiles(android.Paths{files}, files.Rel())
+ }
}
// Collect information for opening IDE project files in java/jdeps.go.