Skip to content
Snippets Groups Projects
Commit 3d0cb6cc authored by Dan Willemsen's avatar Dan Willemsen Committed by Gerrit Code Review
Browse files

Merge "Set static timestamps in protologtool output" into main

parents 40673c57 d0473319
No related branches found
No related tags found
No related merge requests found
......@@ -25,6 +25,7 @@ import java.io.File
import java.io.FileInputStream
import java.io.FileOutputStream
import java.io.OutputStream
import java.time.LocalDateTime
import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors
import java.util.jar.JarOutputStream
......@@ -42,6 +43,13 @@ object ProtoLogTool {
return source.contains(protoLogSimpleClassName)
}
private fun zipEntry(path: String): ZipEntry {
val entry = ZipEntry(path)
// Use a constant time to improve the cachability of build actions.
entry.timeLocal = LocalDateTime.of(2008, 1, 1, 0, 0, 0)
return entry
}
private fun processClasses(command: CommandOptions) {
val groups = injector.readLogGroups(
command.protoLogGroupsJarArg,
......@@ -77,7 +85,7 @@ object ProtoLogTool {
}
}.map { future ->
val (path, outSrc) = future.get()
outJar.putNextEntry(ZipEntry(path))
outJar.putNextEntry(zipEntry(path))
outJar.write(outSrc.toByteArray())
outJar.closeEntry()
}
......@@ -90,7 +98,7 @@ object ProtoLogTool {
val cachePackage = cacheSplit.dropLast(1).joinToString(".")
val cachePath = "gen/${cacheSplit.joinToString("/")}.java"
outJar.putNextEntry(ZipEntry(cachePath))
outJar.putNextEntry(zipEntry(cachePath))
outJar.write(generateLogGroupCache(cachePackage, cacheName, groups,
command.protoLogImplClassNameArg, command.protoLogGroupsClassNameArg).toByteArray())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment