Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
243 lines (219 sloc) 7.64 KB
<?xml version="1.0" encoding="UTF-8"?>
<project name="scala-tool-support" default="build">
<description>
I am SABBUS for ${ant.project.name}, the build system for the Scala tool support.
Please check the 'docs/README' file for more information about me.
</description>
<echo>Running SABBUS for ${ant.project.name}</echo>
<!-- ===========================================================================
PROPERTIES
============================================================================ -->
<property name="src.dir" value="${basedir}/src"/>
<property name="build.dir" value="${basedir}/build"/>
<property name="dist.dir" value="${basedir}/dists"/>
<!-- User properties -->
<property file="${basedir}/build.properties"/>
<!-- SVN configuration properties -->
<property name="svn.entries" value="${basedir}/.svn/entries"/>
<!-- set the following to your local scala checkout -->
<property name="number.file" value="${core.dir}/build.number"/>
<property name="scala.lib.dir" value="${core-pack.dir}/lib"/>
<property name="scala.comp.jar" value="${scala.lib.dir}/scala-compiler.jar"/>
<property name="scala.lib.jar" value="${scala.lib.dir}/scala-library.jar"/>
<property name="ant-contrib.jar" value="${core.dir}/lib/ant/ant-contrib.jar"/>
<!-- -->
<property name="dist.name" value="scala-tool-support"/>
<property name="dist.latest.dir" value="${dist.dir}/latest"/>
<property name="version.separator" value="."/>
<!-- ===========================================================================
INITIALISATION
============================================================================ -->
<target name="init">
<tstamp prefix="time">
<format
property="human"
pattern="EEEE, d MMMM yyyy, HH:mm:ss (zz)"
/>
<format
property="short"
pattern="yyyyMMdd-HHmmss"
/>
</tstamp>
<echo level="verbose" message="ant-contrib.jar=${ant-contrib.jar}"/>
<fail message="Additional Ant tasks in 'lib/' is not available">
<condition><not>
<available
classname="net.sf.antcontrib.AntContribVersion"
classpath="${ant-contrib.jar}"
/>
</not></condition>
</fail>
<!-- Setting-up Ant contrib tasks -->
<taskdef resource="net/sf/antcontrib/antlib.xml">
<classpath>
<pathelement location="${ant-contrib.jar}"/>
</classpath>
</taskdef>
<!-- 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"/>
</target>
<target name="build.init" depends="init">
<!-- 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>
<path id="scala.classpath">
<pathelement location="${scala.lib.jar}"/>
<pathelement location="${scala.comp.jar}"/>
</path>
<!-- Generating version number -->
<property file="${number.file}"/>
<property
name="version.number"
value="${version.major}.${version.minor}.${version.patch}${version.separator}${svn.number}.${time.short}"
/>
<echo level="verbose" message="version.number=${version.number}"/>
</target>
<!-- ===========================================================================
BUILD
============================================================================ -->
<target name="build.preinit">
<uptodate
property="build.preinit.available"
targetfile="${build.dir}/bash-completion/scala_completion.sh">
<srcfiles dir="${src.dir}">
<include name="scala/**"/>
</srcfiles>
</uptodate>
</target>
<target name="build" depends="build.init" unless="build.preinit.available">
<copy todir="${build.dir}">
<fileset dir="${src.dir}">
<include name="**"/>
<exclude name="scala/**"/>
</fileset>
</copy>
<taskdef resource="scala/tools/ant/antlib.xml" classpathref="scala.classpath"/>
<mkdir dir="${build.dir}/bash-completion/classes"/>
<scalac
destdir="${build.dir}/bash-completion/classes"
classpathref="scala.classpath"
srcdir="${src.dir}/bash-completion"
includes="**/*.scala"/>
<java
classpathref="scala.classpath"
classname="scala.tools.nsc.MainGenericRunner"
output="${build.dir}/bash-completion/scala_completion.sh"
failonerror="true"
fork="true">
<jvmarg value="-Dscala.home=${core-pack.dir}"/>
<arg line="-cp ${build.dir}/bash-completion/classes scala.tools.util.BashCompletion"/>
</java>
<delete dir="${build.dir}/bash-completion/classes"/>
</target>
<!-- ===========================================================================
DISTRIB
============================================================================ -->
<target name="dist.devel" depends="init">
<property file="${number.file}"/>
<property
name="version.number"
value="${version.major}.${version.minor}.${version.patch}${version.separator}${svn.number}"
/>
<runtarget target="dist"/>
</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="dist"/>
</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="dist"/>
</target>
<target name="dist" depends="clean.all,build">
<property
name="dist.current.dir"
value="${dist.dir}/${dist.name}-${version.number}"
/>
<copy todir="${dist.current.dir}">
<fileset dir="${build.dir}" includes="**"/>
</copy>
<if><isset property="os.win"/>
<then>
<copy todir="${dist.latest.dir}">
<fileset dir="${dist.current.dir}"/>
</copy>
</then>
<else>
<symlink
link="${dist.latest.dir}"
resource="${dist.current.dir}"
overwrite="yes"
failonerror="no"
/>
</else>
</if>
</target>
<!-- ===========================================================================
CLEAN
============================================================================ -->
<macrodef name="remove">
<attribute name="dir"/>
<sequential>
<delete
dir="@{dir}"
includeemptydirs="yes"
quiet="yes"
failonerror="no"
/>
</sequential>
</macrodef>
<target
name="clean"
depends="clean.build"
description="Deletes all generated build files."
/>
<target name="clean.build">
<remove dir="${build.dir}"/>
</target>
<target name="clean.all">
<remove dir="${build.dir}"/>
<remove dir="${dist.dir}"/>
</target>
</project>
Something went wrong with that request. Please try again.