diff options
author | 2024-04-11 15:28:18 -0700 | |
---|---|---|
committer | 2024-04-11 16:51:21 -0700 | |
commit | 5e87f349b823c8a164628d81758a345173286255 (patch) | |
tree | 23f5193893ab70da20685775ace80b211795d85f /java/java.go | |
parent | 28ac2ffc8083a71b9e9f97098af4d12f1f732411 (diff) |
Strip relative paths from java_import output files
androidx.annotation_annotation is used as a test data file, and
converting it from a java_library to a java_library_import causes
the relative path used in the test data path to change. Clear the
relative path in java_import the same way that other java based
modules do.
Bug: 288358614
Test: TestJavaLibraryOutputFileRel
Change-Id: I1f494110da32e916043ca94ac6ebeeafccc06f9a
Diffstat (limited to 'java/java.go')
-rw-r--r-- | java/java.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/java/java.go b/java/java.go index 72536cd6d..b5f707768 100644 --- a/java/java.go +++ b/java/java.go @@ -2555,7 +2555,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 { @@ -2578,8 +2578,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) |