PrebuildEtcModule no longer implements OutputFiles method

In the context of incremental soong, the output files
inter-module-communication will be through OutputFilesProvider.
The OutputFileProducer interface will be deprecated.

These module types are included in this change:
linker_config
llndk_libraries_txt
sanitizer_libraries_txt
java_sdk_library_xml
vndksp_libraries_txt
vndkcore_libraries_txt
vndkprivate_libraries_txt
vndkpublic_libraries_txt

Test: CI
Bug: 339477385
Change-Id: I35575bbad137df5ff8001db9a61ba5b3d13eaa6d
This commit is contained in:
mrziwang 2024-06-10 15:09:45 -07:00
parent 0030148fcb
commit e2346b87d9
7 changed files with 14 additions and 42 deletions

View file

@ -2128,7 +2128,7 @@ func (a *apexBundle) depVisitor(vctx *visitorContext, ctx android.ModuleContext,
}
case prebuiltTag:
if prebuilt, ok := child.(prebuilt_etc.PrebuiltEtcModule); ok {
filesToCopy, _ := prebuilt.OutputFiles("")
filesToCopy := android.OutputFilesForModule(ctx, prebuilt, "")
for _, etcFile := range filesToCopy {
vctx.filesInfo = append(vctx.filesInfo, apexFileForPrebuiltEtc(ctx, prebuilt, etcFile))
}
@ -2274,7 +2274,7 @@ func (a *apexBundle) depVisitor(vctx *visitorContext, ctx android.ModuleContext,
// Because APK-in-APEX embeds jni_libs transitively, we don't need to track transitive deps
} else if java.IsXmlPermissionsFileDepTag(depTag) {
if prebuilt, ok := child.(prebuilt_etc.PrebuiltEtcModule); ok {
filesToCopy, _ := prebuilt.OutputFiles("")
filesToCopy := android.OutputFilesForModule(ctx, prebuilt, "")
for _, etcFile := range filesToCopy {
vctx.filesInfo = append(vctx.filesInfo, apexFileForPrebuiltEtc(ctx, prebuilt, etcFile))
}

View file

@ -15,9 +15,10 @@
package cc
import (
"strings"
"android/soong/android"
"android/soong/etc"
"strings"
)
var (
@ -96,7 +97,6 @@ type llndkLibrariesTxtModule struct {
}
var _ etc.PrebuiltEtcModule = &llndkLibrariesTxtModule{}
var _ android.OutputFileProducer = &llndkLibrariesTxtModule{}
// llndk_libraries_txt is a singleton module whose content is a list of LLNDK libraries
// generated by Soong but can be referenced by other modules.
@ -118,6 +118,8 @@ func (txt *llndkLibrariesTxtModule) GenerateAndroidBuildActions(ctx android.Modu
installPath := android.PathForModuleInstall(ctx, "etc")
ctx.InstallFile(installPath, filename, txt.outputFile)
ctx.SetOutputFiles(android.Paths{txt.outputFile}, "")
}
func (txt *llndkLibrariesTxtModule) GenerateSingletonBuildActions(ctx android.SingletonContext) {
@ -161,11 +163,6 @@ func (txt *llndkLibrariesTxtModule) MakeVars(ctx android.MakeVarsContext) {
ctx.Strict("LLNDK_LIBRARIES", strings.Join(txt.moduleNames, " "))
}
// PrebuiltEtcModule interface
func (txt *llndkLibrariesTxtModule) OutputFile() android.OutputPath {
return txt.outputFile
}
// PrebuiltEtcModule interface
func (txt *llndkLibrariesTxtModule) BaseDir() string {
return "etc"

View file

@ -1798,7 +1798,6 @@ type sanitizerLibrariesTxtModule struct {
}
var _ etc.PrebuiltEtcModule = (*sanitizerLibrariesTxtModule)(nil)
var _ android.OutputFileProducer = (*sanitizerLibrariesTxtModule)(nil)
func RegisterSanitizerLibrariesTxtType(ctx android.RegistrationContext) {
ctx.RegisterModuleType("sanitizer_libraries_txt", sanitizerLibrariesTxtFactory)
@ -1886,6 +1885,8 @@ func (txt *sanitizerLibrariesTxtModule) GenerateAndroidBuildActions(ctx android.
installPath := android.PathForModuleInstall(ctx, "etc")
ctx.InstallFile(installPath, filename, txt.outputFile)
ctx.SetOutputFiles(android.Paths{txt.outputFile}, "")
}
func (txt *sanitizerLibrariesTxtModule) AndroidMkEntries() []android.AndroidMkEntries {
@ -1895,11 +1896,6 @@ func (txt *sanitizerLibrariesTxtModule) AndroidMkEntries() []android.AndroidMkEn
}}
}
// PrebuiltEtcModule interface
func (txt *sanitizerLibrariesTxtModule) OutputFile() android.OutputPath {
return txt.outputFile
}
// PrebuiltEtcModule interface
func (txt *sanitizerLibrariesTxtModule) BaseDir() string {
return "etc"

View file

@ -396,7 +396,6 @@ type VndkLibrariesTxtProperties struct {
}
var _ etc.PrebuiltEtcModule = &vndkLibrariesTxt{}
var _ android.OutputFileProducer = &vndkLibrariesTxt{}
// vndksp_libraries_txt is a singleton module whose content is a list of VNDKSP libraries
// generated by Soong but can be referenced by other modules.
@ -455,6 +454,8 @@ func (txt *vndkLibrariesTxt) GenerateAndroidBuildActions(ctx android.ModuleConte
installPath := android.PathForModuleInstall(ctx, "etc")
ctx.InstallFile(installPath, filename, txt.outputFile)
ctx.SetOutputFiles(android.Paths{txt.outputFile}, "")
}
func (txt *vndkLibrariesTxt) GenerateSingletonBuildActions(ctx android.SingletonContext) {
@ -496,11 +497,6 @@ func (txt *vndkLibrariesTxt) MakeVars(ctx android.MakeVarsContext) {
ctx.Strict(txt.makeVarName, strings.Join(filter(txt.moduleNames, txt.filterOutFromMakeVar), " "))
}
// PrebuiltEtcModule interface
func (txt *vndkLibrariesTxt) OutputFile() android.OutputPath {
return txt.outputFile
}
// PrebuiltEtcModule interface
func (txt *vndkLibrariesTxt) BaseDir() string {
return "etc"

View file

@ -133,10 +133,6 @@ type PrebuiltEtcModule interface {
// Returns the sub install directory relative to BaseDir().
SubDir() string
// Returns an android.OutputPath to the intermediate file, which is the renamed prebuilt source
// file.
OutputFiles(tag string) (android.Paths, error)
}
type PrebuiltEtc struct {

View file

@ -3252,11 +3252,6 @@ func (module *sdkLibraryXml) SubDir() string {
return "permissions"
}
// from android.PrebuiltEtcModule
func (module *sdkLibraryXml) OutputFiles(tag string) (android.Paths, error) {
return android.OutputPaths{module.outputFilePath}.Paths(), nil
}
var _ etc.PrebuiltEtcModule = (*sdkLibraryXml)(nil)
// from android.ApexModule
@ -3400,6 +3395,8 @@ func (module *sdkLibraryXml) GenerateAndroidBuildActions(ctx android.ModuleConte
module.installDirPath = android.PathForModuleInstall(ctx, "etc", module.SubDir())
ctx.PackageFile(module.installDirPath, libName+".xml", module.outputFilePath)
ctx.SetOutputFiles(android.OutputPaths{module.outputFilePath}.Paths(), "")
}
func (module *sdkLibraryXml) AndroidMkEntries() []android.AndroidMkEntries {

View file

@ -15,7 +15,6 @@
package linkerconfig
import (
"fmt"
"sort"
"strings"
@ -73,17 +72,6 @@ func (l *linkerConfig) OutputFile() android.OutputPath {
return l.outputFilePath
}
var _ android.OutputFileProducer = (*linkerConfig)(nil)
func (l *linkerConfig) OutputFiles(tag string) (android.Paths, error) {
switch tag {
case "":
return android.Paths{l.outputFilePath}, nil
default:
return nil, fmt.Errorf("unsupported module reference tag %q", tag)
}
}
func (l *linkerConfig) GenerateAndroidBuildActions(ctx android.ModuleContext) {
input := android.PathForModuleSrc(ctx, android.String(l.properties.Src))
output := android.PathForModuleOut(ctx, "linker.config.pb").OutputPath
@ -98,6 +86,8 @@ func (l *linkerConfig) GenerateAndroidBuildActions(ctx android.ModuleContext) {
l.SkipInstall()
}
ctx.InstallFile(l.installDirPath, l.outputFilePath.Base(), l.outputFilePath)
ctx.SetOutputFiles(android.Paths{l.outputFilePath}, "")
}
func BuildLinkerConfig(ctx android.ModuleContext, builder *android.RuleBuilder,