summaryrefslogtreecommitdiff
path: root/java
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 /java
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
Diffstat (limited to 'java')
-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
4 files changed, 18 insertions, 17 deletions
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.