From 77965d9bd4dbec3301cae9b7ce548cb7bc43ef6b Mon Sep 17 00:00:00 2001 From: Colin Cross Date: Thu, 15 Aug 2024 17:11:08 -0700 Subject: Convert more stored WritablePaths to Paths Similar to I40f28075ce151e4be80d6cfc7ec173dfa46f9bbf, convert more long-lived WritablePaths to Paths. Test: all soong tests pass Flag: EXEMPT refactor Change-Id: I9be448f811694fe0524fbbd7c5d4553cf69d533a --- java/java.go | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'java/java.go') diff --git a/java/java.go b/java/java.go index 0d2704d24..85bc70c54 100644 --- a/java/java.go +++ b/java/java.go @@ -2664,43 +2664,46 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) { // Always pass the input jars to TransformJarsToJar, even if there is only a single jar, we need the output // file of the module to be named jarName. - outputFile := android.PathForModuleOut(ctx, "combined", jarName) + var outputFile android.Path + combinedImplementationJar := android.PathForModuleOut(ctx, "combined", jarName) implementationJars := append(slices.Clone(jars), staticJars...) - TransformJarsToJar(ctx, outputFile, "combine prebuilt implementation jars", implementationJars, android.OptionalPath{}, + TransformJarsToJar(ctx, combinedImplementationJar, "combine prebuilt implementation jars", implementationJars, android.OptionalPath{}, false, j.properties.Exclude_files, j.properties.Exclude_dirs) + outputFile = combinedImplementationJar // If no dependencies have separate header jars then there is no need to create a separate // header jar for this module. reuseImplementationJarAsHeaderJar := slices.Equal(staticJars, staticHeaderJars) - var headerOutputFile android.ModuleOutPath + var headerJar android.Path if reuseImplementationJarAsHeaderJar { - headerOutputFile = outputFile + headerJar = outputFile } else { headerJars := append(slices.Clone(jars), staticHeaderJars...) - headerOutputFile = android.PathForModuleOut(ctx, "turbine-combined", jarName) + headerOutputFile := android.PathForModuleOut(ctx, "turbine-combined", jarName) TransformJarsToJar(ctx, headerOutputFile, "combine prebuilt header jars", headerJars, android.OptionalPath{}, false, j.properties.Exclude_files, j.properties.Exclude_dirs) + headerJar = headerOutputFile } if Bool(j.properties.Jetifier) { - inputFile := outputFile - outputFile = android.PathForModuleOut(ctx, "jetifier", jarName) - TransformJetifier(ctx, outputFile, inputFile) + jetifierOutputFile := android.PathForModuleOut(ctx, "jetifier", jarName) + TransformJetifier(ctx, jetifierOutputFile, outputFile) + outputFile = jetifierOutputFile if !reuseImplementationJarAsHeaderJar { - headerInputFile := headerOutputFile - headerOutputFile = android.PathForModuleOut(ctx, "jetifier-headers", jarName) - TransformJetifier(ctx, headerOutputFile, headerInputFile) + jetifierHeaderJar := android.PathForModuleOut(ctx, "jetifier-headers", jarName) + TransformJetifier(ctx, jetifierHeaderJar, headerJar) + headerJar = jetifierHeaderJar } else { - headerOutputFile = outputFile + headerJar = outputFile } } // Save the output file with no relative path so that it doesn't end up in a subdirectory when used as a resource. // Also strip the relative path from the header output file so that the reuseImplementationJarAsHeaderJar check // in a module that depends on this module considers them equal. - j.combinedHeaderFile = headerOutputFile.WithoutRel() + j.combinedHeaderFile = headerJar.WithoutRel() j.combinedImplementationFile = outputFile.WithoutRel() j.maybeInstall(ctx, jarName, outputFile) -- cgit v1.2.3-59-g8ed1b