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

@@ -2119,10 +2119,23 @@ func (c *Module) GenerateAndroidBuildActions(actx android.ModuleContext) {
if c.Properties.IsSdkVariant && c.Properties.SdkAndPlatformVariantVisibleToMake {
moduleInfoJSON.Uninstallable = true
}
}
buildComplianceMetadataInfo(ctx, c, deps)
c.setOutputFiles(ctx)
}
func (c *Module) setOutputFiles(ctx ModuleContext) {
if c.outputFile.Valid() {
ctx.SetOutputFiles(android.Paths{c.outputFile.Path()}, "")
} else {
ctx.SetOutputFiles(android.Paths{}, "")
}
if c.linker != nil {
ctx.SetOutputFiles(android.PathsIfNonNil(c.linker.unstrippedOutputFilePath()), "unstripped")
ctx.SetOutputFiles(android.PathsIfNonNil(c.linker.strippedAllOutputFilePath()), "stripped_all")
}
}
func buildComplianceMetadataInfo(ctx ModuleContext, c *Module, deps PathDeps) {
@@ -3615,28 +3628,6 @@ func (c *Module) IntermPathForModuleOut() android.OptionalPath {
return c.outputFile
}
func (c *Module) OutputFiles(tag string) (android.Paths, error) {
switch tag {
case "":
if c.outputFile.Valid() {
return android.Paths{c.outputFile.Path()}, nil
}
return android.Paths{}, nil
case "unstripped":
if c.linker != nil {
return android.PathsIfNonNil(c.linker.unstrippedOutputFilePath()), nil
}
return nil, nil
case "stripped_all":
if c.linker != nil {
return android.PathsIfNonNil(c.linker.strippedAllOutputFilePath()), nil
}
return nil, nil
default:
return nil, fmt.Errorf("unsupported module reference tag %q", tag)
}
}
func (c *Module) static() bool {
if static, ok := c.linker.(interface {
static() bool