Merge "Remove licenseMetadataFile and installFiles from ModuleBase." into main
This commit is contained in:
@@ -157,6 +157,7 @@ type AndroidMkEntries struct {
|
||||
}
|
||||
|
||||
type AndroidMkEntriesContext interface {
|
||||
OtherModuleProviderContext
|
||||
Config() Config
|
||||
}
|
||||
|
||||
@@ -354,14 +355,15 @@ func (a *AndroidMkEntries) getDistContributions(mod blueprint.Module) *distContr
|
||||
availableTaggedDists = availableTaggedDists.addPathsForTag(DefaultDistTag, a.OutputFile.Path())
|
||||
}
|
||||
|
||||
info := OtherModuleProviderOrDefault(a.entryContext, mod, InstallFilesProvider)
|
||||
// If the distFiles created by GenerateTaggedDistFiles contains paths for the
|
||||
// DefaultDistTag then that takes priority so delete any existing paths.
|
||||
if _, ok := amod.distFiles[DefaultDistTag]; ok {
|
||||
if _, ok := info.DistFiles[DefaultDistTag]; ok {
|
||||
delete(availableTaggedDists, DefaultDistTag)
|
||||
}
|
||||
|
||||
// Finally, merge the distFiles created by GenerateTaggedDistFiles.
|
||||
availableTaggedDists = availableTaggedDists.merge(amod.distFiles)
|
||||
availableTaggedDists = availableTaggedDists.merge(info.DistFiles)
|
||||
|
||||
if len(availableTaggedDists) == 0 {
|
||||
// Nothing dist-able for this module.
|
||||
@@ -372,7 +374,7 @@ func (a *AndroidMkEntries) getDistContributions(mod blueprint.Module) *distContr
|
||||
distContributions := &distContributions{}
|
||||
|
||||
if !exemptFromRequiredApplicableLicensesProperty(mod.(Module)) {
|
||||
distContributions.licenseMetadataFile = amod.licenseMetadataFile
|
||||
distContributions.licenseMetadataFile = info.LicenseMetadataFile
|
||||
}
|
||||
|
||||
// Iterate over this module's dist structs, merged from the dist and dists properties.
|
||||
|
@@ -46,7 +46,6 @@ const (
|
||||
|
||||
func (m *customModule) GenerateAndroidBuildActions(ctx ModuleContext) {
|
||||
|
||||
m.base().licenseMetadataFile = PathForOutput(ctx, "meta_lic")
|
||||
var defaultDistPaths Paths
|
||||
|
||||
// If the dist_output_file: true then create an output file that is stored in
|
||||
@@ -276,7 +275,8 @@ func TestGetDistForGoals(t *testing.T) {
|
||||
)
|
||||
}
|
||||
for idx, line := range androidMkLines {
|
||||
expectedLine := strings.ReplaceAll(expectedAndroidMkLines[idx], "meta_lic", module.base().licenseMetadataFile.String())
|
||||
expectedLine := strings.ReplaceAll(expectedAndroidMkLines[idx], "meta_lic",
|
||||
OtherModuleProviderOrDefault(ctx, module, InstallFilesProvider).LicenseMetadataFile.String())
|
||||
if line != expectedLine {
|
||||
t.Errorf(
|
||||
"Expected AndroidMk line to be '%s', got '%s'",
|
||||
|
@@ -842,9 +842,6 @@ type ModuleBase struct {
|
||||
katiInitRcInstalls katiInstalls
|
||||
katiVintfInstalls katiInstalls
|
||||
|
||||
// The files to copy to the dist as explicitly specified in the .bp file.
|
||||
distFiles TaggedDistFiles
|
||||
|
||||
hooks hooks
|
||||
|
||||
registerProps []interface{}
|
||||
@@ -863,9 +860,6 @@ type ModuleBase struct {
|
||||
// Merged Aconfig files for all transitive deps.
|
||||
aconfigFilePaths Paths
|
||||
|
||||
// The path to the generated license metadata file for the module.
|
||||
licenseMetadataFile WritablePath
|
||||
|
||||
// moduleInfoJSON can be filled out by GenerateAndroidBuildActions to write a JSON file that will
|
||||
// be included in the final module-info.json produced by Make.
|
||||
moduleInfoJSON *ModuleInfoJSON
|
||||
@@ -1768,12 +1762,17 @@ type InstallFilesInfo struct {
|
||||
PackagingSpecs []PackagingSpec
|
||||
// katiInstalls tracks the install rules that were created by Soong but are being exported
|
||||
// to Make to convert to ninja rules so that Make can add additional dependencies.
|
||||
KatiInstalls katiInstalls
|
||||
KatiSymlinks katiInstalls
|
||||
TestData []DataPath
|
||||
// This was private before, make it private again once we have better solution.
|
||||
TransitiveInstallFiles *DepSet[InstallPath]
|
||||
KatiInstalls katiInstalls
|
||||
KatiSymlinks katiInstalls
|
||||
TestData []DataPath
|
||||
TransitivePackagingSpecs *DepSet[PackagingSpec]
|
||||
LicenseMetadataFile WritablePath
|
||||
|
||||
// The following fields are private before, make it private again once we have
|
||||
// better solution.
|
||||
TransitiveInstallFiles *DepSet[InstallPath]
|
||||
// The files to copy to the dist as explicitly specified in the .bp file.
|
||||
DistFiles TaggedDistFiles
|
||||
}
|
||||
|
||||
var InstallFilesProvider = blueprint.NewProvider[InstallFilesInfo]()
|
||||
@@ -1799,7 +1798,7 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
|
||||
|
||||
setContainerInfo(ctx)
|
||||
|
||||
m.licenseMetadataFile = PathForModuleOut(ctx, "meta_lic")
|
||||
ctx.licenseMetadataFile = PathForModuleOut(ctx, "meta_lic")
|
||||
|
||||
dependencyInstallFiles, dependencyPackagingSpecs := m.computeInstallDeps(ctx)
|
||||
// set the TransitiveInstallFiles to only the transitive dependencies to be used as the dependencies
|
||||
@@ -1967,11 +1966,12 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
|
||||
// as GenerateTaggedDistFiles() calls OutputFiles(tag) and so relies on the
|
||||
// output paths being set which must be done before or during
|
||||
// GenerateAndroidBuildActions.
|
||||
m.distFiles = m.GenerateTaggedDistFiles(ctx)
|
||||
installFiles.DistFiles = m.GenerateTaggedDistFiles(ctx)
|
||||
if ctx.Failed() {
|
||||
return
|
||||
}
|
||||
|
||||
installFiles.LicenseMetadataFile = ctx.licenseMetadataFile
|
||||
installFiles.InstallFiles = ctx.installFiles
|
||||
installFiles.CheckbuildFiles = ctx.checkbuildFiles
|
||||
installFiles.PackagingSpecs = ctx.packagingSpecs
|
||||
@@ -1999,7 +1999,7 @@ func (m *ModuleBase) GenerateBuildActions(blueprintCtx blueprint.ModuleContext)
|
||||
installFiles.TransitivePackagingSpecs = m.packagingSpecsDepSet
|
||||
|
||||
SetProvider(ctx, InstallFilesProvider, installFiles)
|
||||
buildLicenseMetadata(ctx, m.licenseMetadataFile)
|
||||
buildLicenseMetadata(ctx, ctx.licenseMetadataFile)
|
||||
|
||||
if m.moduleInfoJSON != nil {
|
||||
var installed InstallPaths
|
||||
|
@@ -246,6 +246,9 @@ type moduleContext struct {
|
||||
// apex containers.
|
||||
licenseInstallMap []string
|
||||
|
||||
// The path to the generated license metadata file for the module.
|
||||
licenseMetadataFile WritablePath
|
||||
|
||||
katiInstalls katiInstalls
|
||||
katiSymlinks katiInstalls
|
||||
|
||||
@@ -714,7 +717,7 @@ func (m *moduleContext) blueprintModuleContext() blueprint.ModuleContext {
|
||||
}
|
||||
|
||||
func (m *moduleContext) LicenseMetadataFile() Path {
|
||||
return m.module.base().licenseMetadataFile
|
||||
return m.licenseMetadataFile
|
||||
}
|
||||
|
||||
func (m *moduleContext) ModuleInfoJSON() *ModuleInfoJSON {
|
||||
|
@@ -36,10 +36,22 @@ func modulesOutputDirs(ctx BuilderContext, modules ...Module) []string {
|
||||
return SortedUniqueStrings(dirs)
|
||||
}
|
||||
|
||||
func modulesLicenseMetadata(ctx BuilderContext, modules ...Module) Paths {
|
||||
type BuilderAndOtherModuleProviderContext interface {
|
||||
BuilderContext
|
||||
OtherModuleProviderContext
|
||||
}
|
||||
|
||||
func modulesLicenseMetadata(ctx OtherModuleProviderContext, modules ...Module) Paths {
|
||||
result := make(Paths, 0, len(modules))
|
||||
mctx, isMctx := ctx.(ModuleContext)
|
||||
for _, module := range modules {
|
||||
if mf := module.base().licenseMetadataFile; mf != nil {
|
||||
var mf Path
|
||||
if isMctx && mctx.Module() == module {
|
||||
mf = mctx.LicenseMetadataFile()
|
||||
} else {
|
||||
mf = OtherModuleProviderOrDefault(ctx, module, InstallFilesProvider).LicenseMetadataFile
|
||||
}
|
||||
if mf != nil {
|
||||
result = append(result, mf)
|
||||
}
|
||||
}
|
||||
@@ -48,7 +60,7 @@ func modulesLicenseMetadata(ctx BuilderContext, modules ...Module) Paths {
|
||||
|
||||
// buildNoticeOutputFromLicenseMetadata writes out a notice file.
|
||||
func buildNoticeOutputFromLicenseMetadata(
|
||||
ctx BuilderContext, tool, ruleName string, outputFile WritablePath,
|
||||
ctx BuilderAndOtherModuleProviderContext, tool, ruleName string, outputFile WritablePath,
|
||||
libraryName string, stripPrefix []string, modules ...Module) {
|
||||
depsFile := outputFile.ReplaceExtension(ctx, strings.TrimPrefix(outputFile.Ext()+".d", "."))
|
||||
rule := NewRuleBuilder(pctx, ctx)
|
||||
@@ -84,7 +96,7 @@ func buildNoticeOutputFromLicenseMetadata(
|
||||
// on the license metadata files for the input `modules` defaulting to the
|
||||
// current context module if none given.
|
||||
func BuildNoticeTextOutputFromLicenseMetadata(
|
||||
ctx BuilderContext, outputFile WritablePath, ruleName, libraryName string,
|
||||
ctx BuilderAndOtherModuleProviderContext, outputFile WritablePath, ruleName, libraryName string,
|
||||
stripPrefix []string, modules ...Module) {
|
||||
buildNoticeOutputFromLicenseMetadata(ctx, "textnotice", "text_notice_"+ruleName,
|
||||
outputFile, libraryName, stripPrefix, modules...)
|
||||
@@ -94,7 +106,7 @@ func BuildNoticeTextOutputFromLicenseMetadata(
|
||||
// on the license metadata files for the input `modules` defaulting to the
|
||||
// current context module if none given.
|
||||
func BuildNoticeHtmlOutputFromLicenseMetadata(
|
||||
ctx BuilderContext, outputFile WritablePath, ruleName, libraryName string,
|
||||
ctx BuilderAndOtherModuleProviderContext, outputFile WritablePath, ruleName, libraryName string,
|
||||
stripPrefix []string, modules ...Module) {
|
||||
buildNoticeOutputFromLicenseMetadata(ctx, "htmlnotice", "html_notice_"+ruleName,
|
||||
outputFile, libraryName, stripPrefix, modules...)
|
||||
@@ -104,7 +116,7 @@ func BuildNoticeHtmlOutputFromLicenseMetadata(
|
||||
// on the license metadata files for the input `modules` defaulting to the
|
||||
// current context module if none given.
|
||||
func BuildNoticeXmlOutputFromLicenseMetadata(
|
||||
ctx BuilderContext, outputFile WritablePath, ruleName, libraryName string,
|
||||
ctx BuilderAndOtherModuleProviderContext, outputFile WritablePath, ruleName, libraryName string,
|
||||
stripPrefix []string, modules ...Module) {
|
||||
buildNoticeOutputFromLicenseMetadata(ctx, "xmlnotice", "xml_notice_"+ruleName,
|
||||
outputFile, libraryName, stripPrefix, modules...)
|
||||
|
Reference in New Issue
Block a user