diff options
author | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-12-15 17:36:05 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-12-19 10:45:09 -0800 |
commit | 0dde1ae27f0ecb916db4b2abf05ec4b0dd681678 (patch) | |
tree | bafa982cd094b6ebaff2a2d05300aa34417ce0b2 | |
parent | 94ca91dd5f404015bdfa94e373ed94c284761a1d (diff) | |
download | scala-0dde1ae27f0ecb916db4b2abf05ec4b0dd681678.tar.gz scala-0dde1ae27f0ecb916db4b2abf05ec4b0dd681678.tar.bz2 scala-0dde1ae27f0ecb916db4b2abf05ec4b0dd681678.zip |
scala-dist: all you need to roll your own scala distribution
We now publish a scala-dist artifact every time we publish to maven.
It captures everything needed to build a Scala distribution.
The packager should resolve all transitive dependencies of scala-dist,
put the class-file jars in the lib/ directory,
the scaladoc jars in the api/ directory,
and the source jars in the src/ directory,
in addition to unpacking the scala-dist jar itself,
which contains the bin/, doc/ and man/ directories,
which previously weren't available on maven.
This also removes the `@{dir}` abstraction, which was used to
package the continuations plugin. Since it's moved out,
we can go back to hard-coding it.
-rwxr-xr-x | build.xml | 50 | ||||
-rw-r--r-- | src/build/maven/maven-deploy.xml | 56 | ||||
-rw-r--r-- | src/build/maven/scala-dist-pom.xml | 84 |
3 files changed, 166 insertions, 24 deletions
@@ -147,6 +147,7 @@ TODO: <property name="build-locker.dir" value="${build.dir}/locker"/> <property name="build-quick.dir" value="${build.dir}/quick"/> <property name="build-pack.dir" value="${build.dir}/pack"/> + <property name="build-manual.dir" value="${build.dir}/manual"/> <property name="build-osgi.dir" value="${build.dir}/osgi"/> <property name="build-junit.dir" value="${build.dir}/junit"/> <property name="build-strap.dir" value="${build.dir}/strap"/> @@ -1570,7 +1571,7 @@ TODO: </target> <!-- doc/ and man/ --> - <target name="dist.doc" depends="scaladoc.task"> <!-- depends on scaladoc.task for scalac taskdef --> + <target name="dist.doc" depends="scaladoc.task" unless="docs.skip"> <!-- depends on scaladoc.task for scalac taskdef --> <mkdir dir="${dist.dir}/doc"/> <copy toDir="${dist.dir}/doc" overwrite="true"> <fileset dir="${doc.dir}"/> @@ -1578,7 +1579,7 @@ TODO: <mkdir dir="${dist.dir}/doc/tools"/> <mkdir dir="${dist.dir}/man/man1"/> - <staged-uptodate stage="pack" project="manual"> + <staged-uptodate stage="manual" project="manual"> <check><srcfiles dir="${src.dir}/manual"/></check> <do> <mkdir dir="${build.dir}/manmaker/classes"/> @@ -1646,7 +1647,7 @@ TODO: </target> <!-- api/ (scaladoc) --> - <target name="dist.api" depends="docs.done"> + <target name="dist.api" depends="docs.done" unless="docs.skip"> <mkdir dir="${dist.dir}/api"/> <copy toDir="${dist.dir}/api" overwrite="true"> <fileset dir="${build-docs.dir}/library"/> @@ -1749,7 +1750,16 @@ MAIN DISTRIBUTION PACKAGING </then></if> </target> - <target name="pack-maven.base" depends="pack-maven.core, osgi.done, docs.done"> + <target name="pack-maven.dist" depends="dist.bin, dist.doc"> + <copy tofile="${dist.maven}/scala-dist/scala-dist-pom.xml" file="${src.dir}/build/maven/scala-dist-pom.xml" overwrite="true"/> + <jar whenmanifestonly="fail" destfile="${dist.maven}/scala-dist/scala-dist.jar" basedir="${dist.dir}"> + <include name="bin/" /> + <include name="doc/" /> + <include name="man/" /> + </jar> + </target> + + <target name="pack-maven.base" depends="pack-maven.core, osgi.done, docs.done, pack-maven.dist"> <!-- TODO modularize compiler <mvn-package project="interactive"/> <mvn-package project="scaladoc"/> @@ -1767,6 +1777,7 @@ MAIN DISTRIBUTION PACKAGING </then></if> </target> + <!-- TODO: remove this target and delete src/build/maven-deploy.xml --> <target name="pack-maven.done" depends="pack-maven.base"> <!-- Create dists/maven/latest alias and copy maven-deploy ant build there. --> <if><isset property="os.win"/><then> @@ -1778,7 +1789,6 @@ MAIN DISTRIBUTION PACKAGING resource="${version.number}" overwrite="true"/> </else></if> - <!-- TODO: remove the remainder of this target and delete src/build/maven-deploy.xml --> <!-- copy build file and its dependencies --> <copy todir="${dist.maven}" file="${lib-ant.dir}/ant-contrib.jar" overwrite="true"/> @@ -1814,19 +1824,31 @@ MAIN DISTRIBUTION PACKAGING <!-- =========================================================================== MAVEN PUBLISHING ============================================================================ --> - <target name="publish" depends="pack-maven.base, init.maven" description="Publishes unsigned artifacts to the maven repo."> <deploy dir="${dist.maven}/"/> </target> - <target name="publish.local" depends="pack-maven.base, init.maven" description="Publishes unsigned artifacts to the local maven repo."> <deploy dir="${dist.maven}/" local="true"/> </target> - <target name="publish.signed" depends="pack-maven.base, init.maven" description="Publishes signed artifacts to the remote maven repo."> <deploy dir="${dist.maven}/" signed="true"/> </target> + <target name="publish" depends="pack-maven.base, init.maven" description="Publishes unsigned artifacts to the maven repo."> + <deploy /> + <deploy-jar name="scala-dist"/> + </target> + + <target name="publish.local" depends="pack-maven.base, init.maven" description="Publishes unsigned artifacts to the local maven repo."> + <deploy local="true"/> + <deploy-jar name="scala-dist" local="true"/> + </target> + + <target name="publish.signed" depends="pack-maven.base, init.maven" description="Publishes signed artifacts to the remote maven repo."> + <deploy signed="true"/> + <deploy-jar name="scala-dist" signed="true"/> + </target> <target name="publish-core" depends="pack-maven.core, init.maven"> - <deploy-one dir="${dist.maven}/" name="scala-compiler" /> - <deploy-one dir="${dist.maven}/" name="scala-library" /> - <deploy-one dir="${dist.maven}/" name="scala-reflect" /> + <deploy-one name="scala-compiler" /> + <deploy-one name="scala-library" /> + <deploy-one name="scala-reflect" /> </target> + <target name="publish-core-local" depends="pack-maven.core, init.maven"> - <deploy-one dir="${dist.maven}/" name="scala-compiler" local="true"/> - <deploy-one dir="${dist.maven}/" name="scala-library" local="true"/> - <deploy-one dir="${dist.maven}/" name="scala-reflect" local="true"/> + <deploy-one name="scala-compiler" local="true"/> + <deploy-one name="scala-library" local="true"/> + <deploy-one name="scala-reflect" local="true"/> </target> <target name="publish-core-opt" description="Builds an untested optimised core (library/reflect/compiler) and publishes to maven."> diff --git a/src/build/maven/maven-deploy.xml b/src/build/maven/maven-deploy.xml index 174993f94a..d2877f95c5 100644 --- a/src/build/maven/maven-deploy.xml +++ b/src/build/maven/maven-deploy.xml @@ -10,6 +10,7 @@ see publish.* targets in /build.xml SuperSabbus extension for deploying a distribution to Maven. THIS FILE IS MEANT TO BE RUN STANDALONE IN THE MAVEN "distpack" DIRECTORY </description> + <macrodef name="deploy-remote"> <attribute name="jar" default=""/> <attribute name="pom"/> @@ -61,6 +62,9 @@ see publish.* targets in /build.xml <filter token="SCALA_BINARY_VERSION" value="${scala.binary.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}" /> @@ -76,13 +80,12 @@ see publish.* targets in /build.xml </macrodef> <macrodef name="deploy-one"> - <attribute name="dir" default=""/> <attribute name="name" /> <attribute name="local" default="false"/> <attribute name="signed" default="false"/> <sequential> - <local name="path"/> <property name="path" value="@{dir}@{name}/@{name}"/> + <local name="path"/> <property name="path" value="${dist.maven}/@{name}/@{name}"/> <echo>Deploying ${path}-[pom.xml|src.jar|docs.jar].</echo> @@ -121,23 +124,56 @@ see publish.* targets in /build.xml </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"> - <attribute name="dir" default=""/> <attribute name="local" default="false"/> <attribute name="signed" default="false"/> <sequential> - <deploy-one dir="@{dir}" name="scala-library" local="@{local}" signed="@{signed}"/> - <deploy-one dir="@{dir}" name="scala-reflect" local="@{local}" signed="@{signed}"/> - <deploy-one dir="@{dir}" name="scala-compiler" local="@{local}" signed="@{signed}"/> + <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 dir="@{dir}" name="scala-compiler-doc" local="@{local}" signed="@{signed}"/> - <deploy-one dir="@{dir}" name="scala-compiler-interactive" local="@{local}" signed="@{signed}"/> + <deploy-one name="scala-compiler-doc" local="@{local}" signed="@{signed}"/> + <deploy-one name="scala-compiler-interactive" local="@{local}" signed="@{signed}"/> --> - <deploy-one dir="@{dir}" name="scala-actors" local="@{local}" signed="@{signed}"/> - <deploy-one dir="@{dir}" name="scalap" local="@{local}" signed="@{signed}"/> + <deploy-one name="scala-actors" local="@{local}" signed="@{signed}"/> + <deploy-one name="scalap" local="@{local}" signed="@{signed}"/> </sequential> </macrodef> diff --git a/src/build/maven/scala-dist-pom.xml b/src/build/maven/scala-dist-pom.xml new file mode 100644 index 0000000000..946bec62b5 --- /dev/null +++ b/src/build/maven/scala-dist-pom.xml @@ -0,0 +1,84 @@ +<?xml version="1.0"?> +<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.scala-lang</groupId> + <artifactId>scala-dist</artifactId> + <packaging>jar</packaging> + <version>@VERSION@</version> + <name>Scala Distribution Artifacts</name> + <description>The Artifacts Distributed with Scala</description> + <url>http://www.scala-lang.org/</url> + <inceptionYear>2002</inceptionYear> + <organization> + <name>LAMP/EPFL</name> + <url>http://lamp.epfl.ch/</url> + </organization> + <licenses> + <license> + <name>BSD 3-Clause</name> + <url>http://www.scala-lang.org/license.html</url> + <distribution>repo</distribution> + </license> + </licenses> + <scm> + <connection>scm:git:git://github.com/scala/scala.git</connection> + <url>https://github.com/scala/scala.git</url> + </scm> + <issueManagement> + <system>JIRA</system> + <url>https://issues.scala-lang.org/</url> + </issueManagement> + <dependencies> + <dependency> + <groupId>org.scala-lang</groupId> + <artifactId>scala-compiler</artifactId> + <version>@VERSION@</version> + </dependency> + <dependency> + <groupId>org.scala-lang.modules</groupId> + <artifactId>scala-xml_@SCALA_BINARY_VERSION@</artifactId> + <version>@XML_VERSION@</version> + </dependency> + <dependency> + <groupId>org.scala-lang.modules</groupId> + <artifactId>scala-parser-combinators_@SCALA_BINARY_VERSION@</artifactId> + <version>@PARSER_COMBINATORS_VERSION@</version> + </dependency> + <dependency> + <groupId>org.scala-lang.modules</groupId> + <artifactId>scala-continuations-plugin_@SCALA_BINARY_VERSION@</artifactId> + <version>@CONTINUATIONS_PLUGIN_VERSION@</version> + </dependency> + <dependency> + <groupId>org.scala-lang.modules</groupId> + <artifactId>scala-continuations-library_@SCALA_BINARY_VERSION@</artifactId> + <version>@CONTINUATIONS_LIBRARY_VERSION@</version> + </dependency> + <dependency> + <groupId>org.scala-lang.modules</groupId> + <artifactId>scala-swing_@SCALA_BINARY_VERSION@</artifactId> + <version>@SCALA_SWING_VERSION@</version> + </dependency> + </dependencies> + <distributionManagement> + <repository> + <id>scala-tools.org</id> + <url>@RELEASE_REPOSITORY@</url> + </repository> + <snapshotRepository> + <id>scala-tools.org</id> + <url>@SNAPSHOT_REPOSITORY@</url> + <uniqueVersion>false</uniqueVersion> + </snapshotRepository> + </distributionManagement> + <developers> + <developer> + <id>lamp</id> + <name>EPFL LAMP</name> + </developer> + <developer> + <id>Typesafe</id> + <name>Typesafe, Inc.</name> + </developer> + </developers> +</project> |