got unit tests working finally.
This commit is contained in:
parent
9b76e6423c
commit
ad069c9e08
47
bild.py
47
bild.py
|
@ -1,16 +1,32 @@
|
|||
#!/usr/bin/env python
|
||||
import sys
|
||||
import os
|
||||
sys.path.append(os.path.abspath("/Users/parrt/github/bild"))
|
||||
# requires support lib:
|
||||
# https://raw.githubusercontent.com/parrt/bild/master/src/python/bilder.py
|
||||
sys.path.append(os.path.abspath("/Users/parrt/github/bild/src/python"))
|
||||
import string
|
||||
|
||||
from bilder import *
|
||||
|
||||
VERSION = "4.4"
|
||||
JAVA_TARGET = "."
|
||||
PYTHON2_TARGET = "../antlr4-python2"
|
||||
PYTHON3_TARGET = "../antlr4-python3"
|
||||
CSHARP_TARGET = "../antlr4cs"
|
||||
|
||||
TARGETS = {"Python2":PYTHON2_TARGET, "Python3":PYTHON3_TARGET, "CSharp":CSHARP_TARGET}
|
||||
# Properties needed to run Python[23] tests
|
||||
test_properties = {
|
||||
"antlr-python2-python":"/usr/local/Cellar/python/2.7.5/bin/python2.7",
|
||||
"antlr-python2-runtime":uniformpath(PYTHON2_TARGET)+"/src",
|
||||
"antlr-python3-python":"/usr/local/Cellar/python3/3.4.1/bin/python3",
|
||||
"antlr-python3-runtime":uniformpath(PYTHON3_TARGET)+"/src",
|
||||
}
|
||||
|
||||
# TARGETS = {"Java":JAVA_TARGET, "Python2":PYTHON2_TARGET, "Python3":PYTHON3_TARGET, "CSharp":CSHARP_TARGET}
|
||||
TARGETS = {"Java":uniformpath(JAVA_TARGET),
|
||||
"Python2":uniformpath(PYTHON2_TARGET),
|
||||
"Python3":uniformpath(PYTHON3_TARGET),
|
||||
"CSharp":uniformpath(CSHARP_TARGET)}
|
||||
|
||||
def parsers():
|
||||
antlr3("tool/src/org/antlr/v4/parse", "gen", package="org.antlr.v4.parse")
|
||||
|
@ -48,17 +64,20 @@ Main-Class: org.antlr.v4.Tool
|
|||
jar("dist/antlr-"+VERSION+"-complete.jar", srcdir="out", manifest=manifest)
|
||||
|
||||
def tests():
|
||||
require(compile)
|
||||
require(mkjar)
|
||||
junit_jar, hamcrest_jar = load_junitjars()
|
||||
cp = uniformpath("out")+os.pathsep+ \
|
||||
os.path.join(JARCACHE,"antlr-3.5.1-complete.jar")+os.pathsep+ \
|
||||
"runtime/Java/lib/org.abego.treelayout.core.jar"+os.pathsep+junit_jar+ \
|
||||
os.pathsep+hamcrest_jar
|
||||
cp = "dist/antlr-"+VERSION+"-complete.jar"+os.pathsep+ \
|
||||
uniformpath("out/test/Java")+os.pathsep+ \
|
||||
string.join([uniformpath(TARGETS[t]+"/tool/test") for t in TARGETS],os.pathsep)+os.pathsep+ \
|
||||
junit_jar+os.pathsep+hamcrest_jar
|
||||
properties = ["-D%s=%s" % (p, test_properties[p]) for p in test_properties]
|
||||
args = ["-Xlint", "-Xlint:-serial", "-g"]
|
||||
javac("tool/test", "out/test/Java", version="1.6", cp=cp, args=args)
|
||||
junit("out/test/Java", cp=cp)
|
||||
# for t in TARGETS:
|
||||
# javac(TARGETS[t]+"/tool/test", "out/test", version="1.6", cp=cp, args=args)
|
||||
javac("tool/test", "out/test/Java", version="1.6", cp=cp, args=args) # all targets can use org.antlr.v4.test.*
|
||||
for t in TARGETS:
|
||||
print "Test %7s --------------" % t
|
||||
javac(TARGETS[t]+"/tool/test", "out/test/"+t, version="1.6", cp=cp, args=args)
|
||||
copytree(src=TARGETS[t]+"/tool/resources", dst="out/test/"+t)
|
||||
junit("out/test/"+t, cp=cp, verbose=False, args=properties)
|
||||
|
||||
def all():
|
||||
mkjar()
|
||||
|
@ -74,13 +93,9 @@ def mkdoc():
|
|||
mkdir("doc/Java")
|
||||
mkdir("doc/JavaTool")
|
||||
javadoc(srcdir="runtime/Java/src", trgdir="doc/Java", packages="org.antlr.v4.runtime")
|
||||
toolsrc = ["tool/src"]+ [TARGETS[t]+"/tool/src" for t in TARGETS]
|
||||
toolsrc = [TARGETS[t]+"/tool/src" for t in TARGETS]
|
||||
toolsrc = string.join(toolsrc, ":")
|
||||
javadoc(srcdir=toolsrc, trgdir="doc/JavaTool", packages="org.antlr.v4")
|
||||
# for t in TARGETS:
|
||||
# javadoc(srcdir=TARGETS[t]+"/tool/src",
|
||||
# trgdir="doc/JavaTool",
|
||||
# packages="org.antlr.v4.codegen")
|
||||
# build stack merge PredictionContext and ATNState images from DOT
|
||||
# DOT Images are in runtime/Java/src/main/dot/org/antlr/v4/runtime/atn/images/
|
||||
# Gen into E.g., doc/Java/org/antlr/v4/runtime/atn/images/SingletonMerge_DiffRootSamePar.svg
|
||||
|
|
Loading…
Reference in New Issue