|
6 | 6 | SuperSabbus extension for deploying a distribution to Maven. THIS FILE IS MEANT TO BE RUN STANDALONE IN THE MAVEN "distpack" DIRECTORY |
7 | 7 | </description> |
8 | 8 |
|
9 | | - <target name="boot"> |
| 9 | + <macrodef name="deploy-remote"> |
| 10 | + <attribute name="jar" default=""/> |
| 11 | + <attribute name="pom"/> |
| 12 | + <element name="artifacts" implicit="true" optional="true"/> |
| 13 | + <sequential> |
| 14 | + <artifact:deploy file="@{jar}" settingsFile="${settings.file}"> |
| 15 | + <artifact:remoteRepository url="${remote.repository}" id="${repository.credentials.id}" /> |
| 16 | + <artifact:pom refid="@{pom}" /> |
| 17 | + <artifacts/> |
| 18 | + </artifact:deploy> |
| 19 | + </sequential> |
| 20 | + </macrodef> |
| 21 | + |
| 22 | + <macrodef name="deploy-local"> |
| 23 | + <attribute name="jar" default=""/> |
| 24 | + <attribute name="pom"/> |
| 25 | + <element name="artifacts" implicit="true" optional="true"/> |
| 26 | + <sequential> |
| 27 | + <artifact:install file="@{jar}"> |
| 28 | + <artifact:localRepository path="${local.repository}" id="${repository.credentials.id}" /> |
| 29 | + <artifact:pom refid="@{pom}" /> |
| 30 | + <artifacts/> |
| 31 | + </artifact:install> |
| 32 | + </sequential> |
| 33 | + </macrodef> |
| 34 | + |
| 35 | + <macrodef name="deploy-to"> |
| 36 | + <attribute name="jar" default=""/> |
| 37 | + <attribute name="pom"/> |
| 38 | + <attribute name="local"/> |
| 39 | + <element name="artifacts" implicit="true" optional="true"/> |
| 40 | + <sequential> |
| 41 | + <if><equals arg1="@{local}" arg2="true"/><then> |
| 42 | + <deploy-local jar="@{jar}" pom="@{pom}"> <artifacts/> </deploy-local> |
| 43 | + </then><else> |
| 44 | + <deploy-remote jar="@{jar}" pom="@{pom}"> <artifacts/> </deploy-remote> |
| 45 | + </else></if> |
| 46 | + </sequential> |
| 47 | + </macrodef> |
| 48 | + |
| 49 | + <macrodef name="deploy-one"> |
| 50 | + <attribute name="dir" default=""/> |
| 51 | + <attribute name="name" /> |
| 52 | + <attribute name="local" default="false"/> |
| 53 | + <attribute name="signed" default="false"/> |
| 54 | + |
| 55 | + <sequential> |
| 56 | + <local name="path"/> <property name="path" value="@{dir}@{name}/@{name}"/> |
| 57 | + |
| 58 | + <echo>Deploying ${path}-[pom.xml|src.jar|docs.jar].</echo> |
| 59 | + |
| 60 | + <copy file="${path}-pom.xml" tofile="${path}-pom-filtered.xml" overwrite="true"> |
| 61 | + <filterset> |
| 62 | + <filter token="VERSION" value="${maven.version.number}" /> |
| 63 | + <filter token="SCALA_BINARY_VERSION" value="${scala.binary.version}" /> |
| 64 | + <filter token="XML_VERSION" value="${scala-xml.version.number}" /> |
| 65 | + <filter token="PARSER_COMBINATORS_VERSION" value="${scala-parser-combinators.version.number}" /> |
| 66 | + <filter token="RELEASE_REPOSITORY" value="${remote.release.repository}" /> |
| 67 | + <filter token="SNAPSHOT_REPOSITORY" value="${remote.snapshot.repository}" /> |
| 68 | + <filter token="JLINE_VERSION" value="${jline.version}" /> |
| 69 | + </filterset> |
| 70 | + </copy> |
| 71 | + <artifact:pom id="@{name}.pom" file="${path}-pom-filtered.xml" /> |
| 72 | + |
| 73 | + <if><equals arg1="@{signed}" arg2="false"/><then> |
| 74 | + <if><isset property="docs.skip"/><then> |
| 75 | + <deploy-to local="@{local}" jar="${path}.jar" pom="@{name}.pom"> |
| 76 | + <artifact:attach type="jar" file="${path}-src.jar" classifier="sources" /> |
| 77 | + </deploy-to> |
| 78 | + </then><else> |
| 79 | + <deploy-to local="@{local}" jar="${path}.jar" pom="@{name}.pom"> |
| 80 | + <artifact:attach type="jar" file="${path}-src.jar" classifier="sources" /> |
| 81 | + <artifact:attach type="jar" file="${path}-docs.jar" classifier="javadoc" /> |
| 82 | + </deploy-to> |
| 83 | + </else></if> |
| 84 | + </then><else> |
| 85 | + <local name="repo"/> |
| 86 | + <if><equals arg1="@{local}" arg2="false"/><then> |
| 87 | + <property name="repo" value="${remote.repository}"/> |
| 88 | + </then><else> |
| 89 | + <property name="repo" value="${local.repository}"/> |
| 90 | + </else></if> |
| 91 | + <artifact:mvn failonerror="true"> |
| 92 | + <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" /> |
| 93 | + <arg value="-Durl=${repo}" /> |
| 94 | + <arg value="-DrepositoryId=${repository.credentials.id}" /> |
| 95 | + <arg value="-DpomFile=${path}-pom-filtered.xml" /> |
| 96 | + <arg value= "-Dfile=${path}.jar" /> |
| 97 | + <arg value="-Dsources=${path}-src.jar" /> |
| 98 | + <arg value="-Djavadoc=${path}-docs.jar" /> |
| 99 | + <arg value="-Pgpg" /> |
| 100 | + <arg value="-Dgpg.useagent=true" /> |
| 101 | + </artifact:mvn> |
| 102 | + </else></if> |
| 103 | + </sequential> |
| 104 | + </macrodef> |
| 105 | + |
| 106 | + <macrodef name="deploy"> |
| 107 | + <attribute name="dir" default=""/> |
| 108 | + <attribute name="local" default="false"/> |
| 109 | + <attribute name="signed" default="false"/> |
| 110 | + |
| 111 | + <sequential> |
| 112 | + <deploy-one dir="@{dir}" name="scala-library" local="@{local}" signed="@{signed}"/> |
| 113 | + <deploy-one dir="@{dir}" name="scala-reflect" local="@{local}" signed="@{signed}"/> |
| 114 | + <deploy-one dir="@{dir}" name="scala-compiler" local="@{local}" signed="@{signed}"/> |
| 115 | + <deploy-one dir="@{dir}" name="scala-actors" local="@{local}" signed="@{signed}"/> |
| 116 | + <deploy-one dir="@{dir}" name="scala-swing" local="@{local}" signed="@{signed}"/> |
| 117 | + <deploy-one dir="@{dir}" name="scalap" local="@{local}" signed="@{signed}"/> |
| 118 | + <deploy-one dir="@{dir}plugins/" name="continuations" local="@{local}" signed="@{signed}"/> |
| 119 | + </sequential> |
| 120 | + </macrodef> |
| 121 | + |
| 122 | + <target name="boot.maven"> |
10 | 123 | <!-- Pull in properties from build --> |
11 | 124 | <property file="build.properties" /> |
| 125 | + <!-- Set up Ant contrib tasks so we can use <if><then><else> instead of the clunky `unless` attribute --> |
| 126 | + <taskdef resource="net/sf/antcontrib/antlib.xml" classpath="ant-contrib.jar"/> |
| 127 | + |
| 128 | + <!-- Add our maven ant tasks --> |
| 129 | + <path id="maven-ant-tasks.classpath" path="maven-ant-tasks-2.1.1.jar" /> |
| 130 | + <typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" classpathref="maven-ant-tasks.classpath" /> |
| 131 | + </target> |
12 | 132 |
|
| 133 | + <target name="init.maven" depends="boot.maven"> |
13 | 134 | <property name="remote.snapshot.repository" value="https://oss.sonatype.org/content/repositories/snapshots" /> |
14 | 135 | <property name="remote.release.repository" value="https://oss.sonatype.org/service/local/staging/deploy/maven2" /> |
15 | 136 |
|
|
19 | 140 | <property name="repository.credentials.id" value="sonatype-nexus" /> |
20 | 141 | <property name="settings.file" value="${user.home}/.m2/settings.xml" /> |
21 | 142 |
|
22 | | - <!-- Set up Ant contrib tasks so we can use <if><then><else> instead of the clunky `unless` attribute --> |
23 | | - <taskdef resource="net/sf/antcontrib/antlib.xml" classpath="ant-contrib.jar"/> |
24 | | - |
25 | | - <!-- Add our maven ant tasks --> |
26 | | - <path id="maven-ant-tasks.classpath" path="maven-ant-tasks-2.1.1.jar" /> |
27 | | - <typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" classpathref="maven-ant-tasks.classpath" /> |
28 | | - </target> |
29 | | - |
30 | | - <target name="init" depends="boot"> |
31 | 143 | <if><contains string="${maven.version.number}" substring="-SNAPSHOT"/><then> |
32 | 144 | <property name="remote.repository" value="${remote.snapshot.repository}"/> |
33 | 145 | <property name="local.repository" value="${local.snapshot.repository}"/> |
|
39 | 151 | <echo>Using server[${repository.credentials.id}] for maven repository credentials. |
40 | 152 | Please make sure that your ~/.m2/settings.xml has the needed username/password for this server id |
41 | 153 | </echo> |
42 | | - |
43 | | - <macrodef name="deploy-one"> |
44 | | - <attribute name="dir" default=""/> |
45 | | - <attribute name="name" /> |
46 | | - <attribute name="version" /> |
47 | | - <attribute name="local" /> |
48 | | - <attribute name="signed" /> |
49 | | - |
50 | | - <sequential> |
51 | | - <local name="path"/> <property name="path" value="@{dir}@{name}/@{name}"/> |
52 | | - |
53 | | - <echo>Deploying ${path}-[pom.xml|src.jar|docs.jar].</echo> |
54 | | - |
55 | | - <copy file="${path}-pom.xml" tofile="${path}-pom-filtered.xml" overwrite="true"> |
56 | | - <filterset> |
57 | | - <filter token="VERSION" value="@{version}" /> |
58 | | - <filter token="SCALA_BINARY_VERSION" value="${scala.binary.version}" /> |
59 | | - <filter token="XML_VERSION" value="${scala-xml.version.number}" /> |
60 | | - <filter token="PARSER_COMBINATORS_VERSION" value="${scala-parser-combinators.version.number}" /> |
61 | | - <filter token="RELEASE_REPOSITORY" value="${remote.release.repository}" /> |
62 | | - <filter token="SNAPSHOT_REPOSITORY" value="${remote.snapshot.repository}" /> |
63 | | - <filter token="JLINE_VERSION" value="${jline.version}" /> |
64 | | - </filterset> |
65 | | - </copy> |
66 | | - <artifact:pom id="@{name}.pom" file="${path}-pom-filtered.xml" /> |
67 | | - |
68 | | - <if><equals arg1="@{signed}" arg2="false"/><then> |
69 | | - <if><equals arg1="@{local}" arg2="false"/><then> |
70 | | - <artifact:deploy file="${path}.jar" settingsFile="${settings.file}"> |
71 | | - <artifact:remoteRepository url="${remote.repository}" id="${repository.credentials.id}" /> |
72 | | - <artifact:pom refid="@{name}.pom" /> |
73 | | - <artifact:attach type="jar" file="${path}-src.jar" classifier="sources" /> |
74 | | - <artifact:attach type="jar" file="${path}-docs.jar" classifier="javadoc" /> |
75 | | - </artifact:deploy> |
76 | | - </then><else> |
77 | | - <artifact:install file="${path}.jar"> |
78 | | - <artifact:localRepository path="${local.repository}" id="${repository.credentials.id}" /> |
79 | | - <artifact:pom refid="@{name}.pom" /> |
80 | | - <artifact:attach type="jar" file="${path}-src.jar" classifier="sources" /> |
81 | | - <artifact:attach type="jar" file="${path}-docs.jar" classifier="javadoc" /> |
82 | | - </artifact:install> |
83 | | - </else></if> |
84 | | - </then><else> |
85 | | - <local name="repo"/> |
86 | | - <if><equals arg1="@{local}" arg2="false"/><then> |
87 | | - <property name="repo" value="${remote.repository}"/> |
88 | | - </then><else> |
89 | | - <property name="repo" value="${local.repository}"/> |
90 | | - </else></if> |
91 | | - <artifact:mvn> |
92 | | - <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" /> |
93 | | - <arg value="-Durl=${repo}" /> |
94 | | - <arg value="-DrepositoryId=${repository.credentials.id}" /> |
95 | | - <arg value="-DpomFile=${path}-pom-filtered.xml" /> |
96 | | - <arg value= "-Dfile=${path}.jar" /> |
97 | | - <arg value="-Dsources=${path}-src.jar" /> |
98 | | - <arg value="-Djavadoc=${path}-docs.jar" /> |
99 | | - <arg value="-Pgpg" /> |
100 | | - <arg value="-Dgpg.useagent=true" /> |
101 | | - </artifact:mvn> |
102 | | - </else></if> |
103 | | - </sequential> |
104 | | - </macrodef> |
105 | | - |
106 | | - <macrodef name="deploy"> |
107 | | - <attribute name="local" default="false"/> |
108 | | - <attribute name="signed" default="false"/> |
109 | | - |
110 | | - <sequential> |
111 | | - <deploy-one name="scala-actors" version="${maven.version.number}" local="@{local}" signed="@{signed}"/> |
112 | | - <deploy-one name="scala-compiler" version="${maven.version.number}" local="@{local}" signed="@{signed}"/> |
113 | | - <deploy-one name="scala-library" version="${maven.version.number}" local="@{local}" signed="@{signed}"/> |
114 | | - <deploy-one name="scala-reflect" version="${maven.version.number}" local="@{local}" signed="@{signed}"/> |
115 | | - <deploy-one name="scala-swing" version="${maven.version.number}" local="@{local}" signed="@{signed}"/> |
116 | | - <deploy-one name="scalap" version="${maven.version.number}" local="@{local}" signed="@{signed}"/> |
117 | | - <deploy-one dir="plugins/" name="continuations" version="${maven.version.number}" local="@{local}" signed="@{signed}"/> |
118 | | - </sequential> |
119 | | - </macrodef> |
120 | 154 | </target> |
121 | 155 |
|
122 | | - <target name="deploy" depends="init" description="Deploys unsigned artifacts to the maven repo."> <deploy/> </target> |
123 | | - <target name="deploy.local" depends="init" description="Deploys unsigned artifacts to the local maven repo."> <deploy local="true"/> </target> |
124 | | - <target name="deploy.signed" depends="init" description="Deploys signed artifacts to the remote maven repo."> <deploy signed="true"/> </target> |
| 156 | + <target name="deploy" depends="init.maven" description="Deploys unsigned artifacts to the maven repo."> <deploy/> </target> |
| 157 | + <target name="deploy.local" depends="init.maven" description="Deploys unsigned artifacts to the local maven repo."> <deploy local="true"/> </target> |
| 158 | + <target name="deploy.signed" depends="init.maven" description="Deploys signed artifacts to the remote maven repo."> <deploy signed="true"/> </target> |
125 | 159 | </project> |
0 commit comments