From ce7ae8fb1ca3fe1237f0df081fff201fb88c0002 Mon Sep 17 00:00:00 2001 From: Martin Haye Date: Mon, 30 Oct 2023 13:37:25 -0700 Subject: [PATCH] Embed timestamp explictly in the jar file, instead of relying on filesystem times. --- Platform/Apple/tools/PackPartitions/build.xml | 7 +++++++ .../src/org/badvision/A2PackPartitions.groovy | 17 +++++++++++------ Platform/Apple/virtual/bundlePacker.sh | 4 +++- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Platform/Apple/tools/PackPartitions/build.xml b/Platform/Apple/tools/PackPartitions/build.xml index 483fb54f..0d50ac0f 100644 --- a/Platform/Apple/tools/PackPartitions/build.xml +++ b/Platform/Apple/tools/PackPartitions/build.xml @@ -6,6 +6,10 @@ + + + + @@ -22,6 +26,9 @@ + + + diff --git a/Platform/Apple/tools/PackPartitions/src/org/badvision/A2PackPartitions.groovy b/Platform/Apple/tools/PackPartitions/src/org/badvision/A2PackPartitions.groovy index a241514b..30042539 100644 --- a/Platform/Apple/tools/PackPartitions/src/org/badvision/A2PackPartitions.groovy +++ b/Platform/Apple/tools/PackPartitions/src/org/badvision/A2PackPartitions.groovy @@ -19,6 +19,7 @@ import java.nio.ByteBuffer import java.nio.channels.Channels import java.nio.charset.StandardCharsets import java.nio.file.Files +import java.text.SimpleDateFormat import java.util.Calendar import java.util.regex.Pattern import java.util.zip.GZIPInputStream @@ -1002,8 +1003,14 @@ class A2PackPartitions cache[key] = [hash:hash, data:buf] } - def updateEngineStamp(name, hash) + def updateEngineStamp() { + def hash + def tsfile = new File("build/tstamp.txt") + jitCopy(tsfile) + tsfile.withReader { reader -> + hash = Long.parseLong(reader.readLine()) + } if (!cache.containsKey("engineStamp") || cache["engineStamp"].hash < hash) cache["engineStamp"] = [hash:hash] } @@ -2334,7 +2341,6 @@ class A2PackPartitions def uncompData = readBinary(inDir + "build/" + codeName + ".b") addToCache("code", code, codeName, hash, compress(uncompData)) - updateEngineStamp(codeName, hash) } def assembleCore(inDir) @@ -2356,7 +2362,6 @@ class A2PackPartitions hash = file.lastModified() if (!grabFromCache("sysCode", sysCode, name, hash)) { addToCache("sysCode", sysCode, name, hash, compress(readBinary(file.toString()))) - updateEngineStamp(name, hash) } } else { @@ -2370,7 +2375,6 @@ class A2PackPartitions addToCache("sysCode", sysCode, name, hash, (name ==~ /loader|decomp/) ? [data:uncompData, len:uncompData.length, compressed:false] : compress(uncompData)) - updateEngineStamp(name, hash) } } @@ -2441,12 +2445,13 @@ class A2PackPartitions addToCache("modules", modules, moduleName, hash, module) addToCache("bytecodes", bytecodes, moduleName, hash, bytecode) addToCache("fixups", fixups, moduleName, hash, fixup) - if (!(moduleName ==~ /.*(gs|gen)_.*/ || codeDir ==~ /.*mapScript.*/)) - updateEngineStamp(moduleName, hash) } def readAllCode() { + // Update the engine stamp from the tstamp.txt file + updateEngineStamp() + // Loader, ProRWTS, PLASMA VM, and memory manager assembleCore("src/core/") diff --git a/Platform/Apple/virtual/bundlePacker.sh b/Platform/Apple/virtual/bundlePacker.sh index a1bd04c2..214dfaea 100755 --- a/Platform/Apple/virtual/bundlePacker.sh +++ b/Platform/Apple/virtual/bundlePacker.sh @@ -7,6 +7,7 @@ if [ "$#" -ne 1 ]; then exit 1 fi +./b rm -f PackPartitions.exe java -Djava.awt.headless=true -jar /Users/mhaye/plat/virtual/launch4j/launch4j.jar launch4j.cfg.xml @@ -16,8 +17,9 @@ cd bundle-tmp unzip ../packer-bundle.zip mv packer-bundle-* packer-bundle-$1 rm packer-bundle-$1/PackPartitions.exe +rm -f packer-bundle-$1/world.xml mv ../PackPartitions.exe packer-bundle-$1/PackPartitions.exe zip -r packer-bundle-$1.zip * cp packer-bundle-$1.zip ../packer-bundle.zip cd .. -rm -r bundle-tmp \ No newline at end of file +rm -r bundle-tmp