summaryrefslogtreecommitdiff
path: root/java/java.go
diff options
context:
space:
mode:
author Treehugger Robot <android-test-infra-autosubmit@system.gserviceaccount.com> 2024-04-12 01:22:10 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2024-04-12 01:22:10 +0000
commit80214e550ea4c9315fc9ef08dcdebdd17820c6c8 (patch)
tree69219d01bad6ea45e1dbdebaf2ae717d525e1409 /java/java.go
parent0565fdc3cbb09d75774c92d4dbedd79cad43db47 (diff)
parent5e87f349b823c8a164628d81758a345173286255 (diff)
Merge "Strip relative paths from java_import output files" into main
Diffstat (limited to 'java/java.go')
-rw-r--r--java/java.go10
1 files changed, 7 insertions, 3 deletions
diff --git a/java/java.go b/java/java.go
index fb5bb1cae..778c9a2d9 100644
--- a/java/java.go
+++ b/java/java.go
@@ -2564,7 +2564,7 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) {
// header jar for this module.
reuseImplementationJarAsHeaderJar := slices.Equal(staticJars, staticHeaderJars)
- var headerOutputFile android.WritablePath
+ var headerOutputFile android.ModuleOutPath
if reuseImplementationJarAsHeaderJar {
headerOutputFile = outputFile
} else {
@@ -2587,8 +2587,12 @@ func (j *Import) GenerateAndroidBuildActions(ctx android.ModuleContext) {
headerOutputFile = outputFile
}
}
- j.combinedHeaderFile = headerOutputFile
- j.combinedImplementationFile = 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.combinedImplementationFile = outputFile.WithoutRel()
j.maybeInstall(ctx, jarName, outputFile)