From e2346b87d9bf3c3b94fcbc4a613e8ce7c35550b6 Mon Sep 17 00:00:00 2001 From: mrziwang Date: Mon, 10 Jun 2024 15:09:45 -0700 Subject: [PATCH] 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 --- apex/apex.go | 4 ++-- cc/llndk_library.go | 11 ++++------- cc/sanitize.go | 8 ++------ cc/vndk.go | 8 ++------ etc/prebuilt_etc.go | 4 ---- java/sdk_library.go | 7 ++----- linkerconfig/linkerconfig.go | 14 ++------------ 7 files changed, 14 insertions(+), 42 deletions(-) diff --git a/apex/apex.go b/apex/apex.go index e79afadc1..4c97fdb80 100644 --- a/apex/apex.go +++ b/apex/apex.go @@ -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)) } diff --git a/cc/llndk_library.go b/cc/llndk_library.go index 5b86c6478..d612e9e72 100644 --- a/cc/llndk_library.go +++ b/cc/llndk_library.go @@ -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" diff --git a/cc/sanitize.go b/cc/sanitize.go index e6075ada4..3abba8065 100644 --- a/cc/sanitize.go +++ b/cc/sanitize.go @@ -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" diff --git a/cc/vndk.go b/cc/vndk.go index ea55835e4..7141ea812 100644 --- a/cc/vndk.go +++ b/cc/vndk.go @@ -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" diff --git a/etc/prebuilt_etc.go b/etc/prebuilt_etc.go index fd3b27fb4..c1a0b9c60 100644 --- a/etc/prebuilt_etc.go +++ b/etc/prebuilt_etc.go @@ -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 { diff --git a/java/sdk_library.go b/java/sdk_library.go index 6c1a38d7d..e9fa83ae7 100644 --- a/java/sdk_library.go +++ b/java/sdk_library.go @@ -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 { diff --git a/linkerconfig/linkerconfig.go b/linkerconfig/linkerconfig.go index 98aa40805..3a8d3cfe3 100644 --- a/linkerconfig/linkerconfig.go +++ b/linkerconfig/linkerconfig.go @@ -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,