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:
@@ -451,7 +451,7 @@ func (binary *binaryDecorator) unstrippedOutputFilePath() android.Path {
|
||||
}
|
||||
|
||||
func (binary *binaryDecorator) strippedAllOutputFilePath() android.Path {
|
||||
panic("Not implemented.")
|
||||
return nil
|
||||
}
|
||||
|
||||
func (binary *binaryDecorator) setSymlinkList(ctx ModuleContext) {
|
||||
|
37
cc/cc.go
37
cc/cc.go
@@ -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
|
||||
|
@@ -300,13 +300,9 @@ func TestDataLibs(t *testing.T) {
|
||||
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
||||
|
||||
ctx := testCcWithConfig(t, config)
|
||||
module := ctx.ModuleForTests("main_test", "android_arm_armv7-a-neon").Module()
|
||||
testBinary := module.(*Module).linker.(*testBinary)
|
||||
outputFiles, err := module.(android.OutputFileProducer).OutputFiles("")
|
||||
if err != nil {
|
||||
t.Errorf("Expected cc_test to produce output files, error: %s", err)
|
||||
return
|
||||
}
|
||||
testingModule := ctx.ModuleForTests("main_test", "android_arm_armv7-a-neon")
|
||||
testBinary := testingModule.Module().(*Module).linker.(*testBinary)
|
||||
outputFiles := testingModule.OutputFiles(t, "")
|
||||
if len(outputFiles) != 1 {
|
||||
t.Errorf("expected exactly one output file. output files: [%s]", outputFiles)
|
||||
return
|
||||
@@ -356,12 +352,10 @@ func TestDataLibsRelativeInstallPath(t *testing.T) {
|
||||
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
||||
|
||||
ctx := testCcWithConfig(t, config)
|
||||
module := ctx.ModuleForTests("main_test", "android_arm_armv7-a-neon").Module()
|
||||
testingModule := ctx.ModuleForTests("main_test", "android_arm_armv7-a-neon")
|
||||
module := testingModule.Module()
|
||||
testBinary := module.(*Module).linker.(*testBinary)
|
||||
outputFiles, err := module.(android.OutputFileProducer).OutputFiles("")
|
||||
if err != nil {
|
||||
t.Fatalf("Expected cc_test to produce output files, error: %s", err)
|
||||
}
|
||||
outputFiles := testingModule.OutputFiles(t, "")
|
||||
if len(outputFiles) != 1 {
|
||||
t.Fatalf("expected exactly one output file. output files: [%s]", outputFiles)
|
||||
}
|
||||
@@ -1407,12 +1401,10 @@ func TestDataLibsPrebuiltSharedTestLibrary(t *testing.T) {
|
||||
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
||||
|
||||
ctx := testCcWithConfig(t, config)
|
||||
module := ctx.ModuleForTests("main_test", "android_arm_armv7-a-neon").Module()
|
||||
testingModule := ctx.ModuleForTests("main_test", "android_arm_armv7-a-neon")
|
||||
module := testingModule.Module()
|
||||
testBinary := module.(*Module).linker.(*testBinary)
|
||||
outputFiles, err := module.(android.OutputFileProducer).OutputFiles("")
|
||||
if err != nil {
|
||||
t.Fatalf("Expected cc_test to produce output files, error: %s", err)
|
||||
}
|
||||
outputFiles := testingModule.OutputFiles(t, "")
|
||||
if len(outputFiles) != 1 {
|
||||
t.Errorf("expected exactly one output file. output files: [%s]", outputFiles)
|
||||
}
|
||||
@@ -3118,12 +3110,8 @@ func TestStrippedAllOutputFile(t *testing.T) {
|
||||
`
|
||||
config := TestConfig(t.TempDir(), android.Android, nil, bp, nil)
|
||||
ctx := testCcWithConfig(t, config)
|
||||
module := ctx.ModuleForTests("test_lib", "android_arm_armv7-a-neon_shared").Module()
|
||||
outputFile, err := module.(android.OutputFileProducer).OutputFiles("stripped_all")
|
||||
if err != nil {
|
||||
t.Errorf("Expected cc_library to produce output files, error: %s", err)
|
||||
return
|
||||
}
|
||||
testingModule := ctx.ModuleForTests("test_lib", "android_arm_armv7-a-neon_shared")
|
||||
outputFile := testingModule.OutputFiles(t, "stripped_all")
|
||||
if !strings.HasSuffix(outputFile.Strings()[0], "/stripped_all/test_lib.so") {
|
||||
t.Errorf("Unexpected output file: %s", outputFile.Strings()[0])
|
||||
return
|
||||
|
@@ -220,7 +220,7 @@ func (object *objectLinker) unstrippedOutputFilePath() android.Path {
|
||||
}
|
||||
|
||||
func (object *objectLinker) strippedAllOutputFilePath() android.Path {
|
||||
panic("Not implemented.")
|
||||
return nil
|
||||
}
|
||||
|
||||
func (object *objectLinker) nativeCoverage() bool {
|
||||
|
Reference in New Issue
Block a user