Nice build.xml,NONE,1.1
Artem Gr Kozarezov <[email protected]>
| Newsgroups | gmane.comp.lang.nice.cvs |
|---|---|
| Message-ID | <[email protected]> |
Update of /cvsroot/nice/Nice
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28021
Added Files:
build.xml
Log Message:
Nicec bootstrapping using Ant.
--- NEW FILE: build.xml ---
<?xml version="1.0" encoding="UTF-8"?>
<!-- The file was formatted automatically by Eclipse 3.1.0 with maximum line width set to 110. -->
<project name="Nice" default="check">
<!-- For Nice arguments see "http://nice.sourceforge.net/cgi-bin/twiki/view/Doc/NicecAntTaskdef". -->
<taskdef name="nicec" classname="nice.tools.ant.Nicec" />
<property environment="env" />
<property name="compiler" value="modern" description="example: ant -Dcompiler=gcj" />
<property name="build" value="classes" />
<property name="javaccVersion" value="javacc-3.2" />
<property name="javaccZip" value="external/${javaccVersion}.zip" />
<available file="${javaccZip}" property="haveJavacc" />
<path id="freshNice">
<pathelement path="${build}" />
<pathelement path="${build}/console.jar" />
</path>
<macrodef name="mac-javac-single">
<attribute name="includes" />
<attribute name="classpath" default="" />
<sequential>
<javac srcdir="src${path.separator}stdlib"
destdir="${build}"
classpath="@{classpath}"
includes="@{includes}"
debug="on"
optimize="yes"
compiler="${compiler}"
/>
</sequential>
</macrodef>
<macrodef name="mac-javac-multi">
<attribute name="classpath" default="" />
<element name="include" optional="no" />
<sequential>
<javac srcdir="src${path.separator}stdlib"
destdir="${build}"
classpath="@{classpath}"
debug="on"
optimize="yes"
compiler="${compiler}"
>
<include />
</javac>
</sequential>
</macrodef>
<macrodef name="mac-nicec-old">
<attribute name="package" />
<attribute name="sourcepath" default="src" />
<sequential>
<nicec package="@{package}"
sourcepath="@{sourcepath}"
destination="${build}"
runtime="${NICE_JAR}"
recompile_all="yes"
/>
</sequential>
</macrodef>
<macrodef name="mac-nicec-new">
<attribute name="package" />
<attribute name="args" default="" />
<sequential>
<java failonerror="yes"
fork="yes"
classpath="${NICE_JAR}"
classname="nice.tools.compiler.console.dispatch"
>
<arg value="--sourcepath" />
<arg value="src${path.separator}stdlib" />
<arg value="--destination" />
<arg value="${build}" />
<arg value="--exclude-runtime" />
<arg line="@{args}" />
<arg value="@{package}" />
</java>
</sequential>
</macrodef>
<!-- Find an existing "nice.jar". -->
<target name="envNicec1" if="env.NICEPATH">
<property name="NICE_JAR" value="${env.NICEPATH}${file.separator}nice.jar" />
</target>
<target name="envNicec2" if="env.NICE">
<property name="NICE_JAR" value="${env.NICE}${file.separator}nice.jar" />
</target>
<target name="envNicec3" if="env.NICE_JAR">
<property name="NICE_JAR" value="${env.NICE_JAR}" />
</target>
<target name="initialize" depends="envNicec3,envNicec2,envNicec1">
<echo message="Existing Nice compiler was found at ${NICE_JAR}" level="info" />
</target>
<!-- Bootstrap is split into a sequence of targets, combined in the "bootstrap" target. -->
<target name="core-bootstrap" depends="initialize">
<mkdir dir="${build}" />
<move file="src/bossa/syntax/dispatch.java.bootstrap"
tofile="src/bossa/syntax/dispatch.java"
failonerror="no"
/>
<mac-javac-single includes="nice/tools/util/System.java" />
<mac-nicec-old package="nice.tools.repository" />
<mac-javac-multi>
<include>
<include name="bossa/syntax/dispatch.java" />
<include name="mlsub/typing/*.java" />
<include name="gnu/expr/*.java" />
<include name="nice/lang/Native.java" />
<include name="nice/lang/rawArray.java" />
<include name="bossa/modules/Package.java" />
<include name="bossa/modules/CompilationListener.java" />
<include name="nice/tools/code/*.java" />
<include name="nice/tools/util/JDK.java" />
</include>
</mac-javac-multi>
<mac-javac-single includes="nice/lang/inline/*.java" />
<mac-nicec-old package="bossa.modules" />
<mac-nicec-old package="nice.tools.ast" />
<mac-javac-single includes="bossa/syntax/*.java" />
<move file="src/bossa/syntax/dispatch.java"
tofile="src/bossa/syntax/dispatch.java.bootstrap"
failonerror="no"
/>
<delete file="${build}/bossa/syntax/dispatch.class" />
<mac-nicec-old package="bossa.syntax" />
</target>
<target name="javacc-download" unless="haveJavacc">
<!-- actual location is currently https://www.dev.java.net/files/documents/17/686/javacc-3.2.zip -->
<property name="url" value="https://javacc.dev.java.net/files/documents/17/686/${javaccVersion}.zip" />
<echo message="Should download '${url}' and save it into '${javaccZip}'." level="info" />
<exec executable="wget" dir="external">
<arg value="-t0" />
<arg value="-c" />
<arg value="https://javacc.dev.java.net/files/documents/17/686/${javaccVersion}.zip" />
</exec>
</target>
<target name="javacc" depends="javacc-download">
<unzip src="${javaccZip}" dest="${build}">
<patternset>
<include name="${javaccVersion}/bin/lib/javacc.jar" />
</patternset>
</unzip>
<move file="${build}/${javaccVersion}/bin/lib/javacc.jar" todir="${build}" />
<delete dir="${build}/${javaccVersion}" />
</target>
<target name="parser">
<java fork="yes" dir="src/bossa/parser" classname="javacc">
<classpath>
<pathelement path="${basedir}/${build}/javacc.jar" />
<pathelement path="${basedir}/${build}" />
</classpath>
<arg value="Parser.jj" />
</java>
</target>
<target name="recompile">
<mac-javac-multi>
<include>
<include name="bossa/**/*.java" />
<include name="nice/**/*.java" />
<include name="mlsub/**/*.java" />
<include name="gnu/*/*.java" />
<include name="gnu/*/*/*.java" />
</include>
</mac-javac-multi>
<mac-javac-single includes="nice/lang/*.java" />
</target>
<target name="setDate">
<!-- TODO: Extract the current Nice version from the head of the NEWS file. -->
<property name="version" value="0.9.10" />
<property name="to" value="src/nice/tools/compiler/dateBuild.nice" />
<tstamp>
<format property="NICE_DATE" timezone="UTC" pattern="yyyy.MM.dd, HH:mm:ss zzz" />
</tstamp>
<echo file="${to}" append="no" message="package nice.tools.compiler; " />
<echo file="${to}" append="yes" message="let String versionNumber = "${version}"; " />
<echo file="${to}" append="yes" message="let String buildDate = "${NICE_DATE}"; " />
<echo file="${to}" append="yes" message="let String javaVersion = "${java.version}"; " />
<manifest file="src/nice/tools/compiler/Manifest">
<attribute name="Main-Class" value="nice.tools.compiler.console.fun" />
<attribute name="Implementation-Title" value="Nice Compiler" />
<attribute name="Implementation-Version" value="${version}" />
<attribute name="Implementation-Vendor" value="Daniel Bonniot" />
<attribute name="Implementation-URL" value="http://nice.sourceforge.net/" />
<attribute name="Build-Id" value="Nice compiler version ${version} (build ${NICE_DATE})" />
</manifest>
</target>
<target name="compiler" depends="setDate">
<!-- <mac-nicec-new package="nice.lang" /> -->
<mac-nicec-new package="bossa.syntax" args="--recompile-all" />
<mac-nicec-new package="nice.tools.compiler.console" args="--recompile-all --jar ${build}/console.jar" />
</target>
<target name="tools">
<echo message="Compiling nice.tools.doc..." level="info" />
<mac-nicec-new package="nice.tools.doc" />
<echo message="Compiling nice.tools.unit.console..." level="info" />
<mac-nicec-new package="nice.tools.unit.console" />
<echo message="Compiling nice.tools.ant..." level="info" />
<!-- From the Makefile: NICE_ANTJAR or ANT_HOME should be set, -->
<!-- Ant should be in the CLASSPATH or at least linked to by ./external/ant.jar -->
<property name="sep" value="${path.separator}" />
<property name="ant1" value="${env.NICE_ANTJAR}" />
<property name="ant2" value="${env.ANT_HOME}/lib/ant.jar" />
<property name="ant3" value="external/ant.jar" />
<property name="antPath" value="${ant1}${sep}${ant2}${sep}${ant3}" />
<echo message="Classpath is '${antPath}'." level="debug" />
<mac-nicec-new package="nice.tools.ant" args="--classpath ${antPath}" />
<mac-javac-single includes="nice/tools/ant/*.java" classpath="${antPath}" />
<echo message="Compiling nice.tools.repository.publish..." level="info" />
<mac-nicec-new package="nice.tools.repository.publish" args="--jar ${build}/nicepublish.jar" />
</target>
<target name="libs">
<mac-nicec-new package="nice.functional" />
</target>
<target name="bootstrap" depends="core-bootstrap,javacc,parser,recompile,compiler,tools,libs" />
<!-- The end of bootstrap targets. -->
<available file="${build}/nice.jar" property="haveArchive" />
<target name="archive" unless="haveArchive">
<antcall target="bootstrap" />
<jar destfile="${build}/nice.jar" duplicate="preserve" manifest="src/nice/tools/compiler/Manifest">
<zipfileset src="${build}/console.jar" />
<fileset dir="${build}">
<include name="nice/**" />
<include name="mlsub/**" />
<include name="bossa/**" />
<include name="gnu/**" />
</fileset>
</jar>
</target>
<target name="jar" depends="archive" description="compile and put Nice compiler into share/java/nice.jar">
<copy file="${build}/nice.jar" todir="share/java" />
</target>
<!-- Testing targets. -->
<property name="checkFail" value="yes" description="whether to fail if there are testsuite regressions" />
<target name="testengine">
<mac-javac-single includes="nice/tools/testsuite/*.java" />
</target>
<target name="check_compiler" depends="archive,testengine">
<java classpathref="freshNice" classname="nice.tools.testsuite.TestNice" failonerror="${checkFail}">
<arg value="-runtime" />
<arg value="${build}" />
<arg value="testsuite/compiler" />
</java>
</target>
<target name="check_lib" depends="archive,testengine">
<java classpathref="freshNice" classname="nice.tools.testsuite.TestNice" failonerror="${checkFail}">
<arg value="-runtime" />
<arg value="${build}" />
<arg value="testsuite/lib" />
</java>
</target>
<target name="check" depends="check_compiler,check_lib" description="run testsuite" />
<!-- The end of testing targets. -->
<target name="clean" description="remove all generated files">
<delete dir="${build}" />
<delete dir="testsuite-fail-folder" />
<delete dir="testsuite-temp-folder" />
<delete>
<fileset dir="regtest" includes="*.jar" />
<fileset dir="src/bossa/parser">
<include name="Parse*.java" />
<include name="Token*.java" />
<include name="*CharStream.java" />
</fileset>
<fileset dir="bin">
<include name="nicedoc" />
<include name="niceunit" />
<include name="nicedoc.lnk" />
<include name="niceunit.lnk" />
</fileset>
</delete>
<delete dir="share/java" />
<move file="src/bossa/syntax/dispatch.java"
tofile="src/bossa/syntax/dispatch.java.bootstrap"
failonerror="no"
/>
</target>
</project>
-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click