Update timestamp on tar.gz file after download script
If you made local changes to dependencies and uploaded you tar.gz.sha1
file will be more recent than the tar.gz file and we will always run
the download script (which check the sha that is correct and does not
download)
If we successfully run the download script then always update the
timestamp (on the next iteration we will do the early return)
Change-Id: I627a3f77198ec3ad6a320007af9fa8ec1ca137ce
diff --git a/d8_r8/settings.gradle.kts b/d8_r8/settings.gradle.kts
index f4ff5e0..ac9216a 100644
--- a/d8_r8/settings.gradle.kts
+++ b/d8_r8/settings.gradle.kts
@@ -4,6 +4,8 @@
// TODO(b/270105162): Move this file out the repository root when old gradle is removed.
+import java.nio.file.Files
+import java.nio.file.attribute.FileTime
import org.gradle.internal.os.OperatingSystem
rootProject.name = "d8-r8"
@@ -54,6 +56,12 @@
java.nio.charset.StandardCharsets.UTF_8)}\n"
+ String(process.getInputStream().readAllBytes(),
java.nio.charset.StandardCharsets.UTF_8))
+ } else {
+ // Ensure that the gz file is more recent than the .sha1 file
+ // People that upload a new version will generally have an older .sha1 file
+ println("Updating timestamp on " + targz)
+ val now = FileTime.fromMillis(System.currentTimeMillis())
+ Files.setLastModifiedTime(targz.toPath(), now)
}
}