Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c31471a authored by Dan Willemsen's avatar Dan Willemsen Committed by Automerger Merge Worker
Browse files

Merge "Set static timestamps in protologtool output" into main am: 3d0cb6cc

parents 11556257 3d0cb6cc
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -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())