From 74b1e2b88001378b8e2fa7aeeae8fd81e218a1ab Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Sun, 22 Nov 2020 20:23:02 -0800 Subject: [PATCH] Support SourceFileProducer in android.OutputFilesForModule Add support to android.OutputFilesForModule to get paths from a SourceFileProducer as well as an OutputFileProducer. Bug: 173977903 Test: m checkbuild Change-Id: I4b2ca2837342ddbb4210bee8f549a636d8b8b049 --- android/module.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/android/module.go b/android/module.go index 6b659d2cd..8be00b2a5 100644 --- a/android/module.go +++ b/android/module.go @@ -2578,6 +2578,15 @@ func outputFilesForModule(ctx PathContext, module blueprint.Module, tag string) return nil, fmt.Errorf("failed to get output files from module %q", pathContextName(ctx, module)) } return paths, nil + } else if sourceFileProducer, ok := module.(SourceFileProducer); ok { + if tag != "" { + return nil, fmt.Errorf("module %q is a SourceFileProducer, not an OutputFileProducer, and so does not support tag %q", pathContextName(ctx, module), tag) + } + paths := sourceFileProducer.Srcs() + if len(paths) == 0 { + return nil, fmt.Errorf("failed to get output files from module %q", pathContextName(ctx, module)) + } + return paths, nil } else { return nil, fmt.Errorf("module %q is not an OutputFileProducer", pathContextName(ctx, module)) }