160 lines
5.7 KiB
XML
160 lines
5.7 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<project name="ANTLR4" default="distribute" basedir=".">
|
|
<target name="basic-init">
|
|
<property file="user.build.properties"/>
|
|
<property name="dist.dir" value="${basedir}/dist" />
|
|
<property name="build.dir" value="${basedir}/build" />
|
|
<property name="lib.dir" value="${basedir}/lib" />
|
|
</target>
|
|
|
|
<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}"/>
|
|
|
|
<property name="build.antlr3.dir" value="${build.dir}/generated-sources/antlr3" />
|
|
</target>
|
|
|
|
<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">
|
|
<mkdir dir="${build.antlr3.dir}" />
|
|
|
|
<echo>parse grammars</echo>
|
|
<java classname="org.antlr.Tool" fork="true" failonerror="true" maxmemory="300m"
|
|
dir="${basedir}/tool/src/org/antlr/v4/parse">
|
|
<arg value="-verbose"/>
|
|
<arg value="-make"/>
|
|
<arg value="-o"/>
|
|
<arg value="${build.antlr3.dir}/org/antlr/v4/parse"/>
|
|
<arg value="ANTLRParser.g"/>
|
|
<arg value="ANTLRLexer.g"/>
|
|
<arg value="ActionSplitter.g"/>
|
|
<arg value="ATNBuilder.g"/>
|
|
<arg value="BlockSetTransformer.g"/>
|
|
<arg value="GrammarTreeVisitor.g"/>
|
|
<arg value="LeftRecursiveRuleWalker.g"/>
|
|
<classpath>
|
|
<path refid="cp.antlr3"/>
|
|
<pathelement path="${java.class.path}"/>
|
|
</classpath>
|
|
</java>
|
|
|
|
<echo>codegen grammars</echo>
|
|
<java classname="org.antlr.Tool" fork="true" failonerror="true" maxmemory="300m"
|
|
dir="${basedir}/tool/src/org/antlr/v4/codegen">
|
|
<arg value="-verbose"/>
|
|
<arg value="-make"/>
|
|
<arg value="-o"/>
|
|
<arg value="${build.antlr3.dir}/org/antlr/v4/codegen"/>
|
|
<arg value="-lib"/>
|
|
<arg value="${build.antlr3.dir}/org/antlr/v4/parse"/>
|
|
<arg value="SourceGenTriggers.g"/>
|
|
<classpath>
|
|
<path refid="cp.antlr3"/>
|
|
<pathelement path="${java.class.path}"/>
|
|
</classpath>
|
|
</java>
|
|
|
|
</target>
|
|
|
|
<target name="compile" depends="build-init,antlr3" description="Compile for generic OS">
|
|
<mkdir dir="${build.dir}/classes"/>
|
|
<javac
|
|
destdir="${build.dir}/classes"
|
|
source="1.5"
|
|
target="1.5"
|
|
debug="true"
|
|
excludes="org/antlr/v4/test/**">
|
|
<compilerarg value="-Xlint"/>
|
|
<compilerarg value="-Xlint:-serial"/>
|
|
<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:${build.antlr3.dir}"/>
|
|
</javac>
|
|
</target>
|
|
|
|
<target name="build-jar" depends="compile" description="Build ANTLR 4.jar">
|
|
<mkdir dir="${dist.dir}"/>
|
|
|
|
<jar jarfile="${jar.file}">
|
|
<fileset dir="${build.dir}/classes" includes="**/*.class"/>
|
|
<fileset dir="${basedir}/tool/resources">
|
|
<include name="**/*.st"/>
|
|
<include name="**/*.stg"/>
|
|
</fileset>
|
|
<zipfileset includes="org/antlr/**, org/antlr/stringtemplate/**, org/stringtemplate/v4/**" src="${antlr3.jar}"/>
|
|
<zipfileset includes="**/*.class" src="${basedir}/runtime/Java/lib/org.abego.treelayout.core.jar"/>
|
|
<manifest>
|
|
<attribute name="Version" value="${version}"/>
|
|
<attribute name="Main-Class" value="org.antlr.v4.Tool"/>
|
|
</manifest>
|
|
</jar>
|
|
</target>
|
|
|
|
<target name="zip-source" depends="compile">
|
|
<mkdir dir="${install.root.dir}"/>
|
|
|
|
<mkdir dir="${install.root.dir}/src"/>
|
|
<copy todir="${install.root.dir}/src">
|
|
<fileset dir="${basedir}/tool/src/">
|
|
<include name="**/*.java"/>
|
|
<include name="**/*.g"/>
|
|
<include name="**/*.st"/>
|
|
<include name="**/*.stg"/>
|
|
</fileset>
|
|
<fileset dir="${basedir}/tool/resources/">
|
|
<include name="**/*.st"/>
|
|
<include name="**/*.stg"/>
|
|
</fileset>
|
|
<fileset dir="${basedir}/runtime/Java/src/">
|
|
<include name="**/*.java"/>
|
|
<include name="**/*.g"/>
|
|
<include name="**/*.st"/>
|
|
<include name="**/*.stg"/>
|
|
</fileset>
|
|
<fileset dir="${build.antlr3.dir}"/>
|
|
</copy>
|
|
|
|
<copy todir="${install.root.dir}">
|
|
<fileset dir=".">
|
|
<include name="build.properties"/>
|
|
<include name="build.xml"/>
|
|
<include name="LICENSE.txt"/>
|
|
<include name="README.txt"/>
|
|
<include name="doxyfile"/>
|
|
</fileset>
|
|
</copy>
|
|
|
|
<copy todir="${install.root.dir}/lib" file="${antlr3.jar}">
|
|
</copy>
|
|
|
|
<zip destfile="${dist.dir}/antlr-${version}-src.zip">
|
|
<zipfileset dir="${install.root.dir}" prefix="antlr-${version}"/>
|
|
</zip>
|
|
</target>
|
|
|
|
<target name="distribute" depends="clean, zip-source, build-jar">
|
|
</target>
|
|
|
|
</project>
|