diff options
author | michelou <michelou@epfl.ch> | 2008-02-26 15:12:00 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2008-02-26 15:12:00 +0000 |
commit | cf6f492cc7a52de05fb21c3acdc054039a301cd6 (patch) | |
tree | 8c39266c0b4b60b2c7ef416eb98a966fa7a5958b /src/build/build-imports.xml | |
parent | fe0b578001f1f9a47c6e8d375382194474c75736 (diff) | |
download | scala-cf6f492cc7a52de05fb21c3acdc054039a301cd6.tar.gz scala-cf6f492cc7a52de05fb21c3acdc054039a301cd6.tar.bz2 scala-cf6f492cc7a52de05fb21c3acdc054039a301cd6.zip |
added new Ant build script (beta)
Diffstat (limited to 'src/build/build-imports.xml')
-rw-r--r-- | src/build/build-imports.xml | 589 |
1 files changed, 589 insertions, 0 deletions
diff --git a/src/build/build-imports.xml b/src/build/build-imports.xml new file mode 100644 index 0000000000..9009967a33 --- /dev/null +++ b/src/build/build-imports.xml @@ -0,0 +1,589 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- $Id: $ --> + +<project name="build-imports" basedir="../.." default="."> + + <property environment="env"/> + + <!-- Prevents system classpath from being used --> + <property name="build.sysclasspath" value="ignore"/> + + <!-- Defines the repository layout --> + <property name="lib.dir" value="${basedir}/lib"/> + <property name="src.dir" value="${basedir}/src"/> + <property name="test.dir" value="${basedir}/test"/> + <property name="docs.dir" value="${basedir}/docs"/> + <property name="scripts.dir" value="${src.dir}/build"/> + + <!-- Loads custom properties definitions --> + <property file="${scripts.dir}/build-imports.properties"/> + + <!-- Defines the product being built --> + <property name="vendor.name" value="LAMP/EPFL"/> + <property name="copyright.string" value="(c) 2002-2008 ${vendor.name}"/> + <property name="java.flags" value="-Xmx768M -Xms16M"/> + <property name="number.file" value="${basedir}/build.number"/> + + <!-- Sets location of pre-compiled libraries --> + <property name="lib.starr.jar" value="${lib.dir}/scala-library.jar"/> + <property name="comp.starr.jar" value="${lib.dir}/scala-compiler.jar"/> + <property name="fjbg.jar" value="${lib.dir}/fjbg.jar"/> + <property name="msil.jar" value="${lib.dir}/msil.jar"/> + <property name="jline.jar" value="${lib.dir}/jline.jar"/> + <property name="ant.jar" value="${ant.home}/lib/ant.jar"/> + <property name="ant-contrib.jar" value="${lib.dir}/ant-contrib.jar"/> + + <property name="lib.jar.name" value="scala-library.jar"/> + <property name="dbc.jar.name" value="scala-dbc.jar"/> + <property name="comp.jar.name" value="scala-compiler.jar"/> + <property name="partest.jar.name" value="scala-partest.jar"/> + <property name="libsrc.jar.name" value="scala-library-src.jar"/> + <property name="dbcsrc.jar.name" value="scala-dbc-src.jar"/> + <property name="parsrc.jar.name" value="scala-partest-src.jar"/> + <property name="compsrc.jar.name" value="scala-compiler-src.jar"/> + <property name="scala.exec.name" value="scala"/> + <property name="scalac.exec.name" value="scalac"/> + <property name="scaladoc.exec.name" value="scaladoc"/> + <property name="fsc.exec.name" value="fsc"/> + <property name="comp.prop.name" value="compiler.properties"/> + <property name="lib.prop.name" value="library.properties"/> + <property name="par.prop.name" value="partest.properties"/> + + <!-- if available, faster stability checking --> + <property name="stability.tool" value="/home/linuxsoft/apps/stability/stability"/> + +<!-- =========================================================================== +ANT INITIALISATION +============================================================================ --> + + <target name="ant-init" unless="ant-init.avail"> + <!-- Making sure lib/ contains everything that is needed --> + <fail message="A required library is missing in 'lib/'. The README file describes what should be there."> + <condition><not><and> + <available file="${lib.starr.jar}"/> + <available file="${comp.starr.jar}"/> + <available file="${fjbg.jar}"/> + <available file="${msil.jar}"/> + <available file="${jline.jar}"/> + <available file="${ant-contrib.jar}"/> + </and></not></condition> + </fail> + <!-- Setting-up Ant contrib tasks --> + <taskdef resource="net/sf/antcontrib/antlib.xml" + classpath="${ant-contrib.jar}"/> + <fail message="External library ${ant-contrib.jar} requires the optional Ant tasks to be installed"> + <condition><not><and> + <available file="${ant.home}/lib/ant-nodeps.jar"/> + </and></not></condition> + </fail> + <property name="ant-init.avail" value="yes"/> + </target> + +<!-- =========================================================================== +INITIALISATION +============================================================================ --> + + <target name="init" depends="ant-init" unless="init.avail"> + <!-- Making sure enough memory is available --> + <propertyregex + property="memory.set" input="${env.ANT_OPTS}" select="\1" + regexp="-Xmx([1-9][0-9]{3,}|[6-9][0-9]{2}|5[2-9][0-9]|51[2-9])(M|m)"/> + <fail + unless="memory.set" + message="SABBUS requires additional memory. Please set the 'ANT_OPTS' environment property to '-Xmx512M' or more."/> + <propertyregex + property="memory.info" input="${env.ANT_OPTS}" defaultValue="" + select=" (raise to 600 MB for performance)" + regexp="-Xmx([1-5][0-9]{2})(M|m)"/> + <!-- This is the start time for the distribution --> + <stopwatch name="timer.dist"/> + <tstamp prefix="time"> + <format property="human" pattern="EEEE, d MMMM yyyy, HH:mm:ss (zz)"/> + <format property="short" pattern="yyyyMMddHHmmss"/> + </tstamp> + <!-- Finding out what system architecture is being used --> + <condition property="os.win"><os family="windows"/></condition> + <if><isset property="os.win"/><then> + <exec + executable="cygpath" vmlauncher="no" + errorproperty="cygpath.err" outputproperty="cygpath.out"> + <arg value="--windir"/> + </exec> + <condition property="os.cygwin"> + <equals arg1="${cygpath.err}" arg2=""/> + </condition> + </then></if> + <condition property="os.unix"><or> + <os family="unix"/> + <os family="mac"/> + <isset property="os.cygwin"/> + </or></condition> + <if><isset property="os.cygwin"/> + <then><property name="os.type" value="Cygwin"/></then> + <elseif><isset property="os.win"/> + <then><property name="os.type" value="Windows"/></then> + </elseif> + <elseif><isset property="os.unix"/> + <then><property name="os.type" value="UNIX"/></then> + </elseif> + <else><fail>System environment could not be determined</fail></else> + </if> + <!-- Finding out SVN revision --> + <exec + executable="svn" vmlauncher="no" + errorproperty="svn.err" outputproperty="svn.out"> + <arg line=" info ${basedir}"/> + </exec> + <propertyregex + property="svn.number" input="${svn.out}" select="\1" + regexp="Revision: ([0-9]+)" + defaultValue="x"/> + <property name="init.avail" value="yes"/> + <!-- Printing out some information about what environment I am running in --> + <echo level="info" + message="OS: ${os.type} (${os.name} ${os.arch} ${os.version});"/> + <echo level="info" + message="Java: ${java.vm.name} ${java.vm.version} ('${java.home}');"/> + <echo level="info" + message="Memory: ${memory.set} MB${memory.info};"/> + <echo level="info" + message="Ant: ${ant.version}."/> + </target> + +<!-- =========================================================================== +DIST +============================================================================ --> + + <target name="dist.devel" depends="init"> + <property file="${number.file}"/> + <property name="version.number" + value="${version.major}.${version.minor}.${version.patch}.r${svn.number}"/> + <runtarget target="pack"/> + </target> + + <target name="dist.patch" depends="init"> + <property file="${number.file}"/> + <property name="version.number" + value="${version.major}.${version.minor}.${version.patch}.${version.suffix}"/> + <runtarget target="pack"/> + </target> + + <target name="dist.minor" depends="init"> + <property file="${number.file}"/> + <property name="version.number" + value="${version.major}.${version.minor}.${version.patch}.${version.suffix}"/> + <runtarget target="pack"/> + </target> + + <target name="pack" + depends="build.archive" + description="Packs a distribution for SBaz and ZIP/TAR"/> + + <target name="build.dist" depends="binaries" + description="Creates the latest Scala distribution"> + <!-- Copy the API, examples and man --> + <copy todir="${dist.current.dir}/doc/scala"> + <fileset dir="${docs.dir}" includes="README,LICENSE"/> + </copy> + <!-- + <copy todir="${dist.current.dir}/doc/scala/api"> + <fileset dir="${api-lib.dir}"/> + </copy> + --> + <copy todir="${dist.current.dir}/doc/scala/examples"> + <fileset dir="${docs.dir}/examples"/> + </copy> + <!-- + <copy todir="${dist.current.dir}/man/man1"> + <fileset dir="${tooldocs.dir}" includes="**/*.1"/> + </copy> + <copy todir="${dist.current.dir}/doc/scala/tools"> + <fileset dir="${tooldocs.dir}"> + <include name="**/*.html"/> + <include name="**/*.css"/> + <include name="**/*.gif"/> + <include name="**/*.png"/> + </fileset> + </copy> + --> + <stopwatch name="timer.dist" action="total"/> + </target> + + <target name="build.archive" depends="build.dist"> + <tar + destfile="${dist.dir}/scala-${version.number}.tgz" + compression="gzip"> + <tarfileset + prefix="scala-${version.number}" + dir="${dist.current.dir}" + includes="bin/**" mode="755" + /> + <tarfileset + prefix="scala-${version.number}" + dir="${dist.current.dir}" + excludes="bin/**" + /> + </tar> + <checksum + file="${dist.dir}/scala-${version.number}.tgz" + forceOverwrite="yes" + fileext=".md5"/> + <!-- Create zip archive --> + <zip + destfile="${dist.dir}/scala-${version.number}.zip"> + <zipfileset + prefix="scala-${version.number}" + dir="${dist.current.dir}" + /> + </zip> + <checksum + file="${dist.dir}/scala-${version.number}.zip" + forceOverwrite="yes" + fileext=".md5"/> + <!-- Create source archive --> + <copy todir="${dist.dir}/scala-${version.number}"> + <fileset + dir="${basedir}" + excludes="build,build/**,dists/**" + /> + </copy> + <tar basedir="${dist.dir}" + destfile="${dist.dir}/scala-${version.number}-sources.tgz" + compression="gzip" + includes="scala-${version.number}/**" + /> + </target> + +<!-- =========================================================================== +TEST +============================================================================ --> + + <target name="test" depends="test.stability" + description="Tests the build for stability"/> + + <!-- Compares quick and test level --> + <target name="test.stability" depends="build.strap"> + <if><available file="${stability.tool}"/> + <then> <!-- use stability tool for fast checking --> + <exec executable="${stability.tool}" failonerror="true"> + <arg value="${quick.dir}"/> + <arg value="${strap.dir}"/> + </exec> + </then><else> <!-- check stability the slow way --> + <checksum totalproperty="quick.md5"> + <fileset dir="${quick.dir}/lib"> + <include name="library/**"/> + <include name="compiler/**"/> + </fileset> + </checksum> + <delete quiet="yes" failonerror="no"> + <fileset dir="${quick.dir}" includes="**/*.MD5"/> + </delete> + <checksum totalproperty="strap.md5"> + <fileset dir="${strap.dir}/lib"> + <include name="library/**"/> + <include name="compiler/**"/> + </fileset> + </checksum> + <delete quiet="yes" failonerror="no"> + <fileset dir="${strap.dir}" includes="**/*.MD5"/> + </delete> + <fail message="Build ${version.number} is not stable"> + <condition><not> + <equals arg1="${quick.md5}" arg2="${strap.md5}"/> + </not></condition> + </fail> + <echo level="info" message="Build ${version.number} is stable."/> + </else></if> + </target> + +<!-- =========================================================================== +CLEAN +============================================================================ --> + + <macrodef name="remove"> + <attribute name="dir"/> + <sequential> + <if> + <available file="@{dir}/is_symlink"/> + <then> + <delete includeemptydirs="true" quiet="yes" failonerror="no"> + <fileset dir="@{dir}" includes="**/*"/> + </delete> + </then></if> + <delete dir="@{dir}" includeemptydirs="yes" quiet="yes" failonerror="no"/> + </sequential> + </macrodef> + + <target name="clean" depends="ant-init" description="Removes QUICK, STRAP and API build products"> + <remove dir="${quick.dir}"/> + <remove dir="${strap.dir}"/> + <remove dir="${api.dir}"/> + </target> + + <target name="clean.build" depends="ant-init" + description="Removes all build products"> + <remove dir="${build.dir}"/> + </target> + + <target name="clean.all" depends="ant-init" + description="Removes all build products and distributions"> + <remove dir="${build.dir}"/> + <remove dir="${dist.dir}"/> + </target> + + <target name="clean.unfreeze" depends="init"> + <delete file="${locker.dir}/complete" quiet="yes" failonerror="no"/> + <remove dir="${quick.dir}"/> + </target> + +<!-- =========================================================================== +MACROS +============================================================================ --> + + <macrodef name="build.support"> + <attribute name="outputdir"/> + <sequential> + <copy todir="@{outputdir}/lib/library"> + <fileset dir="${src.dir}/library"> + <include name="**/*.tmpl"/> + <include name="**/*.xml"/> + <include name="**/*.js"/> + <include name="**/*.css"/> + </fileset> + </copy> + <copy todir="@{outputdir}/lib/compiler"> + <fileset dir="${src.dir}/compiler"> + <include name="**/*.tmpl"/> + <include name="**/*.xml"/> + <include name="**/*.js"/> + <include name="**/*.css"/> + </fileset> + </copy> + </sequential> + </macrodef> + + <macrodef name="buildlayer"> + <attribute name="name"/> + <attribute name="libpath"/> + <attribute name="comppath"/> + <attribute name="outputdir"/> + <attribute name="buildall" default=""/> + <sequential> + <property name="built.@{name}" value="yes"/> + <stopwatch name="timer.@{name}"/> + <!-- Create layer-specific task 'scalac' --> + <path id="starr.classpath"> + <pathelement location="@{libpath}"/> + <pathelement location="@{comppath}"/> + <pathelement location="${fjbg.jar}"/> + <pathelement location="${msil.jar}"/> + <pathelement location="${jline.jar}"/> + <pathelement location="${ant.jar}"/> + </path> + <taskdef + name="scalac" + classname="scala.tools.ant.Scalac" + classpathref="starr.classpath" + /> + <!-- Build library --> + <mkdir dir="@{outputdir}/lib/library"/> + <javac + srcdir="${src.dir}/library" + destdir="@{outputdir}/lib/library" + source="1.4" target="1.4" deprecation="yes" + classpath="@{outputdir}/lib/library" + includes="**/*.java"/> + <scalac + srcdir="${src.dir}/library" + destdir="@{outputdir}/lib/library" + usepredefs="no" + addparams="${nsc.params}" target="${nsc.target}" + deprecation="yes" unchecked="yes" + classpath="@{outputdir}/lib/library" + includes="scala/Predef.scala"/> + <scalac + srcdir="${src.dir}/library" + destdir="@{outputdir}/lib/library" + addparams="${nsc.params}" target="${nsc.target}" + deprecation="yes" unchecked="yes" + classpath="@{outputdir}/lib/library"> + <include name="**/*.scala"/> + <exclude name="scala/Predef.scala"/> + <exclude name="scala/dbc/**"/> + <exclude name="scala/actors/**"/> + <excludesfile name="${nsc.excludes.file}" if="excludes.avail"/> + </scalac> + <echo + file="@{outputdir}/lib/library/${lib.prop.name}" + message="version.number=${version.number}${line.separator}" + append="false" + /> + <echo + file="@{outputdir}/lib/library/${lib.prop.name}" + message="copyright.string=${copyright.string}${line.separator}" + append="true" + /> + <!-- Build compiler --> + <mkdir dir="@{outputdir}/lib/compiler"/> + <scalac + srcdir="${src.dir}/compiler" + destdir="@{outputdir}/lib/compiler" + addparams="${nsc.params}" target="${nsc.target}" + deprecation="yes" unchecked="yes"> + <classpath> + <pathelement location="@{outputdir}/lib/library"/> + <pathelement location="@{outputdir}/lib/compiler"/> + <pathelement location="${fjbg.jar}"/> + <pathelement location="${msil.jar}"/> + <pathelement location="${jline.jar}"/> + <pathelement location="${ant.jar}"/> + </classpath> + <include name="**/*.scala"/> + <excludesfile name="${nsc.excludes.file}" if="excludes.avail"/> + </scalac> + <echo + file="@{outputdir}/lib/compiler/${comp.prop.name}" + message="version.number=${version.number}${line.separator}" + append="false" + /> + <echo + file="@{outputdir}/lib/compiler/${comp.prop.name}" + message="copyright.string=${copyright.string}${line.separator}" + append="true" + /> + <if> + <length string="@{buildall}" when="greater" length="0"/> + <then> + <!-- Build DBC library --> + <mkdir dir="@{outputdir}/lib/dbc"/> + <scalac + srcdir="${src.dir}/dbc" + destdir="@{outputdir}/lib/dbc" + addparams="${nsc.params}" target="${nsc.target}" + deprecation="yes" unchecked="yes" + scalacdebugging="${nsc.log-files}"> + <classpath> + <pathelement location="@{outputdir}/lib/library"/> + <pathelement location="@{outputdir}/lib/dbc"/> + </classpath> + <include name="scala/dbc/**/*.scala"/> + <excludesfile name="${nsc.excludes.file}" if="excludes.avail"/> + </scalac> + <!-- Build actors library --> + <mkdir dir="@{outputdir}/lib/actors"/> + <javac + srcdir="${src.dir}/actors" + destdir="@{outputdir}/lib/actors" + source="1.4" target="1.4" deprecation="yes" + classpath="@{build.dir}/lib/actors" + includes="scala/actors/**/*.java"/> + <scalac + srcdir="${src.dir}/actors" + destdir="@{outputdir}/lib/actors" + addparams="${nsc.params}" target="${nsc.target}" + deprecation="yes" unchecked="yes" + scalacdebugging="${nsc.log-files}"> + <classpath> + <pathelement location="@{outputdir}/lib/library"/> + <pathelement location="@{outputdir}/lib/actors"/> + </classpath> + <include name="scala/actors/**/*.scala"/> + <excludesfile name="${nsc.excludes.file}" if="excludes.avail"/> + </scalac> + <!-- Build partest --> + <mkdir dir="@{outputdir}/lib/partest"/> + <javac + srcdir="${src.dir}/partest" + destdir="@{outputdir}/lib/partest" + source="1.4" target="1.4" deprecation="yes" + classpath="@{outputdir}/lib/partest" + includes="scala/tools/partest/**/*.java"/> + <scalac + srcdir="${src.dir}/partest" + destdir="@{outputdir}/lib/partest" + addparams="${nsc.params}" target="${nsc.target}" + deprecation="yes" unchecked="yes"> + <classpath> + <pathelement location="@{outputdir}/lib/library"/> + <pathelement location="@{outputdir}/lib/compiler"/> + <pathelement location="@{outputdir}/lib/actors"/> + </classpath> + </scalac> + <echo + file="@{outputdir}/lib/partest/${par.prop.name}" + message="version.number=${version.number}${line.separator}" + append="false" + /> + <echo + file="@{outputdir}/lib/partest/${par.prop.name}" + message="copyright.string=${copyright.string}${line.separator}" + append="true" + /> + </then> + </if> + <!-- Timing the build --> + <stopwatch name="timer.@{name}" action="total"/> + <!-- Copy support files to build folder and links external libraries--> + <build.support outputdir="@{outputdir}"/> + <!-- Build executable files --> + <path id="build.classpath"> + <pathelement location="@{outputdir}/lib/library"/> + <pathelement location="@{outputdir}/lib/compiler"/> + <pathelement location="${fjbg.jar}"/> + <pathelement location="${msil.jar}"/> + <pathelement location="${jline.jar}"/> + <pathelement location="${ant.jar}"/> + </path> + <taskdef + name="scalatool" + classname="scala.tools.ant.ScalaTool" + classpathref="build.classpath"/> + <mkdir dir="@{outputdir}/bin"/> + <scalatool + file="@{outputdir}/bin/${scala.exec.name}" + version="${version.number}" + copyright="${copyright.string}" + name="Scala code runner" + class="scala.tools.nsc.MainGenericRunner" + javaFlags="${java.flags}"/> + <scalatool + file="@{outputdir}/bin/${scalac.exec.name}" + name="Scala compiler" + class="scala.tools.nsc.Main" + version="${version.number}" + copyright="${copyright.string}" + javaFlags="${java.flags}"/> + <scalatool + file="@{outputdir}/bin/${scaladoc.exec.name}" + name="Scala doc generator" + class="scala.tools.nsc.Main" + toolflags="-Ydoc" + version="${version.number}" + copyright="${copyright.string}" + javaFlags="${java.flags}"/> + <scalatool + file="@{outputdir}/bin/${fsc.exec.name}" + name="Fast Scala compiler" + class="scala.tools.nsc.CompileClient" + version="${version.number}" + copyright="${copyright.string}" + javaFlags="${java.flags}"/> + <chmod perm="ugo+rx" + file="@{outputdir}/bin/${scalac.exec.name}"/> + <chmod perm="ugo+rx" + file="@{outputdir}/bin/${scala.exec.name}"/> + <chmod perm="ugo+rx" + file="@{outputdir}/bin/${scaladoc.exec.name}"/> + <chmod perm="ugo+rx" + file="@{outputdir}/bin/${fsc.exec.name}"/> + <fixcrlf + srcdir="@{outputdir}/bin" + eol="dos" + includes="**/*.bat"/> + <!-- Mark layer as being completely built --> + <touch file="@{outputdir}/complete" verbose="no"/> + </sequential> + </macrodef> + +</project> |