mirror of
https://github.com/badvision/lawless-legends.git
synced 2025-01-30 21:31:28 +00:00
Embed timestamp explictly in the jar file, instead of relying on filesystem times.
This commit is contained in:
parent
cd5903367b
commit
ce7ae8fb1c
@ -6,6 +6,10 @@
|
||||
<target depends="init" description="Don't build Javadoc." name="javadoc"/>
|
||||
<!-- use local groovy jar instead of NetBeans' version -->
|
||||
<property name="libs.groovy-all.classpath" value="./lib/groovy-4.0.13.jar:./lib/groovy-ant-4.0.13.jar:./lib/groovy-xml-4.0.13.jar:./lib/groovy-json-4.0.13.jar"/>
|
||||
<!-- put the current time/date into a file for engine timestamping -->
|
||||
<exec executable="date" output="dist/tstamp.txt">
|
||||
<arg value="+%s000"/>
|
||||
</exec>
|
||||
<!-- after building the 'thin' jar, make a 'thick' one incorporating all dependencies -->
|
||||
<target name="-post-jar">
|
||||
<echo message="Packaging ${application.title} into a single JAR at ${dist.jar}"/>
|
||||
@ -22,6 +26,9 @@
|
||||
<manifest>
|
||||
<attribute name="Main-Class" value="org.badvision.A2PackPartitions"/>
|
||||
</manifest>
|
||||
<fileset dir="dist">
|
||||
<include name="tstamp.txt"/>
|
||||
</fileset>
|
||||
<fileset dir="../..">
|
||||
<include name="virtual/src/**/*.pla"/>
|
||||
<include name="virtual/src/**/*.plh"/>
|
||||
|
@ -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/")
|
||||
|
||||
|
@ -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,6 +17,7 @@ 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user