forked from jasder/antlr
Ant build.xml: look for ANTLR 3 library in lib folder, download from antlr.org if missing. Remove unnecessary build.properties.
This commit is contained in:
parent
f1b6e93a04
commit
0cced01ab3
|
@ -4,6 +4,7 @@ target/
|
|||
# Ant build folders
|
||||
build/
|
||||
dist/
|
||||
lib/
|
||||
|
||||
# NetBeans user configuration files
|
||||
nbactions*.xml
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
version=4.0b4
|
||||
|
||||
antlr3.jar=/usr/local/lib/antlr-3.5-rc-2-complete.jar
|
||||
build.sysclasspath=ignore
|
72
build.xml
72
build.xml
|
@ -1,44 +1,41 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<!--
|
||||
|
||||
Make build.properties like this:
|
||||
|
||||
version=4.0b2
|
||||
|
||||
antlr3.jar=/usr/local/lib/antlr-3.5-complete.jar
|
||||
build.sysclasspath=ignore
|
||||
-->
|
||||
|
||||
<project name="ANTLR4" default="distribute" basedir=".">
|
||||
|
||||
<property file="build.properties" />
|
||||
|
||||
<property name="src.dir" value="${basedir}/src" />
|
||||
<property name="dist.dir" value="${basedir}/dist" />
|
||||
<property name="build.dir" value="${basedir}/build" />
|
||||
<property name="lib.dir" value="${basedir}/lib" />
|
||||
<property name="install.root.dir" value="${dist.dir}/antlr-${version}" />
|
||||
<property name="jar.file" value="${dist.dir}/antlr-${version}-complete.jar" />
|
||||
|
||||
<path id="classpath">
|
||||
<pathelement location="${antlr3.jar}"/> <!-- general setup -->
|
||||
<pathelement location="${ant-antlr3.jar}"/>
|
||||
<pathelement location="${basedir}/runtime/Java/lib/org.abego.treelayout.core.jar"/>
|
||||
</path>
|
||||
|
||||
<target name="clean">
|
||||
<delete dir="${build.dir}"/>
|
||||
<delete dir="${dist.dir}"/>
|
||||
<target name="basic-init">
|
||||
<property name="dist.dir" value="${basedir}/dist" />
|
||||
<property name="build.dir" value="${basedir}/build" />
|
||||
<property name="lib.dir" value="${basedir}/lib" />
|
||||
</target>
|
||||
|
||||
<target name="init">
|
||||
<target name="antlr3-init" depends="basic-init">
|
||||
<property name="antlr3.version" value="3.5"/>
|
||||
<property name="antlr3.jar.name" value="antlr-${antlr3.version}-complete-no-st3.jar"/>
|
||||
<property name="antlr3.jar" value="${lib.dir}/${antlr3.jar.name}"/>
|
||||
<mkdir dir="${lib.dir}"/>
|
||||
<get src="http://antlr.org/download/${antlr3.jar.name}" dest="${antlr3.jar}" skipexisting="true"/>
|
||||
<path id="cp.antlr3" path="${antlr3.jar}"/>
|
||||
|
||||
<!-- Create the build directory structure used by compile -->
|
||||
<property name="antlr3.gen.dir" value="${build.dir}/generated-sources/antlr3" />
|
||||
<mkdir dir="${antlr3.gen.dir}" />
|
||||
</target>
|
||||
|
||||
<target name="antlr" depends="init">
|
||||
<target name="build-init" depends="basic-init">
|
||||
<property name="version" value="4.0-dev"/>
|
||||
<property name="build.sysclasspath" value="ignore"/>
|
||||
<property name="install.root.dir" value="${dist.dir}/antlr-${version}" />
|
||||
<property name="jar.file" value="${dist.dir}/antlr-${version}-complete.jar" />
|
||||
</target>
|
||||
|
||||
<target name="clean" depends="basic-init">
|
||||
<delete dir="${build.dir}" includeemptydirs="true"/>
|
||||
<delete dir="${dist.dir}" includeemptydirs="true"/>
|
||||
</target>
|
||||
|
||||
<target name="clean-all" depends="clean">
|
||||
<delete dir="${lib.dir}" includeemptydirs="true"/>
|
||||
</target>
|
||||
|
||||
<target name="antlr3" depends="build-init,antlr3-init">
|
||||
<echo>parse grammars</echo>
|
||||
<java classname="org.antlr.Tool" fork="true" failonerror="true" maxmemory="300m"
|
||||
dir="${basedir}/tool/src/org/antlr/v4/parse">
|
||||
|
@ -54,7 +51,7 @@ build.sysclasspath=ignore
|
|||
<arg value="GrammarTreeVisitor.g"/>
|
||||
<arg value="LeftRecursiveRuleWalker.g"/>
|
||||
<classpath>
|
||||
<pathelement location="${antlr3.jar}"/>
|
||||
<path refid="cp.antlr3"/>
|
||||
<pathelement path="${java.class.path}"/>
|
||||
</classpath>
|
||||
</java>
|
||||
|
@ -70,14 +67,14 @@ build.sysclasspath=ignore
|
|||
<arg value="${antlr3.gen.dir}/org/antlr/v4/parse"/>
|
||||
<arg value="SourceGenTriggers.g"/>
|
||||
<classpath>
|
||||
<pathelement location="${antlr3.jar}"/>
|
||||
<path refid="cp.antlr3"/>
|
||||
<pathelement path="${java.class.path}"/>
|
||||
</classpath>
|
||||
</java>
|
||||
|
||||
</target>
|
||||
|
||||
<target name="compile" depends="antlr" description="Compile for generic OS">
|
||||
<target name="compile" depends="build-init,antlr3" description="Compile for generic OS">
|
||||
<mkdir dir="${build.dir}/classes"/>
|
||||
<javac
|
||||
destdir="${build.dir}/classes"
|
||||
|
@ -87,7 +84,10 @@ build.sysclasspath=ignore
|
|||
excludes="org/antlr/v4/test/**">
|
||||
<compilerarg value="-Xlint"/>
|
||||
<compilerarg value="-Xlint:-serial"/>
|
||||
<classpath refid="classpath"/>
|
||||
<classpath>
|
||||
<path refid="cp.antlr3"/>
|
||||
<pathelement location="${basedir}/runtime/Java/lib/org.abego.treelayout.core.jar"/>
|
||||
</classpath>
|
||||
<src path="${basedir}/tool/src:${basedir}/runtime/Java/src:${antlr3.gen.dir}"/>
|
||||
</javac>
|
||||
</target>
|
||||
|
|
Loading…
Reference in New Issue