summaryrefslogtreecommitdiff
path: root/build-ant-macros.xml
diff options
context:
space:
mode:
Diffstat (limited to 'build-ant-macros.xml')
-rw-r--r--build-ant-macros.xml818
1 files changed, 818 insertions, 0 deletions
diff --git a/build-ant-macros.xml b/build-ant-macros.xml
new file mode 100644
index 0000000000..609f106d09
--- /dev/null
+++ b/build-ant-macros.xml
@@ -0,0 +1,818 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project name="build-support" xmlns:artifact="urn:maven-artifact-ant">
+ <description> Macros for Scala's ant build </description>
+
+ <macrodef name="optimized">
+ <attribute name="name"/>
+ <sequential>
+ <antcall target="@{name}">
+ <param name="scalac.args.optimise" value="-optimise"/>
+ </antcall>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="copy-deps" description="Copy a file set based on maven dependency resolution to a directory. Currently used by the IntelliJ config files.">
+ <attribute name="project"/>
+ <attribute name="refid" default="@{project}.fileset"/>
+ <sequential>
+ <delete dir="${build-deps.dir}/@{project}" includes="*.jar"/>
+ <copy todir="${build-deps.dir}/@{project}">
+ <resources refid="@{refid}"/>
+ <mapper type="flatten"/>
+ </copy>
+ </sequential>
+ </macrodef>
+
+ <!-- Set a property @{name}.cross to the actual cross suffix that should be
+ used when resolving the module "@{name}". If the (user-supplied)
+ @{name}.cross.suffix property exists then use that value, otherwise use
+ "_${scala.binary.version}". -->
+ <macrodef name="prepareCross">
+ <attribute name="name" />
+ <sequential>
+ <if>
+ <isset property="@{name}.cross.suffix" />
+ <then>
+ <property name="@{name}.cross" value="${@{name}.cross.suffix}" />
+ </then>
+ <else>
+ <property name="@{name}.cross" value="_${scala.binary.version}" />
+ </else>
+ </if>
+ </sequential>
+ </macrodef>
+
+ <!-- Set property named @{name} to the jar resolved as @{jar}_${scala.binary.version}:jar.
+ @{jar}_${scala.binary.version} must be a maven dependency. -->
+ <macrodef name="propertyForCrossedArtifact">
+ <attribute name="name"/>
+ <attribute name="jar"/>
+ <attribute name="suffix" default="${@{name}.cross}"/>
+ <sequential>
+ <readProperty name="@{name}" property="@{jar}@{suffix}:jar"/>
+ <readProperty name="@{name}-sources" property="@{jar}@{suffix}:java-source:sources"/>
+ <readProperty name="@{name}-javadoc" property="@{jar}@{suffix}:java-source:javadoc"/>
+ </sequential>
+ </macrodef>
+
+ <!-- Set property named @{name} to the value of the property named @{property}.
+ Helper for performing nested property expansion without using the ant props lib -->
+ <macrodef name="readProperty">
+ <attribute name="name"/>
+ <attribute name="property"/>
+ <sequential>
+ <property name="@{name}" value="${@{property}}"/>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="init-project-prop">
+ <attribute name="project"/>
+ <attribute name="name"/>
+ <attribute name="default"/>
+ <sequential>
+ <local name="@{name}"/>
+ <if>
+ <not>
+ <isset property="@{project}.@{name}"/>
+ </not>
+ <then>
+ <property name="@{project}.@{name}" value="@{default}"/>
+ </then>
+ </if>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="clean">
+ <attribute name="build"/>
+ <sequential>
+ <delete dir="${build-@{build}.dir}" includeemptydirs="yes" quiet="yes" failonerror="no"/>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="simple-javac">
+ <attribute name="project"/>
+ <!-- project: asm/forkjoin -->
+ <attribute name="args" default=""/>
+ <attribute name="jar" default="yes"/>
+ <sequential>
+ <uptodate property="@{project}.available" targetfile="${build-libs.dir}/@{project}.complete">
+ <srcfiles dir="${src.dir}/@{project}"/>
+ </uptodate>
+ <if>
+ <not>
+ <isset property="@{project}.available"/>
+ </not>
+ <then>
+ <stopwatch name="@{project}.timer"/>
+ <mkdir dir="${@{project}-classes}"/>
+ <javac debug="true" srcdir="${src.dir}/@{project}" destdir="${@{project}-classes}" classpath="${@{project}-classes}" includes="**/*.java" target="1.6" source="1.5" compiler="javac1.6">
+ <compilerarg line="${javac.args} @{args}"/>
+ </javac>
+ <if>
+ <equals arg1="@{jar}" arg2="yes"/>
+ <then>
+ <jar whenmanifestonly="fail" destfile="${build-libs.dir}/@{project}.jar" basedir="${@{project}-classes}"/>
+ </then>
+ </if>
+ <stopwatch name="@{project}.timer" action="total"/>
+ <mkdir dir="${build-libs.dir}"/>
+ <touch file="${build-libs.dir}/@{project}.complete" verbose="no"/>
+ </then>
+ </if>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="staged-javac">
+ <attribute name="stage"/>
+ <!-- current stage (locker, quick, strap) -->
+ <attribute name="project"/>
+ <!-- project: library/reflect/compiler/actors -->
+ <attribute name="destproject" default="@{project}"/>
+ <!-- overrides the output directory; used when building multiple projects into the same directory-->
+ <attribute name="args" default=""/>
+ <attribute name="excludes" default=""/>
+ <sequential>
+ <javac debug="true" srcdir="${src.dir}/@{project}" destdir="${build-@{stage}.dir}/classes/@{destproject}" includes="**/*.java" excludes="@{excludes}" target="1.6" source="1.5">
+ <compilerarg line="${javac.args} @{args}"/>
+ <classpath refid="@{stage}.@{destproject}.build.path"/>
+ </javac>
+ </sequential>
+ </macrodef>
+
+ <!-- Zinc assumes a one-to-one correspondence of output folder to set of source files.
+ When compiling different sets of source files in multiple compilations to the same output directory,
+ Zinc thinks source files that appeared in an earlier compilation but are absent in the current one,
+ were deleted and thus deletes the corresponding output files.
+
+ Note that zinc also requires each arg to scalac to be prefixed by -S.
+ -->
+ <macrodef name="zinc">
+ <attribute name="compilerpathref"/>
+ <attribute name="destdir"/>
+ <attribute name="srcdir"/>
+ <attribute name="srcpath" default="NOT SET"/>
+ <!-- needed to compile the library, "NOT SET" is just a convention to denote an optional attribute -->
+ <attribute name="buildpathref"/>
+ <attribute name="params" default=""/>
+ <attribute name="java-excludes" default=""/>
+ <sequential>
+ <local name="sources"/>
+ <pathconvert pathsep=" " property="sources">
+ <fileset dir="@{srcdir}">
+ <include name="**/*.java"/>
+ <include name="**/*.scala"/>
+ <exclude name="@{java-excludes}"/>
+ </fileset>
+ </pathconvert>
+ <local name="args"/>
+ <local name="sargs"/>
+ <if>
+ <not>
+ <equals arg1="@{srcpath}" arg2="NOT SET"/>
+ </not>
+ <then>
+ <property name="args" value="@{params} -sourcepath @{srcpath}"/>
+ </then>
+ </if>
+ <property name="args" value="@{params}"/>
+ <!-- default -->
+ <!-- HACK: prefix scalac args by -S -->
+ <script language="javascript">
+ project.setProperty("sargs", project.getProperty("args").trim().replaceAll(" ", " -S"));
+ </script>
+ <exec osfamily="unix" executable="tools/zinc" failifexecutionfails="true" failonerror="true">
+ <arg line="-nailed -compile-order JavaThenScala -scala-path ${ant.refid:@{compilerpathref}} -d @{destdir} -classpath ${toString:@{buildpathref}} ${sargs} ${sources}"/>
+ </exec>
+ </sequential>
+ </macrodef>
+
+ <!-- STAGED COMPILATION MACROS -->
+ <macrodef name="staged-scalac">
+ <attribute name="with"/>
+ <!-- will use path `@{with}.compiler.path` to locate scalac -->
+ <attribute name="stage"/>
+ <!-- current stage (locker, quick, strap) -->
+ <attribute name="project"/>
+ <!-- project: library/reflect/compiler/actors -->
+ <attribute name="srcpath" default="NOT SET"/>
+ <!-- needed to compile the library -->
+ <attribute name="args" default=""/>
+ <!-- additional args -->
+ <attribute name="destproject" default="@{project}"/>
+ <!-- overrides the output directory; used when building multiple projects into the same directory-->
+ <attribute name="srcdir" default="@{project}"/>
+ <attribute name="java-excludes" default=""/>
+ <sequential>
+ <!-- TODO: detect zinc anywhere on PATH
+ use zinc for the quick stage if it's available;
+ would use it for locker but something is iffy in sbt: get a class cast error on global phase -->
+ <if>
+ <and>
+ <available file="tools/zinc"/>
+ <equals arg1="@{stage}" arg2="quick"/>
+ </and>
+ <then>
+ <zinc taskname="Z.@{stage}.@{project}" compilerpathref="@{with}.compiler.path" destdir="${build-@{stage}.dir}/classes/@{destproject}" srcdir="${src.dir}/@{srcdir}" srcpath="@{srcpath}" buildpathref="@{stage}.@{project}.build.path" params="${scalac.args.@{stage}} @{args}" java-excludes="@{java-excludes}"/>
+ </then>
+ <else>
+ <if>
+ <equals arg1="@{srcpath}" arg2="NOT SET"/>
+ <then>
+ <scalacfork taskname="@{stage}.@{project}" jvmargs="${scalacfork.jvmargs}" compilerpathref="@{with}.compiler.path" destdir="${build-@{stage}.dir}/classes/@{destproject}" srcdir="${src.dir}/@{srcdir}" params="${scalac.args.@{stage}} @{args}">
+ <include name="**/*.scala"/>
+ <compilationpath refid="@{stage}.@{project}.build.path"/>
+ </scalacfork>
+ </then>
+ <else>
+ <scalacfork taskname="@{stage}.@{project}" jvmargs="${scalacfork.jvmargs}" compilerpathref="@{with}.compiler.path" destdir="${build-@{stage}.dir}/classes/@{destproject}" srcdir="${src.dir}/@{srcdir}" srcpath="@{srcpath}" params="${scalac.args.@{stage}} @{args}">
+ <include name="**/*.scala"/>
+ <compilationpath refid="@{stage}.@{project}.build.path"/>
+ </scalacfork>
+ </else>
+ </if>
+ </else>
+ </if>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="staged-uptodate">
+ <attribute name="stage"/>
+ <attribute name="project"/>
+ <element name="check"/>
+ <element name="do"/>
+ <sequential>
+ <uptodate property="@{stage}.@{project}.available" targetfile="${build-@{stage}.dir}/@{project}.complete">
+ <check/>
+ </uptodate>
+ <if>
+ <not>
+ <isset property="@{stage}.@{project}.available"/>
+ </not>
+ <then>
+ <do/>
+ <touch file="${build-@{stage}.dir}/@{project}.complete" verbose="no"/>
+ </then>
+ </if>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="staged-build">
+ <attribute name="with"/>
+ <!-- will use path `@{with}.compiler.path` to locate scalac -->
+ <attribute name="stage"/>
+ <!-- current stage (locker, quick, strap) -->
+ <attribute name="project"/>
+ <!-- project: library/reflect/compiler/actors -->
+ <attribute name="srcpath" default="NOT SET"/>
+ <!-- needed to compile the library -->
+ <attribute name="args" default=""/>
+ <!-- additional args -->
+ <attribute name="includes" default="comp.includes"/>
+ <attribute name="java-excludes" default=""/>
+ <attribute name="version" default=""/>
+ <!-- non-empty for scaladoc: use @{version}.version.number in property file-->
+ <sequential>
+ <staged-uptodate stage="@{stage}" project="@{project}">
+ <check>
+ <srcfiles dir="${src.dir}/@{project}"/>
+ </check>
+ <do>
+ <stopwatch name="@{stage}.@{project}.timer"/>
+ <mkdir dir="${build-@{stage}.dir}/classes/@{project}"/>
+ <staged-javac stage="@{stage}" project="@{project}" excludes="@{java-excludes}"/>
+ <!-- always compile with javac for simplicity and regularity; it's cheap -->
+ <staged-scalac with="@{with}" stage="@{stage}" project="@{project}" srcpath="@{srcpath}" args="@{args}" java-excludes="@{java-excludes}"/>
+ <if>
+ <equals arg1="@{version}" arg2=""/>
+ <then>
+ <propertyfile file="${build-@{stage}.dir}/classes/@{project}/@{project}.properties">
+ <entry key="version.number" value="${version.number}"/>
+ <entry key="maven.version.number" value="${maven.version.number}"/>
+ <entry key="osgi.version.number" value="${osgi.version.number}"/>
+ <entry key="copyright.string" value="${copyright.string}"/>
+ </propertyfile>
+ </then>
+ <else>
+ <propertyfile file="${build-@{stage}.dir}/classes/@{project}/@{project}.properties">
+ <entry key="version.number" value="${@{version}.version.number}"/>
+ <entry key="copyright.string" value="${copyright.string}"/>
+ </propertyfile>
+ </else>
+ </if>
+ <copy todir="${build-@{stage}.dir}/classes/@{project}">
+ <fileset dir="${src.dir}/@{project}">
+ <patternset refid="@{includes}"/>
+ </fileset>
+ </copy>
+ <stopwatch name="@{stage}.@{project}.timer" action="total"/>
+ </do>
+ </staged-uptodate>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="staged-bin">
+ <attribute name="stage"/>
+ <attribute name="classpathref" default="NOT SET"/>
+ <sequential>
+ <staged-uptodate stage="@{stage}" project="bin">
+ <check>
+ <srcfiles dir="${src.dir}">
+ <include name="compiler/scala/tools/ant/templates/**"/>
+ </srcfiles>
+ </check>
+ <do>
+ <taskdef name="mk-bin" classname="scala.tools.ant.ScalaTool" classpathref="@{stage}.bin.tool.path"/>
+ <mkdir dir="${build-@{stage}.dir}/bin"/>
+ <if>
+ <equals arg1="@{classpathref}" arg2="NOT SET"/>
+ <then>
+ <mk-bin file="${build-@{stage}.dir}/bin/scala" class="scala.tools.nsc.MainGenericRunner" javaFlags="${java.flags}"/>
+ <mk-bin file="${build-@{stage}.dir}/bin/scalac" class="scala.tools.nsc.Main" javaFlags="${java.flags}"/>
+ <mk-bin file="${build-@{stage}.dir}/bin/scaladoc" class="scala.tools.nsc.ScalaDoc" javaFlags="${java.flags}"/>
+ <mk-bin file="${build-@{stage}.dir}/bin/fsc" class="scala.tools.nsc.CompileClient" javaFlags="${java.flags}"/>
+ <mk-bin file="${build-@{stage}.dir}/bin/scalap" class="scala.tools.scalap.Main" javaFlags="${java.flags}"/>
+ </then>
+ <else>
+ <mk-bin file="${build-@{stage}.dir}/bin/scala" class="scala.tools.nsc.MainGenericRunner" javaFlags="${java.flags}" classpathref="@{classpathref}"/>
+ <mk-bin file="${build-@{stage}.dir}/bin/scalac" class="scala.tools.nsc.Main" javaFlags="${java.flags}" classpathref="@{classpathref}"/>
+ <mk-bin file="${build-@{stage}.dir}/bin/scaladoc" class="scala.tools.nsc.ScalaDoc" javaFlags="${java.flags}" classpathref="@{classpathref}"/>
+ <mk-bin file="${build-@{stage}.dir}/bin/fsc" class="scala.tools.nsc.CompileClient" javaFlags="${java.flags}" classpathref="@{classpathref}"/>
+ <mk-bin file="${build-@{stage}.dir}/bin/scalap" class="scala.tools.scalap.Main" javaFlags="${java.flags}" classpathref="@{classpathref}"/>
+ </else>
+ </if>
+ <chmod perm="ugo+rx" file="${build-@{stage}.dir}/bin/scala"/>
+ <chmod perm="ugo+rx" file="${build-@{stage}.dir}/bin/scalac"/>
+ <chmod perm="ugo+rx" file="${build-@{stage}.dir}/bin/scaladoc"/>
+ <chmod perm="ugo+rx" file="${build-@{stage}.dir}/bin/fsc"/>
+ <chmod perm="ugo+rx" file="${build-@{stage}.dir}/bin/scalap"/>
+ </do>
+ </staged-uptodate>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="staged-pack">
+ <attribute name="project"/>
+ <attribute name="manifest" default=""/>
+ <element name="pre" optional="true"/>
+ <element name="jar-opts" optional="true"/>
+ <sequential>
+ <local name="destfile"/>
+ <property name="destfile" value="${build-pack.dir}/${@{project}.targetdir}/${@{project}.targetjar}"/>
+ <uptodate property="pack.@{project}.available" targetfile="${destfile}">
+ <srcresources>
+ <resources refid="pack.@{project}.files"/>
+ <!-- <path><pathelement location="${build-quick.dir}/@{project}.complete"/></path> -->
+ </srcresources>
+ </uptodate>
+ <if>
+ <not>
+ <isset property="pack.@{project}.available"/>
+ </not>
+ <then>
+ <mkdir dir="${build-pack.dir}/${@{project}.targetdir}"/>
+ <pre/>
+ <if>
+ <not>
+ <equals arg1="@{manifest}" arg2=""/>
+ </not>
+ <then>
+ <jar whenmanifestonly="fail" destfile="${destfile}" manifest="@{manifest}">
+ <!-- update="true" makes no difference on my machine, so starting from scratch-->
+ <jar-opts/>
+ <path refid="pack.@{project}.files"/>
+ </jar>
+ </then>
+ <else>
+ <jar whenmanifestonly="fail" destfile="${destfile}">
+ <jar-opts/>
+ <path refid="pack.@{project}.files"/>
+ </jar>
+ </else>
+ </if>
+ </then>
+ </if>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="staged-docs">
+ <attribute name="project"/>
+ <element name="includes" implicit="true"/>
+ <sequential>
+ <staged-uptodate stage="docs" project="@{project}">
+ <check>
+ <srcfiles dir="${src.dir}/${@{project}.srcdir}"/>
+ </check>
+ <do>
+ <stopwatch name="docs.@{project}.timer"/>
+ <mkdir dir="${build-docs.dir}/@{project}"/>
+ <if>
+ <equals arg1="${@{project}.docroot}" arg2="NOT SET"/>
+ <then>
+ <scaladoc
+ destdir="${build-docs.dir}/@{project}"
+ doctitle="${@{project}.description}"
+ docfooter="epfl"
+ docversion="${version.number}"
+ sourcepath="${src.dir}"
+ classpathref="docs.@{project}.build.path"
+ srcdir="${src.dir}/${@{project}.srcdir}"
+ addparams="${scalac.args.all}"
+ docsourceurl="${scaladoc.url}€{FILE_PATH}.scala#L1"
+ implicits="on"
+ diagrams="on"
+ groups="on"
+ rawOutput="${scaladoc.raw.output}"
+ noPrefixes="${scaladoc.no.prefixes}"
+ docUncompilable="${src.dir}/library-aux"
+ skipPackages="${@{project}.skipPackages}">
+ <includes/>
+ </scaladoc>
+ </then>
+ <else>
+ <scaladoc docRootContent="${src.dir}/@{project}/${@{project}.docroot}"
+ destdir="${build-docs.dir}/@{project}"
+ doctitle="${@{project}.description}"
+ docfooter="epfl"
+ docversion="${version.number}"
+ sourcepath="${src.dir}"
+ classpathref="docs.@{project}.build.path"
+ srcdir="${src.dir}/${@{project}.srcdir}"
+ addparams="${scalac.args.all}"
+ docsourceurl="${scaladoc.url}€{FILE_PATH}.scala#L1"
+ implicits="on"
+ diagrams="on"
+ groups="on"
+ rawOutput="${scaladoc.raw.output}"
+ noPrefixes="${scaladoc.no.prefixes}"
+ docUncompilable="${src.dir}/library-aux"
+ skipPackages="${@{project}.skipPackages}">
+ <includes/>
+ </scaladoc>
+ </else>
+ </if>
+ <stopwatch name="docs.@{project}.timer" action="total"/>
+ </do>
+ </staged-uptodate>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="make-bundle">
+ <attribute name="project"/>
+ <element name="srcs" description="Sources for this bundle" optional="true" implicit="true"/>
+ <sequential>
+ <copy file="${src.dir}/build/bnd/${@{project}.name}.bnd" tofile="${build-osgi.dir}/${@{project}.name}.bnd" overwrite="true">
+ <filterset>
+ <filter token="VERSION" value="${osgi.version.number}"/>
+ <filter token="SCALA_BINARY_VERSION" value="${scala.binary.version}"/>
+ <filter token="SCALA_FULL_VERSION" value="${scala.full.version}"/>
+ <filter token="SCALA_COMPILER_DOC_VERSION" value="${scala-compiler-doc.version.number}"/>
+ <filter token="SCALA_COMPILER_INTERACTIVE_VERSION" value="${scala-compiler-interactive.version.number}"/>
+ <filter token="XML_VERSION" value="${scala-xml.version.number}" />
+ <filter token="PARSER_COMBINATORS_VERSION" value="${scala-parser-combinators.version.number}" />
+ <filter token="CONTINUATIONS_PLUGIN_VERSION" value="${scala-continuations-plugin.version.number}" />
+ <filter token="CONTINUATIONS_LIBRARY_VERSION" value="${scala-continuations-library.version.number}" />
+ <filter token="SCALA_SWING_VERSION" value="${scala-swing.version.number}" />
+ </filterset>
+ </copy>
+ <bnd classpath="${@{project}.jar}" eclipse="false" failok="false" exceptions="true" files="${build-osgi.dir}/${@{project}.name}.bnd" output="${build-osgi.dir}"/>
+ <if>
+ <equals arg1="${@{project}.src}" arg2="true"/>
+ <then>
+ <!--
+ A jar-like task that creates an OSGi source bundle. It adds the required MANIFEST.MF headers that allow
+ Eclipse to match sources with the corresponding binaries.
+ -->
+ <jar whenmanifestonly="fail" destfile="${build-osgi.dir}/${@{project}.name}-src.jar">
+ <srcs/>
+ <manifest>
+ <attribute name="Manifest-Version" value="1.0"/>
+ <attribute name="Bundle-Name" value="${@{project}.description} Sources"/>
+ <attribute name="Bundle-SymbolicName" value="org.scala-lang.${@{project}.package}${@{project}.name}${@{project}.namesuffix}.source"/>
+ <attribute name="Bundle-Version" value="${@{project}.version}"/>
+ <attribute name="Eclipse-SourceBundle" value="org.scala-lang.${@{project}.package}${@{project}.name}${@{project}.namesuffix};version=&quot;${@{project}.version}&quot;;roots:=&quot;.&quot;"/>
+ </manifest>
+ </jar>
+ </then>
+ </if>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="copy-bundle">
+ <attribute name="project"/>
+ <sequential>
+ <copy tofile="${dist.dir}/${@{project}.targetdir}/${@{project}.name}.jar" file="${build-osgi.dir}/org.scala-lang.${@{project}.package}${@{project}.name}.jar" overwrite="true"/>
+ <copy tofile="${dist.dir}/src/${@{project}.name}-src.jar" file="${@{project}.srcjar}" overwrite="true"/>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="mvn-package">
+ <attribute name="project"/>
+ <sequential>
+ <local name="artifact-base"/>
+ <property name="artifact-base" value="${dist.maven}/${@{project}.dir}${@{project}.name}/${@{project}.name}"/>
+ <mkdir dir="${dist.maven}/${@{project}.dir}${@{project}.name}"/>
+ <copy tofile="${artifact-base}.jar" file="${build-osgi.dir}/org.scala-lang.${@{project}.package}${@{project}.name}${@{project}.namesuffix}.jar" overwrite="true"/>
+ <copy tofile="${artifact-base}-src.jar" file="${build-osgi.dir}/${@{project}.name}-src.jar" overwrite="true"/>
+ <copy tofile="${artifact-base}-pom.xml" file="${src.dir}/build/maven/${@{project}.dir}/${@{project}.name}-pom.xml" overwrite="true"/>
+ <if>
+ <not>
+ <isset property="docs.skip"/>
+ </not>
+ <then>
+ <jar destfile="${artifact-base}-docs.jar" basedir="${build-docs.dir}/@{project}" whenmanifestonly="fail">
+ <include name="**/*"/>
+ </jar>
+ </then>
+ </if>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="deploy-remote">
+ <attribute name="jar" default=""/>
+ <attribute name="pom"/>
+ <element name="artifacts" implicit="true" optional="true"/>
+ <sequential>
+ <if><equals arg1="@{jar}" arg2="true"/><then>
+ <artifact:deploy settingsFile="${settings.file}">
+ <artifact:remoteRepository url="${remote.repository}" id="${repository.credentials.id}" />
+ <artifact:pom refid="@{pom}" />
+ <artifacts/>
+ </artifact:deploy>
+ </then><else>
+ <artifact:deploy file="@{jar}" settingsFile="${settings.file}">
+ <artifact:remoteRepository url="${remote.repository}" id="${repository.credentials.id}" />
+ <artifact:pom refid="@{pom}" />
+ <artifacts/>
+ </artifact:deploy>
+ </else></if>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="deploy-local">
+ <attribute name="jar" default=""/>
+ <attribute name="pom"/>
+ <element name="artifacts" implicit="true" optional="true"/>
+ <sequential>
+ <if><equals arg1="@{jar}" arg2="true"/><then>
+ <artifact:install>
+ <artifact:localRepository path="${local.repository}" id="${repository.credentials.id}" />
+ <artifact:pom refid="@{pom}" />
+ <artifacts/>
+ </artifact:install>
+ </then><else>
+ <artifact:install file="@{jar}">
+ <artifact:localRepository path="${local.repository}" id="${repository.credentials.id}" />
+ <artifact:pom refid="@{pom}" />
+ <artifacts/>
+ </artifact:install>
+ </else></if>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="deploy-to">
+ <attribute name="jar" default=""/>
+ <attribute name="pom"/>
+ <attribute name="local"/>
+ <element name="artifacts" implicit="true" optional="true"/>
+ <sequential>
+ <if><equals arg1="@{local}" arg2="true"/><then>
+ <deploy-local jar="@{jar}" pom="@{pom}"> <artifacts/> </deploy-local>
+ </then><else>
+ <deploy-remote jar="@{jar}" pom="@{pom}"> <artifacts/> </deploy-remote>
+ </else></if>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="filter-pom">
+ <attribute name="path" />
+ <attribute name="name" />
+
+ <sequential>
+ <copy file="${path}-pom.xml" tofile="${path}-pom-filtered.xml" overwrite="true">
+ <filterset>
+ <filter token="VERSION" value="${maven.version.number}" />
+ <filter token="SCALA_BINARY_VERSION" value="${scala.binary.version}" />
+ <filter token="SCALA_FULL_VERSION" value="${scala.full.version}" />
+ <filter token="XML_VERSION" value="${scala-xml.version.number}" />
+ <filter token="PARSER_COMBINATORS_VERSION" value="${scala-parser-combinators.version.number}" />
+ <filter token="CONTINUATIONS_PLUGIN_VERSION" value="${scala-continuations-plugin.version.number}" />
+ <filter token="CONTINUATIONS_LIBRARY_VERSION" value="${scala-continuations-library.version.number}" />
+ <filter token="SCALA_SWING_VERSION" value="${scala-swing.version.number}" />
+ <filter token="RELEASE_REPOSITORY" value="${remote.release.repository}" />
+ <filter token="SNAPSHOT_REPOSITORY" value="${remote.snapshot.repository}" />
+ <filter token="JLINE_VERSION" value="${jline.version}" />
+ <filter token="AKKA_ACTOR_VERSION" value="${akka-actor.version.number}" />
+ <filter token="ACTORS_MIGRATION_VERSION" value="${actors-migration.version.number}" />
+
+ <!-- TODO modularize compiler.
+ <filter token="SCALA_COMPILER_DOC_VERSION" value="${scala-compiler-doc.version.number}" />
+ <filter token="SCALA_COMPILER_INTERACTIVE_VERSION" value="${scala-compiler-interactive.version.number}" />
+ -->
+ </filterset>
+ </copy>
+ <artifact:pom id="@{name}.pom" file="${path}-pom-filtered.xml" />
+ </sequential>
+ </macrodef>
+
+ <macrodef name="deploy-one">
+ <attribute name="name" />
+ <attribute name="local" default="false"/>
+ <attribute name="signed" default="false"/>
+
+ <sequential>
+ <local name="path"/> <property name="path" value="${dist.maven}/@{name}/@{name}"/>
+
+ <echo>Deploying ${path}-[pom.xml|src.jar|docs.jar].</echo>
+
+ <filter-pom name="@{name}" path="@{path}"/>
+
+ <if><equals arg1="@{signed}" arg2="false"/><then>
+ <if><isset property="docs.skip"/><then>
+ <deploy-to local="@{local}" jar="${path}.jar" pom="@{name}.pom">
+ <artifact:attach type="jar" file="${path}-src.jar" classifier="sources" />
+ </deploy-to>
+ </then><else>
+ <deploy-to local="@{local}" jar="${path}.jar" pom="@{name}.pom">
+ <artifact:attach type="jar" file="${path}-src.jar" classifier="sources" />
+ <artifact:attach type="jar" file="${path}-docs.jar" classifier="javadoc" />
+ </deploy-to>
+ </else></if>
+ </then><else>
+ <local name="repo"/>
+ <if><equals arg1="@{local}" arg2="false"/><then>
+ <property name="repo" value="${remote.repository}"/>
+ </then><else>
+ <property name="repo" value="${local.repository}"/>
+ </else></if>
+ <artifact:mvn failonerror="true">
+ <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
+ <arg value="-Durl=${repo}" />
+ <arg value="-DrepositoryId=${repository.credentials.id}" />
+ <arg value="-DpomFile=${path}-pom-filtered.xml" />
+ <arg value= "-Dfile=${path}.jar" />
+ <arg value="-Dsources=${path}-src.jar" />
+ <arg value="-Djavadoc=${path}-docs.jar" />
+ <arg value="-Pgpg" />
+ <arg value="-Dgpg.useagent=true" />
+ </artifact:mvn>
+ </else></if>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="deploy-jar">
+ <attribute name="name" />
+ <attribute name="local" default="false"/>
+ <attribute name="signed" default="false"/>
+
+ <sequential>
+ <local name="path"/> <property name="path" value="${dist.maven}/@{name}/@{name}"/>
+
+ <echo>Deploying ${path}.jar with ${path}-pom.xml.</echo>
+
+ <filter-pom name="@{name}" path="@{path}"/>
+
+ <if><equals arg1="@{signed}" arg2="false"/><then>
+ <deploy-to local="@{local}" jar="${path}.jar" pom="@{name}.pom"/>
+ </then><else>
+ <local name="repo"/>
+ <if><equals arg1="@{local}" arg2="false"/><then>
+ <property name="repo" value="${remote.repository}"/>
+ </then><else>
+ <property name="repo" value="${local.repository}"/>
+ </else></if>
+ <artifact:mvn failonerror="true">
+ <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
+ <arg value="-Durl=${repo}" />
+ <arg value="-DrepositoryId=${repository.credentials.id}" />
+ <arg value="-DpomFile=${path}-pom-filtered.xml" />
+ <arg value= "-Dfile=${path}.jar" />
+ <arg value="-Pgpg" />
+ <arg value="-Dgpg.useagent=true" />
+ </artifact:mvn>
+ </else></if>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="deploy-pom">
+ <attribute name="name" />
+ <attribute name="local" default="false"/>
+ <attribute name="signed" default="false"/>
+
+ <sequential>
+ <local name="path"/> <property name="path" value="${dist.maven}/@{name}/@{name}"/>
+
+ <echo>Deploying ${path}-pom.xml.</echo>
+
+ <filter-pom name="@{name}" path="@{path}"/>
+
+ <if><equals arg1="@{signed}" arg2="false"/><then>
+ <deploy-to local="@{local}" pom="@{name}.pom"/>
+ </then><else>
+ <local name="repo"/>
+ <if><equals arg1="@{local}" arg2="false"/><then>
+ <property name="repo" value="${remote.repository}"/>
+ </then><else>
+ <property name="repo" value="${local.repository}"/>
+ </else></if>
+ <artifact:mvn failonerror="true">
+ <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
+ <arg value="-Durl=${repo}" />
+ <arg value="-DrepositoryId=${repository.credentials.id}" />
+ <arg value="-DpomFile=${path}-pom-filtered.xml" />
+ <arg value= "-Dfile=${path}-pom-filtered.xml" />
+ <arg value="-Pgpg" />
+ <arg value="-Dgpg.useagent=true" />
+ </artifact:mvn>
+ </else></if>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="deploy">
+ <attribute name="local" default="false"/>
+ <attribute name="signed" default="false"/>
+
+ <sequential>
+ <deploy-one name="scala-library" local="@{local}" signed="@{signed}"/>
+ <deploy-one name="scala-reflect" local="@{local}" signed="@{signed}"/>
+ <deploy-one name="scala-compiler" local="@{local}" signed="@{signed}"/>
+
+ <!-- TODO modularize compiler.
+ <deploy-one name="scala-compiler-doc" local="@{local}" signed="@{signed}"/>
+ <deploy-one name="scala-compiler-interactive" local="@{local}" signed="@{signed}"/>
+ -->
+
+ <deploy-one name="scala-actors" local="@{local}" signed="@{signed}"/>
+ <deploy-one name="scalap" local="@{local}" signed="@{signed}"/>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="testSuite">
+ <attribute name="dir" default="${partest.dir}"/>
+ <attribute name="srcdir" default="files"/> <!-- TODO: make targets for `pending` and other subdirs -->
+ <attribute name="colors" default="${partest.colors}"/>
+ <attribute name="scalacOpts" default="${partest.scalac_opts} ${scalac.args.optimise}"/>
+ <attribute name="pcp" default="${toString:partest.compilation.path}"/>
+ <attribute name="kinds"/>
+ <sequential>
+ <property name="partest.dir" value="@{dir}" />
+ <partest srcdir="@{srcdir}"
+ kinds="@{kinds}"
+ colors="@{colors}"
+ scalacOpts="@{scalacOpts}"
+ compilationpath="@{pcp}"/>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="bc.run-mima">
+ <attribute name="jar-name"/>
+ <attribute name="prev"/>
+ <attribute name="curr"/>
+ <attribute name="direction"/>
+ <sequential>
+ <echo message="Checking @{direction} binary compatibility for @{jar-name} (against ${bc-reference-version})"/>
+ <java taskname="mima" fork="true" failonerror="true" classname="com.typesafe.tools.mima.cli.Main">
+ <arg value="--prev"/>
+ <arg value="@{prev}"/>
+ <arg value="--curr"/>
+ <arg value="@{curr}"/>
+ <arg value="--filters"/>
+ <arg value="${basedir}/bincompat-@{direction}.whitelist.conf"/>
+ <arg value="--generate-filters"/>
+ <classpath>
+ <path refid="mima.classpath"/>
+ </classpath>
+ </java>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="bc.check">
+ <attribute name="project"/>
+ <sequential>
+ <bc.run-mima jar-name="scala-@{project}" prev="${org.scala-lang:scala-@{project}:jar}" curr="${@{project}.jar}" direction="backward"/>
+ <bc.run-mima jar-name="scala-@{project}" prev="${@{project}.jar}" curr="${org.scala-lang:scala-@{project}:jar}" direction="forward"/>
+ </sequential>
+ </macrodef>
+
+ <macrodef name="tarz">
+ <attribute name="name" description="The tar file name (without extension)."/>
+ <element name="file-sets" description="A sequence of fileset elements to be included in the tar balls." optional="false" implicit="true"/>
+ <sequential>
+ <tar destfile="@{name}.tar" compression="none" longfile="gnu">
+ <file-sets/>
+ </tar>
+ <gzip src="@{name}.tar" destfile="@{name}.tgz"/>
+ <if>
+ <not>
+ <equals arg1="${archives.skipxz}" arg2="true"/>
+ </not>
+ <then>
+ <exec executable="xz" failifexecutionfails="false">
+ <arg line="-k -9e -S .xz @{name}.tar"/>
+ </exec>
+ <move file="@{name}.tar.xz" tofile="@{name}.txz" failonerror="false"/>
+ </then>
+ </if>
+ <delete file="@{name}.tar"/>
+ </sequential>
+ </macrodef>
+</project>