summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Cole Faust <colefaust@google.com> 2024-11-13 16:09:23 -0800
committer Cole Faust <colefaust@google.com> 2024-11-13 16:48:50 -0800
commit4e9f5923c0e7cf0d7f845b90c7da65c24e44bcee (patch)
tree6d9fc3cdf89401a385e24e9e35ab67765cdef02d
parent06540bb808debb9efe410e518ce9f420bac9042c (diff)
Use fewer OutputPaths
A lot of the time, you really mean android.Path or android.WriteablePath instead of OutputPath. Also, many modules were holding onto OutputPaths/WriteablePaths after the files had already been generated, meaning they should no longer be treated as writable paths and are instead inputs into other actions. Change the type of those paths to just android.Path. Test: verified ninja files were unchanged on aosp_arm64-trunk_staging-userdebug Change-Id: Id773171bef59d855ba33c4b85cef268031cbec39
-rw-r--r--aconfig/build_flags/build_flags.go9
-rw-r--r--android/apex.go16
-rw-r--r--android/build_prop.go15
-rw-r--r--android/csuite_config.go4
-rw-r--r--android/product_config.go2
-rw-r--r--android/vintf_data.go4
-rw-r--r--android/vintf_fragment.go4
-rw-r--r--apex/apex.go2
-rw-r--r--apex/builder.go32
-rw-r--r--apex/prebuilt.go4
-rw-r--r--cc/cmake_snapshot.go2
-rw-r--r--cc/sanitize.go11
-rw-r--r--etc/adb_keys.go9
-rw-r--r--etc/otacerts_zip.go9
-rw-r--r--etc/prebuilt_etc.go12
-rw-r--r--filesystem/avb_add_hash_footer.go11
-rw-r--r--filesystem/avb_gen_vbmeta_image.go9
-rw-r--r--filesystem/bootimg.go24
-rw-r--r--filesystem/filesystem.go29
-rw-r--r--filesystem/fsverity_metadata.go6
-rw-r--r--filesystem/logical_partition.go29
-rw-r--r--filesystem/raw_binary.go10
-rw-r--r--filesystem/vbmeta.go14
-rw-r--r--java/app.go4
-rw-r--r--java/app_import.go8
-rw-r--r--java/dex.go21
-rw-r--r--java/platform_bootclasspath.go2
-rw-r--r--provenance/provenance_singleton.go6
-rw-r--r--sh/sh_binary.go2
29 files changed, 161 insertions, 149 deletions
diff --git a/aconfig/build_flags/build_flags.go b/aconfig/build_flags/build_flags.go
index e878b5aa6..94e1eb193 100644
--- a/aconfig/build_flags/build_flags.go
+++ b/aconfig/build_flags/build_flags.go
@@ -35,7 +35,7 @@ func registerBuildFlagsModuleType(ctx android.RegistrationContext) {
type buildFlags struct {
android.ModuleBase
- outputPath android.OutputPath
+ outputPath android.Path
}
func buildFlagsFactory() android.Module {
@@ -48,7 +48,7 @@ func (m *buildFlags) GenerateAndroidBuildActions(ctx android.ModuleContext) {
// Read the build_flags_<partition>.json file generated by soong
// 'release-config' command.
srcPath := android.PathForOutput(ctx, "release-config", fmt.Sprintf("build_flags_%s.json", m.PartitionTag(ctx.DeviceConfig())))
- m.outputPath = android.PathForModuleOut(ctx, outJsonFileName).OutputPath
+ outputPath := android.PathForModuleOut(ctx, outJsonFileName)
// The 'release-config' command is called for every build, and generates the
// build_flags_<partition>.json file.
@@ -56,11 +56,12 @@ func (m *buildFlags) GenerateAndroidBuildActions(ctx android.ModuleContext) {
ctx.Build(pctx, android.BuildParams{
Rule: android.CpIfChanged,
Input: srcPath,
- Output: m.outputPath,
+ Output: outputPath,
})
installPath := android.PathForModuleInstall(ctx, "etc")
- ctx.InstallFile(installPath, outJsonFileName, m.outputPath)
+ ctx.InstallFile(installPath, outJsonFileName, outputPath)
+ m.outputPath = outputPath
}
func (m *buildFlags) AndroidMkEntries() []android.AndroidMkEntries {
diff --git a/android/apex.go b/android/apex.go
index d14083363..9277ff31b 100644
--- a/android/apex.go
+++ b/android/apex.go
@@ -896,8 +896,8 @@ type ApexModuleDepInfo struct {
type DepNameToDepInfoMap map[string]ApexModuleDepInfo
type ApexBundleDepsInfo struct {
- flatListPath OutputPath
- fullListPath OutputPath
+ flatListPath Path
+ fullListPath Path
}
type ApexBundleDepsInfoIntf interface {
@@ -934,13 +934,15 @@ func (d *ApexBundleDepsInfo) BuildDepsInfoLists(ctx ModuleContext, minSdkVersion
fmt.Fprintf(&flatContent, "%s\n", toName)
}
- d.fullListPath = PathForModuleOut(ctx, "depsinfo", "fulllist.txt").OutputPath
- WriteFileRule(ctx, d.fullListPath, fullContent.String())
+ fullListPath := PathForModuleOut(ctx, "depsinfo", "fulllist.txt")
+ WriteFileRule(ctx, fullListPath, fullContent.String())
+ d.fullListPath = fullListPath
- d.flatListPath = PathForModuleOut(ctx, "depsinfo", "flatlist.txt").OutputPath
- WriteFileRule(ctx, d.flatListPath, flatContent.String())
+ flatListPath := PathForModuleOut(ctx, "depsinfo", "flatlist.txt")
+ WriteFileRule(ctx, flatListPath, flatContent.String())
+ d.flatListPath = flatListPath
- ctx.Phony(fmt.Sprintf("%s-depsinfo", ctx.ModuleName()), d.fullListPath, d.flatListPath)
+ ctx.Phony(fmt.Sprintf("%s-depsinfo", ctx.ModuleName()), fullListPath, flatListPath)
}
// Function called while walking an APEX's payload dependencies.
diff --git a/android/build_prop.go b/android/build_prop.go
index 270e4dedc..cda56f1e0 100644
--- a/android/build_prop.go
+++ b/android/build_prop.go
@@ -55,7 +55,7 @@ type buildPropModule struct {
properties buildPropProperties
- outputFilePath OutputPath
+ outputFilePath Path
installPath InstallPath
}
@@ -128,7 +128,7 @@ func (p *buildPropModule) GenerateAndroidBuildActions(ctx ModuleContext) {
ctx.ModuleErrorf("Android_info cannot be set if build.prop is not installed in vendor partition")
}
- p.outputFilePath = PathForModuleOut(ctx, "build.prop").OutputPath
+ outputFilePath := PathForModuleOut(ctx, "build.prop")
partition := p.partition(ctx.DeviceConfig())
@@ -157,7 +157,7 @@ func (p *buildPropModule) GenerateAndroidBuildActions(ctx ModuleContext) {
cmd.FlagWithInput("--product-config=", PathForModuleSrc(ctx, proptools.String(p.properties.Product_config)))
cmd.FlagWithArg("--partition=", partition)
cmd.FlagForEachInput("--prop-files=", p.propFiles(ctx))
- cmd.FlagWithOutput("--out=", p.outputFilePath)
+ cmd.FlagWithOutput("--out=", outputFilePath)
postProcessCmd := rule.Command().BuiltTool("post_process_props")
if ctx.DeviceConfig().BuildBrokenDupSysprop() {
@@ -170,17 +170,18 @@ func (p *buildPropModule) GenerateAndroidBuildActions(ctx ModuleContext) {
// still need to pass an empty string to kernel-version-file-for-uffd-gc
postProcessCmd.FlagWithArg("--kernel-version-file-for-uffd-gc ", `""`)
}
- postProcessCmd.Text(p.outputFilePath.String())
+ postProcessCmd.Text(outputFilePath.String())
postProcessCmd.Flags(p.properties.Block_list)
- rule.Command().Text("echo").Text(proptools.NinjaAndShellEscape("# end of file")).FlagWithArg(">> ", p.outputFilePath.String())
+ rule.Command().Text("echo").Text(proptools.NinjaAndShellEscape("# end of file")).FlagWithArg(">> ", outputFilePath.String())
rule.Build(ctx.ModuleName(), "generating build.prop")
p.installPath = PathForModuleInstall(ctx, proptools.String(p.properties.Relative_install_path))
- ctx.InstallFile(p.installPath, p.stem(), p.outputFilePath)
+ ctx.InstallFile(p.installPath, p.stem(), outputFilePath)
- ctx.SetOutputFiles(Paths{p.outputFilePath}, "")
+ ctx.SetOutputFiles(Paths{outputFilePath}, "")
+ p.outputFilePath = outputFilePath
}
func (p *buildPropModule) AndroidMkEntries() []AndroidMkEntries {
diff --git a/android/csuite_config.go b/android/csuite_config.go
index 20bd03563..26ad6e180 100644
--- a/android/csuite_config.go
+++ b/android/csuite_config.go
@@ -30,11 +30,11 @@ type csuiteConfigProperties struct {
type CSuiteConfig struct {
ModuleBase
properties csuiteConfigProperties
- OutputFilePath OutputPath
+ OutputFilePath Path
}
func (me *CSuiteConfig) GenerateAndroidBuildActions(ctx ModuleContext) {
- me.OutputFilePath = PathForModuleOut(ctx, me.BaseModuleName()).OutputPath
+ me.OutputFilePath = PathForModuleOut(ctx, me.BaseModuleName())
}
func (me *CSuiteConfig) AndroidMkEntries() []AndroidMkEntries {
diff --git a/android/product_config.go b/android/product_config.go
index ce3acc9f2..850f00334 100644
--- a/android/product_config.go
+++ b/android/product_config.go
@@ -32,7 +32,7 @@ func (p *productConfigModule) GenerateAndroidBuildActions(ctx ModuleContext) {
ctx.ModuleErrorf("There can only be one product_config module in build/soong")
return
}
- outputFilePath := PathForModuleOut(ctx, p.Name()+".json").OutputPath
+ outputFilePath := PathForModuleOut(ctx, p.Name()+".json")
// DeviceProduct can be null so calling ctx.Config().DeviceProduct() may cause null dereference
targetProduct := proptools.String(ctx.Config().config.productVariables.DeviceProduct)
diff --git a/android/vintf_data.go b/android/vintf_data.go
index 7823397e0..401f4d2e5 100644
--- a/android/vintf_data.go
+++ b/android/vintf_data.go
@@ -49,7 +49,7 @@ type vintfDataRule struct {
properties vintfDataProperties
installDirPath InstallPath
- outputFilePath OutputPath
+ outputFilePath Path
noAction bool
}
@@ -148,7 +148,7 @@ func (m *vintfDataRule) GenerateAndroidBuildActions(ctx ModuleContext) {
builder.Build("assemble_vintf", "Process vintf data "+gensrc.String())
m.installDirPath = PathForModuleInstall(ctx, "etc", "vintf")
- m.outputFilePath = gensrc.OutputPath
+ m.outputFilePath = gensrc
installFileName := "manifest.xml"
if filename := proptools.String(m.properties.Filename); filename != "" {
diff --git a/android/vintf_fragment.go b/android/vintf_fragment.go
index 42eaaf01a..a3343fd5a 100644
--- a/android/vintf_fragment.go
+++ b/android/vintf_fragment.go
@@ -25,7 +25,7 @@ type vintfFragmentModule struct {
properties vintfFragmentProperties
installDirPath InstallPath
- outputFilePath OutputPath
+ outputFilePath Path
}
func init() {
@@ -64,7 +64,7 @@ func (m *vintfFragmentModule) GenerateAndroidBuildActions(ctx ModuleContext) {
builder.Build("assemble_vintf", "Process vintf fragment "+processedVintfFragment.String())
m.installDirPath = PathForModuleInstall(ctx, "etc", "vintf", "manifest")
- m.outputFilePath = processedVintfFragment.OutputPath
+ m.outputFilePath = processedVintfFragment
ctx.InstallFile(m.installDirPath, processedVintfFragment.Base(), processedVintfFragment)
}
diff --git a/apex/apex.go b/apex/apex.go
index e0195d3c0..dc24df3d1 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -511,7 +511,7 @@ type apexBundle struct {
// Text file having the list of individual files that are included in this APEX. Used for
// debugging purpose.
- installedFilesFile android.WritablePath
+ installedFilesFile android.Path
// List of module names that this APEX is including (to be shown via *-deps-info target).
// Used for debugging purpose.
diff --git a/apex/builder.go b/apex/builder.go
index b04a9d729..4585cbbe3 100644
--- a/apex/builder.go
+++ b/apex/builder.go
@@ -388,7 +388,7 @@ func (a *apexBundle) buildManifest(ctx android.ModuleContext, provideNativeLibs,
// file for this APEX which is either from /systme/sepolicy/apex/<apexname>-file_contexts or from
// the file_contexts property of this APEX. This is to make sure that the manifest file is correctly
// labeled as system_file or vendor_apex_metadata_file.
-func (a *apexBundle) buildFileContexts(ctx android.ModuleContext) android.OutputPath {
+func (a *apexBundle) buildFileContexts(ctx android.ModuleContext) android.Path {
var fileContexts android.Path
var fileContextsDir string
isFileContextsModule := false
@@ -443,13 +443,13 @@ func (a *apexBundle) buildFileContexts(ctx android.ModuleContext) android.Output
}
rule.Build("file_contexts."+a.Name(), "Generate file_contexts")
- return output.OutputPath
+ return output
}
// buildInstalledFilesFile creates a build rule for the installed-files.txt file where the list of
// files included in this APEX is shown. The text file is dist'ed so that people can see what's
// included in the APEX without actually downloading and extracting it.
-func (a *apexBundle) buildInstalledFilesFile(ctx android.ModuleContext, builtApex android.Path, imageDir android.Path) android.OutputPath {
+func (a *apexBundle) buildInstalledFilesFile(ctx android.ModuleContext, builtApex android.Path, imageDir android.Path) android.Path {
output := android.PathForModuleOut(ctx, "installed-files.txt")
rule := android.NewRuleBuilder(pctx, ctx)
rule.Command().
@@ -459,12 +459,12 @@ func (a *apexBundle) buildInstalledFilesFile(ctx android.ModuleContext, builtApe
Text(" | sort -nr > ").
Output(output)
rule.Build("installed-files."+a.Name(), "Installed files")
- return output.OutputPath
+ return output
}
// buildBundleConfig creates a build rule for the bundle config file that will control the bundle
// creation process.
-func (a *apexBundle) buildBundleConfig(ctx android.ModuleContext) android.OutputPath {
+func (a *apexBundle) buildBundleConfig(ctx android.ModuleContext) android.Path {
output := android.PathForModuleOut(ctx, "bundle_config.json")
type ApkConfig struct {
@@ -509,7 +509,7 @@ func (a *apexBundle) buildBundleConfig(ctx android.ModuleContext) android.Output
android.WriteFileRule(ctx, output, string(j))
- return output.OutputPath
+ return output
}
func markManifestTestOnly(ctx android.ModuleContext, androidManifestFile android.Path) android.Path {
@@ -922,17 +922,17 @@ func (a *apexBundle) buildApex(ctx android.ModuleContext) {
args["outCommaList"] = signedOutputFile.String()
}
var validations android.Paths
- validations = append(validations, runApexLinkerconfigValidation(ctx, unsignedOutputFile.OutputPath, imageDir.OutputPath))
+ validations = append(validations, runApexLinkerconfigValidation(ctx, unsignedOutputFile, imageDir))
// TODO(b/279688635) deapexer supports [ext4]
if !a.testApex && suffix == imageApexSuffix && ext4 == a.payloadFsType {
- validations = append(validations, runApexSepolicyTests(ctx, unsignedOutputFile.OutputPath))
+ validations = append(validations, runApexSepolicyTests(ctx, unsignedOutputFile))
}
if !a.testApex && len(a.properties.Unwanted_transitive_deps) > 0 {
validations = append(validations,
- runApexElfCheckerUnwanted(ctx, unsignedOutputFile.OutputPath, a.properties.Unwanted_transitive_deps))
+ runApexElfCheckerUnwanted(ctx, unsignedOutputFile, a.properties.Unwanted_transitive_deps))
}
if !a.testApex && android.InList(a.payloadFsType, []fsType{ext4, erofs}) {
- validations = append(validations, runApexHostVerifier(ctx, a, unsignedOutputFile.OutputPath))
+ validations = append(validations, runApexHostVerifier(ctx, a, unsignedOutputFile))
}
ctx.Build(pctx, android.BuildParams{
Rule: rule,
@@ -1135,7 +1135,7 @@ func (a *apexBundle) buildLintReports(ctx android.ModuleContext) {
a.lintReports = java.BuildModuleLintReportZips(ctx, depSets, validations)
}
-func (a *apexBundle) buildCannedFsConfig(ctx android.ModuleContext) android.OutputPath {
+func (a *apexBundle) buildCannedFsConfig(ctx android.ModuleContext) android.Path {
var readOnlyPaths = []string{"apex_manifest.json", "apex_manifest.pb"}
var executablePaths []string // this also includes dirs
var appSetDirs []string
@@ -1199,10 +1199,10 @@ func (a *apexBundle) buildCannedFsConfig(ctx android.ModuleContext) android.Outp
cmd.Text(")").FlagWithOutput("> ", cannedFsConfig)
builder.Build("generateFsConfig", fmt.Sprintf("Generating canned fs config for %s", a.BaseModuleName()))
- return cannedFsConfig.OutputPath
+ return cannedFsConfig
}
-func runApexLinkerconfigValidation(ctx android.ModuleContext, apexFile android.OutputPath, imageDir android.OutputPath) android.Path {
+func runApexLinkerconfigValidation(ctx android.ModuleContext, apexFile android.Path, imageDir android.Path) android.Path {
timestamp := android.PathForModuleOut(ctx, "apex_linkerconfig_validation.timestamp")
ctx.Build(pctx, android.BuildParams{
Rule: apexLinkerconfigValidationRule,
@@ -1219,7 +1219,7 @@ func runApexLinkerconfigValidation(ctx android.ModuleContext, apexFile android.O
//
// $ deapexer list -Z {apex_file} > {file_contexts}
// $ apex_sepolicy_tests -f {file_contexts}
-func runApexSepolicyTests(ctx android.ModuleContext, apexFile android.OutputPath) android.Path {
+func runApexSepolicyTests(ctx android.ModuleContext, apexFile android.Path) android.Path {
timestamp := android.PathForModuleOut(ctx, "sepolicy_tests.timestamp")
ctx.Build(pctx, android.BuildParams{
Rule: apexSepolicyTestsRule,
@@ -1229,7 +1229,7 @@ func runApexSepolicyTests(ctx android.ModuleContext, apexFile android.OutputPath
return timestamp
}
-func runApexElfCheckerUnwanted(ctx android.ModuleContext, apexFile android.OutputPath, unwanted []string) android.Path {
+func runApexElfCheckerUnwanted(ctx android.ModuleContext, apexFile android.Path, unwanted []string) android.Path {
timestamp := android.PathForModuleOut(ctx, "apex_elf_unwanted.timestamp")
ctx.Build(pctx, android.BuildParams{
Rule: apexElfCheckerUnwantedRule,
@@ -1243,7 +1243,7 @@ func runApexElfCheckerUnwanted(ctx android.ModuleContext, apexFile android.Outpu
return timestamp
}
-func runApexHostVerifier(ctx android.ModuleContext, a *apexBundle, apexFile android.OutputPath) android.Path {
+func runApexHostVerifier(ctx android.ModuleContext, a *apexBundle, apexFile android.Path) android.Path {
timestamp := android.PathForModuleOut(ctx, "host_apex_verifier.timestamp")
ctx.Build(pctx, android.BuildParams{
Rule: apexHostVerifierRule,
diff --git a/apex/prebuilt.go b/apex/prebuilt.go
index 9cd5688ba..acf3b91fe 100644
--- a/apex/prebuilt.go
+++ b/apex/prebuilt.go
@@ -386,7 +386,7 @@ type Prebuilt struct {
inputApex android.Path
- provenanceMetaDataFile android.OutputPath
+ provenanceMetaDataFile android.Path
}
type ApexFileProperties struct {
@@ -697,7 +697,7 @@ func (p *Prebuilt) GenerateAndroidBuildActions(ctx android.ModuleContext) {
ctx.SetOutputFiles(android.Paths{p.outputApex}, "")
}
-func (p *Prebuilt) ProvenanceMetaDataFile() android.OutputPath {
+func (p *Prebuilt) ProvenanceMetaDataFile() android.Path {
return p.provenanceMetaDataFile
}
diff --git a/cc/cmake_snapshot.go b/cc/cmake_snapshot.go
index 790a865d7..f553f27be 100644
--- a/cc/cmake_snapshot.go
+++ b/cc/cmake_snapshot.go
@@ -484,7 +484,7 @@ func (m *CmakeSnapshot) GenerateAndroidBuildActions(ctx android.ModuleContext) {
// Packaging all make files into the zip file
makefilesRspFile := android.PathForModuleObj(ctx, ctx.ModuleName()+"_makefiles.rsp")
zipCmd.
- FlagWithArg("-C ", android.PathForModuleGen(ctx).OutputPath.String()).
+ FlagWithArg("-C ", android.PathForModuleGen(ctx).String()).
FlagWithRspFileInputList("-r ", makefilesRspFile, makefilesList)
// Packaging all prebuilts into the zip file
diff --git a/cc/sanitize.go b/cc/sanitize.go
index 124dda4ab..f0d734376 100644
--- a/cc/sanitize.go
+++ b/cc/sanitize.go
@@ -1813,7 +1813,7 @@ func memtagStackMakeVarsProvider(ctx android.MakeVarsContext) {
type sanitizerLibrariesTxtModule struct {
android.ModuleBase
- outputFile android.OutputPath
+ outputFile android.Path
}
var _ etc.PrebuiltEtcModule = (*sanitizerLibrariesTxtModule)(nil)
@@ -1896,13 +1896,14 @@ func (txt *sanitizerLibrariesTxtModule) getSanitizerLibs(ctx android.ModuleConte
func (txt *sanitizerLibrariesTxtModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
filename := txt.Name()
- txt.outputFile = android.PathForModuleOut(ctx, filename).OutputPath
- android.WriteFileRule(ctx, txt.outputFile, txt.getSanitizerLibs(ctx))
+ outputFile := android.PathForModuleOut(ctx, filename)
+ android.WriteFileRule(ctx, outputFile, txt.getSanitizerLibs(ctx))
installPath := android.PathForModuleInstall(ctx, "etc")
- ctx.InstallFile(installPath, filename, txt.outputFile)
+ ctx.InstallFile(installPath, filename, outputFile)
- ctx.SetOutputFiles(android.Paths{txt.outputFile}, "")
+ ctx.SetOutputFiles(android.Paths{outputFile}, "")
+ txt.outputFile = outputFile
}
func (txt *sanitizerLibrariesTxtModule) PrepareAndroidMKProviderInfo(config android.Config) *android.AndroidMkProviderInfo {
diff --git a/etc/adb_keys.go b/etc/adb_keys.go
index 73bc3478f..cfcb1d502 100644
--- a/etc/adb_keys.go
+++ b/etc/adb_keys.go
@@ -24,7 +24,7 @@ func init() {
type AdbKeysModule struct {
android.ModuleBase
- outputPath android.OutputPath
+ outputPath android.Path
installPath android.InstallPath
}
@@ -46,15 +46,16 @@ func (m *AdbKeysModule) GenerateAndroidBuildActions(ctx android.ModuleContext) {
return
}
- m.outputPath = android.PathForModuleOut(ctx, "adb_keys").OutputPath
+ outputPath := android.PathForModuleOut(ctx, "adb_keys")
input := android.ExistentPathForSource(ctx, android.String(productVariables.AdbKeys))
ctx.Build(pctx, android.BuildParams{
Rule: android.Cp,
- Output: m.outputPath,
+ Output: outputPath,
Input: input.Path(),
})
m.installPath = android.PathForModuleInstall(ctx, "etc/security")
- ctx.InstallFile(m.installPath, "adb_keys", m.outputPath)
+ ctx.InstallFile(m.installPath, "adb_keys", outputPath)
+ m.outputPath = outputPath
}
func (m *AdbKeysModule) AndroidMkEntries() []android.AndroidMkEntries {
diff --git a/etc/otacerts_zip.go b/etc/otacerts_zip.go
index d12bdac7b..8220cea4c 100644
--- a/etc/otacerts_zip.go
+++ b/etc/otacerts_zip.go
@@ -44,7 +44,7 @@ type otacertsZipModule struct {
android.ModuleBase
properties otacertsZipProperties
- outputPath android.OutputPath
+ outputPath android.Path
}
// otacerts_zip collects key files defined in PRODUCT_DEFAULT_DEV_CERTIFICATE
@@ -117,11 +117,11 @@ func (m *otacertsZipModule) GenerateAndroidBuildActions(ctx android.ModuleContex
// Read .x509.pem files listed in PRODUCT_EXTRA_OTA_KEYS or PRODUCT_EXTRA_RECOVERY_KEYS.
extras := ctx.Config().ExtraOtaKeys(ctx, m.InRecovery())
srcPaths := append([]android.SourcePath{pem}, extras...)
- m.outputPath = android.PathForModuleOut(ctx, m.outputFileName()).OutputPath
+ outputPath := android.PathForModuleOut(ctx, m.outputFileName())
rule := android.NewRuleBuilder(pctx, ctx)
cmd := rule.Command().BuiltTool("soong_zip").
- FlagWithOutput("-o ", m.outputPath).
+ FlagWithOutput("-o ", outputPath).
Flag("-j ").
Flag("-symlinks=false ")
for _, src := range srcPaths {
@@ -130,7 +130,8 @@ func (m *otacertsZipModule) GenerateAndroidBuildActions(ctx android.ModuleContex
rule.Build(ctx.ModuleName(), "Generating the otacerts zip file")
installPath := android.PathForModuleInstall(ctx, "etc", proptools.String(m.properties.Relative_install_path))
- ctx.InstallFile(installPath, m.outputFileName(), m.outputPath)
+ ctx.InstallFile(installPath, m.outputFileName(), outputPath)
+ m.outputPath = outputPath
}
func (m *otacertsZipModule) AndroidMkEntries() []android.AndroidMkEntries {
diff --git a/etc/prebuilt_etc.go b/etc/prebuilt_etc.go
index 943ec817d..b0b5da946 100644
--- a/etc/prebuilt_etc.go
+++ b/etc/prebuilt_etc.go
@@ -184,7 +184,7 @@ type PrebuiltEtc struct {
subdirProperties prebuiltSubdirProperties
sourceFilePaths android.Paths
- outputFilePaths android.OutputPaths
+ outputFilePaths android.WritablePaths
// The base install location, e.g. "etc" for prebuilt_etc, "usr/share" for prebuilt_usr_share.
installDirBase string
installDirBase64 string
@@ -317,7 +317,7 @@ func (p *PrebuiltEtc) SetAdditionalDependencies(paths android.Paths) {
p.additionalDependencies = &paths
}
-func (p *PrebuiltEtc) OutputFile() android.OutputPath {
+func (p *PrebuiltEtc) OutputFile() android.Path {
if p.usedSrcsProperty {
panic(fmt.Errorf("OutputFile not available on multi-source prebuilt %q", p.Name()))
}
@@ -410,7 +410,7 @@ func (p *PrebuiltEtc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
ctx.PropertyErrorf("filename", "filename cannot contain separator '/'")
return
}
- p.outputFilePaths = android.OutputPaths{android.PathForModuleOut(ctx, filename).OutputPath}
+ p.outputFilePaths = android.WritablePaths{android.PathForModuleOut(ctx, filename)}
ip := installProperties{
filename: filename,
@@ -453,7 +453,7 @@ func (p *PrebuiltEtc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
filename = src.Base()
installDirPath = baseInstallDirPath
}
- output := android.PathForModuleOut(ctx, filename).OutputPath
+ output := android.PathForModuleOut(ctx, filename)
ip := installProperties{
filename: filename,
sourceFilePath: src,
@@ -473,7 +473,7 @@ func (p *PrebuiltEtc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
if filename == "" {
filename = ctx.ModuleName()
}
- p.outputFilePaths = android.OutputPaths{android.PathForModuleOut(ctx, filename).OutputPath}
+ p.outputFilePaths = android.WritablePaths{android.PathForModuleOut(ctx, filename)}
ip := installProperties{
filename: filename,
sourceFilePath: p.sourceFilePaths[0],
@@ -501,7 +501,7 @@ func (p *PrebuiltEtc) GenerateAndroidBuildActions(ctx android.ModuleContext) {
type installProperties struct {
filename string
sourceFilePath android.Path
- outputFilePath android.OutputPath
+ outputFilePath android.WritablePath
installDirPath android.InstallPath
symlinks []string
}
diff --git a/filesystem/avb_add_hash_footer.go b/filesystem/avb_add_hash_footer.go
index 469f1fb0a..9d4ba3e95 100644
--- a/filesystem/avb_add_hash_footer.go
+++ b/filesystem/avb_add_hash_footer.go
@@ -29,7 +29,7 @@ type avbAddHashFooter struct {
properties avbAddHashFooterProperties
- output android.OutputPath
+ output android.Path
installDir android.InstallPath
}
@@ -97,8 +97,8 @@ func (a *avbAddHashFooter) GenerateAndroidBuildActions(ctx android.ModuleContext
return
}
input := android.PathForModuleSrc(ctx, proptools.String(a.properties.Src))
- a.output = android.PathForModuleOut(ctx, a.installFileName()).OutputPath
- builder.Command().Text("cp").Input(input).Output(a.output)
+ output := android.PathForModuleOut(ctx, a.installFileName())
+ builder.Command().Text("cp").Input(input).Output(output)
cmd := builder.Command().BuiltTool("avbtool").Text("add_hash_footer")
@@ -141,12 +141,13 @@ func (a *avbAddHashFooter) GenerateAndroidBuildActions(ctx android.ModuleContext
cmd.Flag(fmt.Sprintf(" --rollback_index %d", rollbackIndex))
}
- cmd.FlagWithOutput("--image ", a.output)
+ cmd.FlagWithOutput("--image ", output)
builder.Build("avbAddHashFooter", fmt.Sprintf("avbAddHashFooter %s", ctx.ModuleName()))
a.installDir = android.PathForModuleInstall(ctx, "etc")
- ctx.InstallFile(a.installDir, a.installFileName(), a.output)
+ ctx.InstallFile(a.installDir, a.installFileName(), output)
+ a.output = output
}
func addAvbProp(ctx android.ModuleContext, cmd *android.RuleBuilderCommand, prop avbProp) {
diff --git a/filesystem/avb_gen_vbmeta_image.go b/filesystem/avb_gen_vbmeta_image.go
index a7fd7829e..0669a2c20 100644
--- a/filesystem/avb_gen_vbmeta_image.go
+++ b/filesystem/avb_gen_vbmeta_image.go
@@ -28,7 +28,7 @@ type avbGenVbmetaImage struct {
properties avbGenVbmetaImageProperties
- output android.OutputPath
+ output android.Path
installDir android.InstallPath
}
@@ -78,11 +78,12 @@ func (a *avbGenVbmetaImage) GenerateAndroidBuildActions(ctx android.ModuleContex
}
cmd.FlagWithArg("--salt ", proptools.String(a.properties.Salt))
- a.output = android.PathForModuleOut(ctx, a.installFileName()).OutputPath
- cmd.FlagWithOutput("--output_vbmeta_image ", a.output)
+ output := android.PathForModuleOut(ctx, a.installFileName())
+ cmd.FlagWithOutput("--output_vbmeta_image ", output)
builder.Build("avbGenVbmetaImage", fmt.Sprintf("avbGenVbmetaImage %s", ctx.ModuleName()))
- ctx.SetOutputFiles([]android.Path{a.output}, "")
+ ctx.SetOutputFiles([]android.Path{output}, "")
+ a.output = output
}
var _ android.AndroidMkEntriesProvider = (*avbGenVbmetaImage)(nil)
diff --git a/filesystem/bootimg.go b/filesystem/bootimg.go
index 9d9392596..c9bd61788 100644
--- a/filesystem/bootimg.go
+++ b/filesystem/bootimg.go
@@ -34,7 +34,7 @@ type bootimg struct {
properties bootimgProperties
- output android.OutputPath
+ output android.Path
installDir android.InstallPath
}
@@ -115,20 +115,20 @@ func (b *bootimg) GenerateAndroidBuildActions(ctx android.ModuleContext) {
vendor := proptools.Bool(b.properties.Vendor_boot)
unsignedOutput := b.buildBootImage(ctx, vendor)
+ output := unsignedOutput
if proptools.Bool(b.properties.Use_avb) {
- b.output = b.signImage(ctx, unsignedOutput)
- } else {
- b.output = unsignedOutput
+ output = b.signImage(ctx, unsignedOutput)
}
b.installDir = android.PathForModuleInstall(ctx, "etc")
- ctx.InstallFile(b.installDir, b.installFileName(), b.output)
+ ctx.InstallFile(b.installDir, b.installFileName(), output)
- ctx.SetOutputFiles([]android.Path{b.output}, "")
+ ctx.SetOutputFiles([]android.Path{output}, "")
+ b.output = output
}
-func (b *bootimg) buildBootImage(ctx android.ModuleContext, vendor bool) android.OutputPath {
- output := android.PathForModuleOut(ctx, "unsigned", b.installFileName()).OutputPath
+func (b *bootimg) buildBootImage(ctx android.ModuleContext, vendor bool) android.Path {
+ output := android.PathForModuleOut(ctx, "unsigned", b.installFileName())
builder := android.NewRuleBuilder(pctx, ctx)
cmd := builder.Command().BuiltTool("mkbootimg")
@@ -215,10 +215,10 @@ func (b *bootimg) buildBootImage(ctx android.ModuleContext, vendor bool) android
return output
}
-func (b *bootimg) signImage(ctx android.ModuleContext, unsignedImage android.OutputPath) android.OutputPath {
+func (b *bootimg) signImage(ctx android.ModuleContext, unsignedImage android.Path) android.Path {
propFile, toolDeps := b.buildPropFile(ctx)
- output := android.PathForModuleOut(ctx, b.installFileName()).OutputPath
+ output := android.PathForModuleOut(ctx, b.installFileName())
builder := android.NewRuleBuilder(pctx, ctx)
builder.Command().Text("cp").Input(unsignedImage).Output(output)
builder.Command().BuiltTool("verity_utils").
@@ -239,7 +239,7 @@ func (b *bootimg) salt() string {
return sha1sum(input)
}
-func (b *bootimg) buildPropFile(ctx android.ModuleContext) (propFile android.OutputPath, toolDeps android.Paths) {
+func (b *bootimg) buildPropFile(ctx android.ModuleContext) (android.Path, android.Paths) {
var sb strings.Builder
var deps android.Paths
addStr := func(name string, value string) {
@@ -261,7 +261,7 @@ func (b *bootimg) buildPropFile(ctx android.ModuleContext) (propFile android.Out
addStr("partition_name", partitionName)
addStr("avb_salt", b.salt())
- propFile = android.PathForModuleOut(ctx, "prop").OutputPath
+ propFile := android.PathForModuleOut(ctx, "prop")
android.WriteFileRule(ctx, propFile, sb.String())
return propFile, deps
}
diff --git a/filesystem/filesystem.go b/filesystem/filesystem.go
index fa6645187..c34677060 100644
--- a/filesystem/filesystem.go
+++ b/filesystem/filesystem.go
@@ -52,10 +52,10 @@ type filesystem struct {
properties FilesystemProperties
- output android.OutputPath
+ output android.Path
installDir android.InstallPath
- fileListFile android.OutputPath
+ fileListFile android.Path
// Keeps the entries installed from this filesystem
entries []string
@@ -340,19 +340,20 @@ func (f *filesystem) GenerateAndroidBuildActions(ctx android.ModuleContext) {
ctx.InstallFile(f.installDir, f.installFileName(), f.output)
ctx.SetOutputFiles([]android.Path{f.output}, "")
- f.fileListFile = android.PathForModuleOut(ctx, "fileList").OutputPath
- android.WriteFileRule(ctx, f.fileListFile, f.installedFilesList())
+ fileListFile := android.PathForModuleOut(ctx, "fileList")
+ android.WriteFileRule(ctx, fileListFile, f.installedFilesList())
android.SetProvider(ctx, FilesystemProvider, FilesystemInfo{
- FileListFile: f.fileListFile,
+ FileListFile: fileListFile,
})
+ f.fileListFile = fileListFile
if proptools.Bool(f.properties.Unchecked_module) {
ctx.UncheckedModule()
}
}
-func (f *filesystem) appendToEntry(ctx android.ModuleContext, installedFile android.OutputPath) {
+func (f *filesystem) appendToEntry(ctx android.ModuleContext, installedFile android.Path) {
partitionBaseDir := android.PathForModuleOut(ctx, "root", f.partitionName()).String() + "/"
relPath, inTargetPartition := strings.CutPrefix(installedFile.String(), partitionBaseDir)
@@ -443,7 +444,7 @@ func (f *filesystem) copyFilesToProductOut(ctx android.ModuleContext, builder *a
builder.Command().Textf("cp -prf %s/* %s", rebasedDir, installPath)
}
-func (f *filesystem) buildImageUsingBuildImage(ctx android.ModuleContext) android.OutputPath {
+func (f *filesystem) buildImageUsingBuildImage(ctx android.ModuleContext) android.Path {
rootDir := android.PathForModuleOut(ctx, "root").OutputPath
rebasedDir := rootDir
if f.properties.Base_dir != nil {
@@ -472,7 +473,7 @@ func (f *filesystem) buildImageUsingBuildImage(ctx android.ModuleContext) androi
FlagWithArg("--out_system=", rootDir.String()+"/system")
propFile, toolDeps := f.buildPropFile(ctx)
- output := android.PathForModuleOut(ctx, f.installFileName()).OutputPath
+ output := android.PathForModuleOut(ctx, f.installFileName())
builder.Command().BuiltTool("build_image").
Text(rootDir.String()). // input directory
Input(propFile).
@@ -486,14 +487,14 @@ func (f *filesystem) buildImageUsingBuildImage(ctx android.ModuleContext) androi
return output
}
-func (f *filesystem) buildFileContexts(ctx android.ModuleContext) android.OutputPath {
+func (f *filesystem) buildFileContexts(ctx android.ModuleContext) android.Path {
builder := android.NewRuleBuilder(pctx, ctx)
fcBin := android.PathForModuleOut(ctx, "file_contexts.bin")
builder.Command().BuiltTool("sefcontext_compile").
FlagWithOutput("-o ", fcBin).
Input(android.PathForModuleSrc(ctx, proptools.String(f.properties.File_contexts)))
builder.Build("build_filesystem_file_contexts", fmt.Sprintf("Creating filesystem file contexts for %s", f.BaseModuleName()))
- return fcBin.OutputPath
+ return fcBin
}
// Calculates avb_salt from entry list (sorted) for deterministic output.
@@ -501,7 +502,7 @@ func (f *filesystem) salt() string {
return sha1sum(f.entries)
}
-func (f *filesystem) buildPropFile(ctx android.ModuleContext) (propFile android.OutputPath, toolDeps android.Paths) {
+func (f *filesystem) buildPropFile(ctx android.ModuleContext) (android.Path, android.Paths) {
var deps android.Paths
var propFileString strings.Builder
addStr := func(name string, value string) {
@@ -597,7 +598,7 @@ func (f *filesystem) buildPropFile(ctx android.ModuleContext) (propFile android.
}
f.checkFsTypePropertyError(ctx, fst, fsTypeStr(fst))
- propFile = android.PathForModuleOut(ctx, "prop").OutputPath
+ propFile := android.PathForModuleOut(ctx, "prop")
android.WriteFileRuleVerbatim(ctx, propFile, propFileString.String())
return propFile, deps
}
@@ -622,7 +623,7 @@ func (f *filesystem) checkFsTypePropertyError(ctx android.ModuleContext, t fsTyp
}
}
-func (f *filesystem) buildCpioImage(ctx android.ModuleContext, compressed bool) android.OutputPath {
+func (f *filesystem) buildCpioImage(ctx android.ModuleContext, compressed bool) android.Path {
if proptools.Bool(f.properties.Use_avb) {
ctx.PropertyErrorf("use_avb", "signing compresed cpio image using avbtool is not supported."+
"Consider adding this to bootimg module and signing the entire boot image.")
@@ -654,7 +655,7 @@ func (f *filesystem) buildCpioImage(ctx android.ModuleContext, compressed bool)
f.filesystemBuilder.BuildLinkerConfigFile(ctx, builder, rebasedDir)
f.copyFilesToProductOut(ctx, builder, rebasedDir)
- output := android.PathForModuleOut(ctx, f.installFileName()).OutputPath
+ output := android.PathForModuleOut(ctx, f.installFileName())
cmd := builder.Command().
BuiltTool("mkbootfs").
Text(rootDir.String()) // input directory
diff --git a/filesystem/fsverity_metadata.go b/filesystem/fsverity_metadata.go
index 199c84516..3119f2f28 100644
--- a/filesystem/fsverity_metadata.go
+++ b/filesystem/fsverity_metadata.go
@@ -33,7 +33,7 @@ type fsverityProperties struct {
Libs []string `android:"path"`
}
-func (f *filesystem) writeManifestGeneratorListFile(ctx android.ModuleContext, outputPath android.OutputPath, matchedSpecs []android.PackagingSpec, rebasedDir android.OutputPath) {
+func (f *filesystem) writeManifestGeneratorListFile(ctx android.ModuleContext, outputPath android.WritablePath, matchedSpecs []android.PackagingSpec, rebasedDir android.OutputPath) {
var buf strings.Builder
for _, spec := range matchedSpecs {
buf.WriteString(rebasedDir.Join(ctx, spec.RelPathInPackage()).String())
@@ -113,12 +113,12 @@ func (f *filesystem) buildFsverityMetadataFiles(ctx android.ModuleContext, build
f.appendToEntry(ctx, manifestPbPath)
manifestGeneratorListPath := android.PathForModuleOut(ctx, "fsverity_manifest.list")
- f.writeManifestGeneratorListFile(ctx, manifestGeneratorListPath.OutputPath, matchedSpecs, rebasedDir)
+ f.writeManifestGeneratorListFile(ctx, manifestGeneratorListPath, matchedSpecs, rebasedDir)
sb.WriteRune('@')
sb.WriteString(manifestGeneratorListPath.String())
sb.WriteRune('\n')
cmd.Implicit(manifestGeneratorListPath)
- f.appendToEntry(ctx, manifestGeneratorListPath.OutputPath)
+ f.appendToEntry(ctx, manifestGeneratorListPath)
// STEP 2-2: generate BuildManifest.apk (unsigned)
aapt2Path := ctx.Config().HostToolPath(ctx, "aapt2")
diff --git a/filesystem/logical_partition.go b/filesystem/logical_partition.go
index 988a57b08..d0888a9c8 100644
--- a/filesystem/logical_partition.go
+++ b/filesystem/logical_partition.go
@@ -32,7 +32,7 @@ type logicalPartition struct {
properties logicalPartitionProperties
- output android.OutputPath
+ output android.Path
installDir android.InstallPath
}
@@ -95,11 +95,14 @@ func (l *logicalPartition) GenerateAndroidBuildActions(ctx android.ModuleContext
builder := android.NewRuleBuilder(pctx, ctx)
// Sparse the filesystem images and calculate their sizes
- sparseImages := make(map[string]android.OutputPath)
- sparseImageSizes := make(map[string]android.OutputPath)
+ sparseImages := make(map[string]android.Path)
+ sparseImageSizes := make(map[string]android.Path)
sparsePartitions := func(partitions []partitionProperties) {
for _, part := range partitions {
+ if part.Filesystem == nil {
+ continue
+ }
sparseImg, sizeTxt := sparseFilesystem(ctx, part, builder)
pName := proptools.String(part.Name)
sparseImages[pName] = sparseImg
@@ -185,31 +188,29 @@ func (l *logicalPartition) GenerateAndroidBuildActions(ctx android.ModuleContext
addPartitionsToGroup(group.Partitions, gName)
}
- l.output = android.PathForModuleOut(ctx, l.installFileName()).OutputPath
- cmd.FlagWithOutput("--output=", l.output)
+ output := android.PathForModuleOut(ctx, l.installFileName())
+ cmd.FlagWithOutput("--output=", output)
builder.Build("build_logical_partition", fmt.Sprintf("Creating %s", l.BaseModuleName()))
l.installDir = android.PathForModuleInstall(ctx, "etc")
- ctx.InstallFile(l.installDir, l.installFileName(), l.output)
+ ctx.InstallFile(l.installDir, l.installFileName(), output)
- ctx.SetOutputFiles([]android.Path{l.output}, "")
+ ctx.SetOutputFiles([]android.Path{output}, "")
+ l.output = output
}
// Add a rule that converts the filesystem for the given partition to the given rule builder. The
// path to the sparse file and the text file having the size of the partition are returned.
-func sparseFilesystem(ctx android.ModuleContext, p partitionProperties, builder *android.RuleBuilder) (sparseImg android.OutputPath, sizeTxt android.OutputPath) {
- if p.Filesystem == nil {
- return
- }
- img := android.PathForModuleSrc(ctx, proptools.String(p.Filesystem))
+func sparseFilesystem(ctx android.ModuleContext, p partitionProperties, builder *android.RuleBuilder) (android.Path, android.Path) {
+ img := android.PathForModuleSrc(ctx, *p.Filesystem)
name := proptools.String(p.Name)
- sparseImg = android.PathForModuleOut(ctx, name+".img").OutputPath
+ sparseImg := android.PathForModuleOut(ctx, name+".img")
builder.Temporary(sparseImg)
builder.Command().BuiltTool("img2simg").Input(img).Output(sparseImg)
- sizeTxt = android.PathForModuleOut(ctx, name+"-size.txt").OutputPath
+ sizeTxt := android.PathForModuleOut(ctx, name+"-size.txt")
builder.Temporary(sizeTxt)
builder.Command().BuiltTool("sparse_img").Flag("--get_partition_size").Input(sparseImg).
Text("| ").Text("tr").FlagWithArg("-d ", "'\n'").
diff --git a/filesystem/raw_binary.go b/filesystem/raw_binary.go
index ad36c2935..707fba06f 100644
--- a/filesystem/raw_binary.go
+++ b/filesystem/raw_binary.go
@@ -42,7 +42,7 @@ type rawBinary struct {
properties rawBinaryProperties
- output android.OutputPath
+ output android.Path
installDir android.InstallPath
}
@@ -71,7 +71,7 @@ func (r *rawBinary) installFileName() string {
func (r *rawBinary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
inputFile := android.PathForModuleSrc(ctx, proptools.String(r.properties.Src))
- outputFile := android.PathForModuleOut(ctx, r.installFileName()).OutputPath
+ outputFile := android.PathForModuleOut(ctx, r.installFileName())
ctx.Build(pctx, android.BuildParams{
Rule: toRawBinary,
@@ -83,11 +83,11 @@ func (r *rawBinary) GenerateAndroidBuildActions(ctx android.ModuleContext) {
},
})
- r.output = outputFile
r.installDir = android.PathForModuleInstall(ctx, "etc")
- ctx.InstallFile(r.installDir, r.installFileName(), r.output)
+ ctx.InstallFile(r.installDir, r.installFileName(), outputFile)
- ctx.SetOutputFiles([]android.Path{r.output}, "")
+ ctx.SetOutputFiles([]android.Path{outputFile}, "")
+ r.output = outputFile
}
var _ android.AndroidMkEntriesProvider = (*rawBinary)(nil)
diff --git a/filesystem/vbmeta.go b/filesystem/vbmeta.go
index ebb3ff951..6a4785933 100644
--- a/filesystem/vbmeta.go
+++ b/filesystem/vbmeta.go
@@ -44,7 +44,7 @@ type vbmeta struct {
properties VbmetaProperties
- output android.OutputPath
+ output android.Path
installDir android.InstallPath
}
@@ -161,8 +161,6 @@ func (v *vbmeta) partitionName() string {
const vbmetaMaxSize = 64 * 1024
func (v *vbmeta) GenerateAndroidBuildActions(ctx android.ModuleContext) {
- v.output = android.PathForModuleOut(ctx, v.installFileName()).OutputPath
-
builder := android.NewRuleBuilder(pctx, ctx)
cmd := builder.Command().BuiltTool("avbtool").Text("make_vbmeta_image")
@@ -274,18 +272,19 @@ func (v *vbmeta) GenerateAndroidBuildActions(ctx android.ModuleContext) {
cmd.Implicit(publicKey)
}
- cmd.FlagWithOutput("--output ", v.output)
+ output := android.PathForModuleOut(ctx, v.installFileName())
+ cmd.FlagWithOutput("--output ", output)
// libavb expects to be able to read the maximum vbmeta size, so we must provide a partition
// which matches this or the read will fail.
builder.Command().Text("truncate").
FlagWithArg("-s ", strconv.Itoa(vbmetaMaxSize)).
- Output(v.output)
+ Output(output)
builder.Build("vbmeta", fmt.Sprintf("vbmeta %s", ctx.ModuleName()))
v.installDir = android.PathForModuleInstall(ctx, "etc")
- ctx.InstallFile(v.installDir, v.installFileName(), v.output)
+ ctx.InstallFile(v.installDir, v.installFileName(), output)
extractedPublicKey := android.PathForModuleOut(ctx, v.partitionName()+".avbpubkey")
ctx.Build(pctx, android.BuildParams{
@@ -300,7 +299,8 @@ func (v *vbmeta) GenerateAndroidBuildActions(ctx android.ModuleContext) {
PublicKey: extractedPublicKey,
})
- ctx.SetOutputFiles([]android.Path{v.output}, "")
+ ctx.SetOutputFiles([]android.Path{output}, "")
+ v.output = output
}
// Returns the embedded shell command that prints the rollback index
diff --git a/java/app.go b/java/app.go
index 0939d174f..8bb73cb38 100644
--- a/java/app.go
+++ b/java/app.go
@@ -848,7 +848,7 @@ func (a *AndroidApp) createPrivappAllowlist(ctx android.ModuleContext) android.P
packageName := packageNameProp.Get()
fileName := "privapp_allowlist_" + packageName + ".xml"
- outPath := android.PathForModuleOut(ctx, fileName).OutputPath
+ outPath := android.PathForModuleOut(ctx, fileName)
ctx.Build(pctx, android.BuildParams{
Rule: modifyAllowlist,
Input: android.PathForModuleSrc(ctx, *a.appProperties.Privapp_allowlist),
@@ -857,7 +857,7 @@ func (a *AndroidApp) createPrivappAllowlist(ctx android.ModuleContext) android.P
"packageName": packageName,
},
})
- return &outPath
+ return outPath
}
func (a *AndroidApp) generateAndroidBuildActions(ctx android.ModuleContext) {
diff --git a/java/app_import.go b/java/app_import.go
index 6b88f1c43..f044c6848 100644
--- a/java/app_import.go
+++ b/java/app_import.go
@@ -88,7 +88,7 @@ type AndroidAppImport struct {
hideApexVariantFromMake bool
- provenanceMetaDataFile android.OutputPath
+ provenanceMetaDataFile android.Path
}
type AndroidAppImportProperties struct {
@@ -259,7 +259,7 @@ func (a *AndroidAppImport) DepsMutator(ctx android.BottomUpMutatorContext) {
}
func (a *AndroidAppImport) uncompressEmbeddedJniLibs(
- ctx android.ModuleContext, inputPath android.Path, outputPath android.OutputPath) {
+ ctx android.ModuleContext, inputPath android.Path, outputPath android.WritablePath) {
// Test apps don't need their JNI libraries stored uncompressed. As a matter of fact, messing
// with them may invalidate pre-existing signature data.
if ctx.InstallInTestcases() && (Bool(a.properties.Presigned) || Bool(a.properties.Preprocessed)) {
@@ -345,7 +345,7 @@ func (a *AndroidAppImport) generateAndroidBuildActions(ctx android.ModuleContext
// Uncompress JNI libraries in the apk
jnisUncompressed := android.PathForModuleOut(ctx, "jnis-uncompressed", ctx.ModuleName()+".apk")
- a.uncompressEmbeddedJniLibs(ctx, srcApk, jnisUncompressed.OutputPath)
+ a.uncompressEmbeddedJniLibs(ctx, srcApk, jnisUncompressed)
var pathFragments []string
relInstallPath := String(a.properties.Relative_install_path)
@@ -493,7 +493,7 @@ func (a *AndroidAppImport) Certificate() Certificate {
return a.certificate
}
-func (a *AndroidAppImport) ProvenanceMetaDataFile() android.OutputPath {
+func (a *AndroidAppImport) ProvenanceMetaDataFile() android.Path {
return a.provenanceMetaDataFile
}
diff --git a/java/dex.go b/java/dex.go
index 1f71aee1a..dea71f538 100644
--- a/java/dex.go
+++ b/java/dex.go
@@ -428,17 +428,18 @@ type compileDexParams struct {
// Adds --art-profile to r8/d8 command.
// r8/d8 will output a generated profile file to match the optimized dex code.
func (d *dexer) addArtProfile(ctx android.ModuleContext, dexParams *compileDexParams) (flags []string, deps android.Paths, artProfileOutputPath *android.OutputPath) {
- if dexParams.artProfileInput != nil {
- artProfileInputPath := android.PathForModuleSrc(ctx, *dexParams.artProfileInput)
- artProfileOutputPathValue := android.PathForModuleOut(ctx, "profile.prof.txt").OutputPath
- artProfileOutputPath = &artProfileOutputPathValue
- flags = []string{
- "--art-profile",
- artProfileInputPath.String(),
- artProfileOutputPath.String(),
- }
- deps = append(deps, artProfileInputPath)
+ if dexParams.artProfileInput == nil {
+ return nil, nil, nil
+ }
+ artProfileInputPath := android.PathForModuleSrc(ctx, *dexParams.artProfileInput)
+ artProfileOutputPathValue := android.PathForModuleOut(ctx, "profile.prof.txt").OutputPath
+ artProfileOutputPath = &artProfileOutputPathValue
+ flags = []string{
+ "--art-profile",
+ artProfileInputPath.String(),
+ artProfileOutputPath.String(),
}
+ deps = append(deps, artProfileInputPath)
return flags, deps, artProfileOutputPath
}
diff --git a/java/platform_bootclasspath.go b/java/platform_bootclasspath.go
index 8b0ca97a1..d09a02e50 100644
--- a/java/platform_bootclasspath.go
+++ b/java/platform_bootclasspath.go
@@ -184,7 +184,7 @@ func (b *platformBootclasspathModule) GenerateAndroidBuildActions(ctx android.Mo
}
jarArgs := resourcePathsToJarArgs(transitiveSrcFiles)
jarArgs = append(jarArgs, "-srcjar") // Move srcfiles to the right package
- srcjar := android.PathForModuleOut(ctx, ctx.ModuleName()+"-transitive.srcjar").OutputPath
+ srcjar := android.PathForModuleOut(ctx, ctx.ModuleName()+"-transitive.srcjar")
TransformResourcesToJar(ctx, srcjar, jarArgs, transitiveSrcFiles)
// Gather all the fragments dependencies.
diff --git a/provenance/provenance_singleton.go b/provenance/provenance_singleton.go
index 679632c10..c372db2b3 100644
--- a/provenance/provenance_singleton.go
+++ b/provenance/provenance_singleton.go
@@ -46,7 +46,7 @@ var (
)
type ProvenanceMetadata interface {
- ProvenanceMetaDataFile() android.OutputPath
+ ProvenanceMetaDataFile() android.Path
}
func init() {
@@ -74,7 +74,7 @@ func (p *provenanceInfoSingleton) GenerateBuildActions(context android.Singleton
return false
}
if p, ok := module.(ProvenanceMetadata); ok {
- return p.ProvenanceMetaDataFile().String() != ""
+ return p.ProvenanceMetaDataFile() != nil
}
return false
}
@@ -101,7 +101,7 @@ func (p *provenanceInfoSingleton) GenerateBuildActions(context android.Singleton
context.Phony("droidcore", android.PathForPhony(context, "provenance_metadata"))
}
-func GenerateArtifactProvenanceMetaData(ctx android.ModuleContext, artifactPath android.Path, installedFile android.InstallPath) android.OutputPath {
+func GenerateArtifactProvenanceMetaData(ctx android.ModuleContext, artifactPath android.Path, installedFile android.InstallPath) android.Path {
onDevicePathOfInstalledFile := android.InstallPathToOnDevicePath(ctx, installedFile)
artifactMetaDataFile := android.PathForIntermediates(ctx, "provenance_metadata", ctx.ModuleDir(), ctx.ModuleName(), "provenance_metadata.textproto")
ctx.Build(pctx, android.BuildParams{
diff --git a/sh/sh_binary.go b/sh/sh_binary.go
index 320e97f19..7f5a4261f 100644
--- a/sh/sh_binary.go
+++ b/sh/sh_binary.go
@@ -204,7 +204,7 @@ func (s *ShBinary) HostToolPath() android.OptionalPath {
func (s *ShBinary) DepsMutator(ctx android.BottomUpMutatorContext) {
}
-func (s *ShBinary) OutputFile() android.OutputPath {
+func (s *ShBinary) OutputFile() android.Path {
return s.outputFilePath
}