Fix rewriting annotations bytecode on Mac
The code rewriting bytecode files were writing to a temporary file,
which was accidentally placed in $PWD instead of in the same directory
as the original file; my theory is that renameTo to a different
directory works on Linux but not on Mac.
Test: Covered by the existing RewriteAnnotations test, which was
failing on Mac
Bug: 111871772
Change-Id: I4bb0e763908381e0696316c0445e82fc83a1a03e
diff --git a/src/main/java/com/android/tools/metalava/RewriteAnnotations.kt b/src/main/java/com/android/tools/metalava/RewriteAnnotations.kt
index 08b3f37..2455ee4 100644
--- a/src/main/java/com/android/tools/metalava/RewriteAnnotations.kt
+++ b/src/main/java/com/android/tools/metalava/RewriteAnnotations.kt
@@ -193,7 +193,7 @@
}
private fun rewriteJar(file: File) {
- val temp = File(file.name + ".temp-$PROGRAM_NAME")
+ val temp = File(file.path + ".temp-$PROGRAM_NAME")
rewriteJar(file, temp)
file.delete()
temp.renameTo(file)