Update outputFilesForModuleFromProvider

This CL includes following changes:
1. Added the ability to differentiate the cases that module never
   sets OutputFilesProvider and that module sets the provider with
   a nil value.
2. Updated GenerateTaggedDistFiles to use outputFilesForModuleFromProvider.
3. Updated on cc module to use OutputFilesProvider.

Test: CI
Bug: 339477385
Change-Id: Ib5663a947315f6a90a81b7f073cf8dd22fbb1e05
This commit is contained in:
mrziwang
2024-06-18 12:43:41 -07:00
parent 94a6824c99
commit abdb293492
6 changed files with 68 additions and 72 deletions

View File

@@ -1025,9 +1025,12 @@ func (m TestingModule) VariablesForTestsRelativeToTop() map[string]string {
// otherwise returns the result of calling Paths.RelativeToTop
// on the returned Paths.
func (m TestingModule) OutputFiles(t *testing.T, tag string) Paths {
// TODO: add non-empty-string tag case and remove OutputFileProducer part
if tag == "" && m.module.base().outputFiles.DefaultOutputFiles != nil {
return m.module.base().outputFiles.DefaultOutputFiles.RelativeToTop()
// TODO: remove OutputFileProducer part
outputFiles := m.Module().base().outputFiles
if tag == "" && outputFiles.DefaultOutputFiles != nil {
return outputFiles.DefaultOutputFiles.RelativeToTop()
} else if taggedOutputFiles, hasTag := outputFiles.TaggedOutputFiles[tag]; hasTag {
return taggedOutputFiles
}
producer, ok := m.module.(OutputFileProducer)