make runtime jar and minimal runtime jar, improve manifests. Fixes #576

This commit is contained in:
Terence Parr 2014-07-06 09:21:46 -07:00
parent d6c1fa152d
commit 74573c2eed
1 changed files with 37 additions and 3 deletions

40
bild.py
View File

@ -50,9 +50,14 @@ def mkjar():
require(compile) require(compile)
copytree(src="tool/resources", dst="out") # messages, Java code gen, etc... copytree(src="tool/resources", dst="out") # messages, Java code gen, etc...
manifest = \ manifest = \
"""Version: %s """Main-Class: org.antlr.v4.Tool
Main-Class: org.antlr.v4.Tool Implementation-Vendor: ANTLR
""" % VERSION Implementation-Title: ANTLR 4 Tool
Implementation-Version: %s
Built-By: %s
Build-Jdk: 1.6
Created-By: http://www.bildtool.org
""" % (VERSION,os.getlogin())
# unjar required libraries # unjar required libraries
unjar("runtime/Java/lib/org.abego.treelayout.core.jar", trgdir="out") unjar("runtime/Java/lib/org.abego.treelayout.core.jar", trgdir="out")
unjar(os.path.join(JARCACHE,"antlr-3.5.1-complete.jar"), trgdir="out") unjar(os.path.join(JARCACHE,"antlr-3.5.1-complete.jar"), trgdir="out")
@ -64,6 +69,35 @@ Main-Class: org.antlr.v4.Tool
trgdir) trgdir)
jar("dist/antlr-"+VERSION+"-complete.jar", srcdir="out", manifest=manifest) jar("dist/antlr-"+VERSION+"-complete.jar", srcdir="out", manifest=manifest)
mkruntimejar()
def mkruntimejar():
# out/... dir is full of tool-related stuff, make special dir out/runtime
cp = uniformpath("out/runtime")+os.pathsep+ \
"runtime/Java/lib/org.abego.treelayout.core.jar"
args = ["-Xlint", "-Xlint:-serial", "-g"]
javac("runtime/JavaAnnotations/src/", "out/runtime", version="1.6", cp=cp, args=args)
javac("runtime/Java/src", "out/runtime", version="1.6", cp=cp, args=args)
manifest = \
"""Implementation-Vendor: ANTLR
Implementation-Title: ANTLR 4 Runtime
Implementation-Version: %s
Built-By: %s
Build-Jdk: 1.6
Created-By: http://www.bildtool.org
""" % (VERSION,os.getlogin())
# unjar required library
unjar("runtime/Java/lib/org.abego.treelayout.core.jar", trgdir="out/runtime")
jar("dist/antlr-runtime-"+VERSION+".jar", srcdir="out/runtime", manifest=manifest)
# now remove org/antlr/v4/runtime/tree/gui/* and tree lib to make minimal jar
rmdir("out/runtime/org/antlr/v4/runtime/tree/gui")
rmdir("out/runtime/org/abego")
rmdir("out/runtime/META-INF/maven")
manifest = manifest.replace("ANTLR 4 Runtime", "ANTLR 4 Min Runtime")
jar("dist/antlr-min-runtime-"+VERSION+".jar", srcdir="out/runtime", manifest=manifest)
def tests(): def tests():
require(mkjar) require(mkjar)
junit_jar, hamcrest_jar = load_junitjars() junit_jar, hamcrest_jar = load_junitjars()