Remove outputFiles from ModuleBase.
Bug: 358425833 Test: CI Change-Id: I6c398fbdbc38b99fa62f8670baa44ffd51b5e6d3
This commit is contained in:
@@ -875,10 +875,6 @@ type ModuleBase struct {
|
|||||||
// be included in the final module-info.json produced by Make.
|
// be included in the final module-info.json produced by Make.
|
||||||
moduleInfoJSON *ModuleInfoJSON
|
moduleInfoJSON *ModuleInfoJSON
|
||||||
|
|
||||||
// outputFiles stores the output of a module by tag and is used to set
|
|
||||||
// the OutputFilesProvider in GenerateBuildActions
|
|
||||||
outputFiles OutputFilesInfo
|
|
||||||
|
|
||||||
// complianceMetadataInfo is for different module types to dump metadata.
|
// complianceMetadataInfo is for different module types to dump metadata.
|
||||||
// See android.ModuleContext interface.
|
// See android.ModuleContext interface.
|
||||||
complianceMetadataInfo *ComplianceMetadataInfo
|
complianceMetadataInfo *ComplianceMetadataInfo
|
||||||
@@ -2057,8 +2053,9 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
|
|||||||
m.ruleParams = ctx.ruleParams
|
m.ruleParams = ctx.ruleParams
|
||||||
m.variables = ctx.variables
|
m.variables = ctx.variables
|
||||||
|
|
||||||
if m.outputFiles.DefaultOutputFiles != nil || m.outputFiles.TaggedOutputFiles != nil {
|
outputFiles := ctx.GetOutputFiles()
|
||||||
SetProvider(ctx, OutputFilesProvider, m.outputFiles)
|
if outputFiles.DefaultOutputFiles != nil || outputFiles.TaggedOutputFiles != nil {
|
||||||
|
SetProvider(ctx, OutputFilesProvider, outputFiles)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(ctx.phonies) > 0 {
|
if len(ctx.phonies) > 0 {
|
||||||
@@ -2557,13 +2554,14 @@ func outputFilesForModuleFromProvider(ctx PathContext, module blueprint.Module,
|
|||||||
type OutputFilesProviderModuleContext interface {
|
type OutputFilesProviderModuleContext interface {
|
||||||
OtherModuleProviderContext
|
OtherModuleProviderContext
|
||||||
Module() Module
|
Module() Module
|
||||||
|
GetOutputFiles() OutputFilesInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
if mctx, isMctx := ctx.(OutputFilesProviderModuleContext); isMctx {
|
if mctx, isMctx := ctx.(OutputFilesProviderModuleContext); isMctx {
|
||||||
if mctx.Module() != module {
|
if mctx.Module() != module {
|
||||||
outputFiles, _ = OtherModuleProvider(mctx, module, OutputFilesProvider)
|
outputFiles, _ = OtherModuleProvider(mctx, module, OutputFilesProvider)
|
||||||
} else {
|
} else {
|
||||||
outputFiles = mctx.Module().base().outputFiles
|
outputFiles = mctx.GetOutputFiles()
|
||||||
fromProperty = true
|
fromProperty = true
|
||||||
}
|
}
|
||||||
} else if cta, isCta := ctx.(*singletonContextAdaptor); isCta {
|
} else if cta, isCta := ctx.(*singletonContextAdaptor); isCta {
|
||||||
|
@@ -216,6 +216,8 @@ type ModuleContext interface {
|
|||||||
// to set the OutputFilesProvider later.
|
// to set the OutputFilesProvider later.
|
||||||
SetOutputFiles(outputFiles Paths, tag string)
|
SetOutputFiles(outputFiles Paths, tag string)
|
||||||
|
|
||||||
|
GetOutputFiles() OutputFilesInfo
|
||||||
|
|
||||||
// ComplianceMetadataInfo returns a ComplianceMetadataInfo instance for different module types to dump metadata,
|
// ComplianceMetadataInfo returns a ComplianceMetadataInfo instance for different module types to dump metadata,
|
||||||
// which usually happens in GenerateAndroidBuildActions() of a module type.
|
// which usually happens in GenerateAndroidBuildActions() of a module type.
|
||||||
// See android.ModuleBase.complianceMetadataInfo
|
// See android.ModuleBase.complianceMetadataInfo
|
||||||
@@ -230,6 +232,9 @@ type moduleContext struct {
|
|||||||
checkbuildFiles Paths
|
checkbuildFiles Paths
|
||||||
module Module
|
module Module
|
||||||
phonies map[string]Paths
|
phonies map[string]Paths
|
||||||
|
// outputFiles stores the output of a module by tag and is used to set
|
||||||
|
// the OutputFilesProvider in GenerateBuildActions
|
||||||
|
outputFiles OutputFilesInfo
|
||||||
|
|
||||||
katiInstalls katiInstalls
|
katiInstalls katiInstalls
|
||||||
katiSymlinks katiInstalls
|
katiSymlinks katiInstalls
|
||||||
@@ -713,22 +718,26 @@ func (m *moduleContext) ModuleInfoJSON() *ModuleInfoJSON {
|
|||||||
|
|
||||||
func (m *moduleContext) SetOutputFiles(outputFiles Paths, tag string) {
|
func (m *moduleContext) SetOutputFiles(outputFiles Paths, tag string) {
|
||||||
if tag == "" {
|
if tag == "" {
|
||||||
if len(m.module.base().outputFiles.DefaultOutputFiles) > 0 {
|
if len(m.outputFiles.DefaultOutputFiles) > 0 {
|
||||||
m.ModuleErrorf("Module %s default OutputFiles cannot be overwritten", m.ModuleName())
|
m.ModuleErrorf("Module %s default OutputFiles cannot be overwritten", m.ModuleName())
|
||||||
}
|
}
|
||||||
m.module.base().outputFiles.DefaultOutputFiles = outputFiles
|
m.outputFiles.DefaultOutputFiles = outputFiles
|
||||||
} else {
|
} else {
|
||||||
if m.module.base().outputFiles.TaggedOutputFiles == nil {
|
if m.outputFiles.TaggedOutputFiles == nil {
|
||||||
m.module.base().outputFiles.TaggedOutputFiles = make(map[string]Paths)
|
m.outputFiles.TaggedOutputFiles = make(map[string]Paths)
|
||||||
}
|
}
|
||||||
if _, exists := m.module.base().outputFiles.TaggedOutputFiles[tag]; exists {
|
if _, exists := m.outputFiles.TaggedOutputFiles[tag]; exists {
|
||||||
m.ModuleErrorf("Module %s OutputFiles at tag %s cannot be overwritten", m.ModuleName(), tag)
|
m.ModuleErrorf("Module %s OutputFiles at tag %s cannot be overwritten", m.ModuleName(), tag)
|
||||||
} else {
|
} else {
|
||||||
m.module.base().outputFiles.TaggedOutputFiles[tag] = outputFiles
|
m.outputFiles.TaggedOutputFiles[tag] = outputFiles
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (m *moduleContext) GetOutputFiles() OutputFilesInfo {
|
||||||
|
return m.outputFiles
|
||||||
|
}
|
||||||
|
|
||||||
func (m *moduleContext) ComplianceMetadataInfo() *ComplianceMetadataInfo {
|
func (m *moduleContext) ComplianceMetadataInfo() *ComplianceMetadataInfo {
|
||||||
if complianceMetadataInfo := m.module.base().complianceMetadataInfo; complianceMetadataInfo != nil {
|
if complianceMetadataInfo := m.module.base().complianceMetadataInfo; complianceMetadataInfo != nil {
|
||||||
return complianceMetadataInfo
|
return complianceMetadataInfo
|
||||||
|
@@ -993,6 +993,10 @@ func (p *pathContextAddMissingDependenciesWrapper) OtherModuleName(module bluepr
|
|||||||
|
|
||||||
func (p *pathContextAddMissingDependenciesWrapper) Module() Module { return nil }
|
func (p *pathContextAddMissingDependenciesWrapper) Module() Module { return nil }
|
||||||
|
|
||||||
|
func (p *pathContextAddMissingDependenciesWrapper) GetOutputFiles() OutputFilesInfo {
|
||||||
|
return OutputFilesInfo{}
|
||||||
|
}
|
||||||
|
|
||||||
func TestOutputFileForModule(t *testing.T) {
|
func TestOutputFileForModule(t *testing.T) {
|
||||||
testcases := []struct {
|
testcases := []struct {
|
||||||
name string
|
name string
|
||||||
|
Reference in New Issue
Block a user