summaryrefslogtreecommitdiff
path: root/src/build/maven/maven-deploy.xml
blob: 2e490163e0b55744036f4db307df26fd2fe2961e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
<?xml version="1.0" encoding="UTF-8"?>

<project name="sabbus-maven-deploy" xmlns:artifact="urn:maven-artifact-ant">

  <description>
    SuperSabbus extension for deploying a distribution to Maven. THIS FILE IS MEANT TO BE RUN STANDALONE IN THE MAVEN "distpack" DIRECTORY
  </description>
  <target name="init.properties">
    <!-- Pull in properties from build -->
    <property file="build.properties" />
    <!-- Initialize specific properties -->
    <property name="remote.snapshot.repository" value="https://oss.sonatype.org/content/repositories/snapshots" />
    <property name="remote.release.repository" value="https://oss.sonatype.org/service/local/staging/deploy/maven2" />

    <property name="local.snapshot.repository" value="${user.home}/.m2/repository" />
    <property name="local.release.repository" value="${user.home}/.m2/repository" />
    <property name="repository.credentials.id" value="sonatype-nexus" />
    <property name="settings.file" value="${user.home}/.m2/settings.xml" />

    <echo>Using server[${repository.credentials.id}] for maven repository credentials.
       Please make sure that your ~/.m2/settings.xml has the needed username/password for this server id
     </echo>
  </target>

  <target name="init.maven" depends="init.properties">

    <!-- Add our maven ant tasks -->
    <path id="maven-ant-tasks.classpath" path="maven-ant-tasks-2.1.1.jar" />
    <typedef resource="org/apache/maven/artifact/ant/antlib.xml" uri="urn:maven-artifact-ant" classpathref="maven-ant-tasks.classpath" />

    <!-- simplify fixing pom versions -->
    <macrodef name="make-pom">
      <attribute name="name" />
      <attribute name="version" />
      <sequential>
        <copy file="@{name}/@{name}-pom.xml" tofile="@{name}/@{name}-pom-fixed.xml" overwrite="true">
          <filterset>
            <filter token="VERSION" value="@{version}" />
            <filter token="RELEASE_REPOSITORY" value="${remote.release.repository}" />
            <filter token="SNAPSHOT_REPOSITORY" value="${remote.snapshot.repository}" />
          </filterset>
        </copy>
        <artifact:pom id="@{name}.pom" file="@{name}/@{name}-pom-fixed.xml" />
      </sequential>
    </macrodef>

    <macrodef name="make-pom-plugin">
      <attribute name="name" />
      <attribute name="version" />
      <sequential>
        <copy file="plugins/@{name}/@{name}-plugin-pom.xml" tofile="plugins/@{name}/@{name}-pom-fixed.xml" overwrite="true">
          <filterset>
            <filter token="VERSION" value="@{version}" />
            <filter token="RELEASE_REPOSITORY" value="${remote.release.repository}" />
            <filter token="SNAPSHOT_REPOSITORY" value="${remote.snapshot.repository}" />
          </filterset>
        </copy>
        <artifact:pom id="plugin-@{name}.pom" file="plugins/@{name}/@{name}-pom-fixed.xml" />
      </sequential>
    </macrodef>
  </target>
  <!-- macros for local deployment -->
  <target name="deploy.local.init" depends="init.maven">
    <!-- Deploy single artifact locally -->
    <macrodef name="deploy-local">
      <attribute name="name" />
      <attribute name="version" />
      <attribute name="repository" />
      <element name="extra-attachments" optional="yes" />
      <sequential>
        <make-pom name="@{name}" version="@{version}" />
        <artifact:install file="@{name}/@{name}.jar">
          <artifact:pom refid="@{name}.pom" />
          <artifact:localRepository path="@{repository}" id="${repository.credentials.id}" />
          <artifact:attach type="jar" file="@{name}/@{name}-src.jar" classifier="sources" />
          <artifact:attach type="jar" file="@{name}/@{name}-docs.jar" classifier="javadoc" />
          <extra-attachments />
        </artifact:install>
      </sequential>
    </macrodef>

    <!-- Deploy compiler plugins -->
    <macrodef name="deploy-local-plugin">
        <attribute name="name" />
        <attribute name="version" />
        <attribute name="repository" />
        <element name="extra-attachments" optional="yes" />
        <sequential>
          <make-pom-plugin name="@{name}" version="@{version}" />
          <artifact:install file="plugins/@{name}/@{name}.jar">
            <artifact:pom refid="plugin-@{name}.pom" />
            <artifact:attach type="jar" file="plugins/@{name}/@{name}-src.jar" classifier="sources" />
            <artifact:attach type="jar" file="plugins/@{name}/@{name}-docs.jar" classifier="javadoc" />
            <artifact:localRepository path="@{repository}" id="${repository.credentials.id}" />
            <extra-attachments />
          </artifact:install>
        </sequential>
      </macrodef>


    <!-- Deploy all artifacts locally -->
    <macrodef name="deploy-local-all">
      <attribute name="repository" />
      <attribute name="version" />
      <sequential>
        <deploy-local name="scala-library" version="@{version}" repository="@{repository}" />
        <deploy-local name="scala-compiler" version="@{version}" repository="@{repository}" />
        <deploy-local-plugin name="continuations" version="@{version}" repository="@{repository}"/>
        <deploy-local name="scala-dbc" version="@{version}" repository="@{repository}" />
        <deploy-local name="scala-swing" version="@{version}" repository="@{repository}"/>
      	<deploy-local name="scalap" version="@{version}" repository="@{repository}"/>
      	<deploy-local name="scala-partest" version="@{version}" repository="@{repository}"/>
      	<deploy-local name="jline" version="@{version}" repository="@{repository}"/>
      </sequential>
    </macrodef>
  </target>

  <!-- macros for remote deployment -->
  <target name="deploy.remote.init" depends="init.maven">
    <!-- Deploy single artifact locally -->
    <macrodef name="deploy-remote">
      <attribute name="name" />
      <attribute name="repository" />
      <attribute name="version" />
      <element name="extra-attachments" optional="yes" />
      <sequential>
        <make-pom name="@{name}" version="@{version}" />
        <artifact:deploy file="@{name}/@{name}.jar" settingsFile="${settings.file}">
          <artifact:pom refid="@{name}.pom" />
          <artifact:remoteRepository url="@{repository}" id="${repository.credentials.id}" />
          <artifact:attach type="jar" file="@{name}/@{name}-src.jar" classifier="sources" />
          <artifact:attach type="jar" file="@{name}/@{name}-docs.jar" classifier="javadoc" />
          <extra-attachments />
        </artifact:deploy>
      </sequential>
    </macrodef>

    <!-- Deploy compiler plugins -->
    <macrodef name="deploy-remote-plugin">
        <attribute name="name" />
        <attribute name="version" />
        <attribute name="repository" />
        <element name="extra-attachments" optional="yes" />
        <sequential>
          <make-pom-plugin name="@{name}" version="@{version}" />
          <artifact:deploy file="plugins/@{name}/@{name}.jar" settingsFile="${settings.file}">
            <artifact:pom refid="plugin-@{name}.pom" />
            <artifact:attach type="jar" file="plugins/@{name}/@{name}-src.jar" classifier="sources" />
            <artifact:attach type="jar" file="plugins/@{name}/@{name}-docs.jar" classifier="javadoc" />
            <artifact:remoteRepository url="@{repository}" id="${repository.credentials.id}" />
            <extra-attachments />
          </artifact:deploy>
        </sequential>
      </macrodef>

    <!-- Deploy all artifacts locally -->
    <macrodef name="deploy-remote-all">
      <attribute name="repository" />
      <attribute name="version" />
      <sequential>
        <deploy-remote name="scala-library" version="@{version}" repository="@{repository}">
          <extra-attachments>
            <artifact:attach type="jar" file="scala-library/scala-library-docs.jar" classifier="javadoc" />
          </extra-attachments>
        </deploy-remote>
      	<deploy-remote name="jline" version="@{version}" repository="@{repository}"/>
        <deploy-remote name="scala-compiler" version="@{version}" repository="@{repository}" />
        <deploy-remote name="scala-dbc" version="@{version}" repository="@{repository}" />
        <deploy-remote name="scala-swing" version="@{version}" repository="@{repository}"/>
      	<deploy-remote name="scalap" version="@{version}" repository="@{repository}"/>
      	<deploy-remote name="scala-partest" version="@{version}" repository="@{repository}"/>
        <deploy-remote-plugin name="continuations" version="@{version}" repository="@{repository}"/> 
      </sequential>
    </macrodef>

    <!-- PGP Signed deployment -->
    <macrodef name="deploy-remote-signed-single">
      <attribute name="pom" />
      <attribute name="repository" />
      <attribute name="jar" />
      <attribute name="srcjar" />
      <attribute name="docjar" />
      <sequential>
        <artifact:mvn>
          <arg value="org.apache.maven.plugins:maven-gpg-plugin:1.3:sign-and-deploy-file" />
          <arg value="-Durl=@{repository}" />
          <arg value="-DrepositoryId=${repository.credentials.id}" />
          <arg value="-DpomFile=@{pom}" />
          <arg value="-Dfile=@{jar}" />
          <arg value="-Dsources=@{srcjar}" />
          <arg value="-Djavadoc=@{docjar}" />
          <arg value="-Pgpg" />
          <arg value="-Dgpg.useagent=true" />
        </artifact:mvn>
      </sequential>
    </macrodef>
    <macrodef name="deploy-remote-signed">
      <attribute name="name" />
      <attribute name="repository" />
      <attribute name="version" />
      <element name="extra-attachments" optional="yes" />
      <sequential>
        <make-pom name="@{name}" version="@{version}" />
        <deploy-remote-signed-single
           pom="@{name}/@{name}-pom-fixed.xml"
           repository="@{repository}"
           jar="@{name}/@{name}.jar"
           srcjar="@{name}/@{name}-src.jar"
           docjar="@{name}/@{name}-docs.jar" />
      </sequential>
    </macrodef>
    <macrodef name="deploy-remote-plugin-signed">
      <attribute name="name" />
      <attribute name="repository" />
      <attribute name="version" />
      <element name="extra-attachments" optional="yes" />
      <sequential>
        <make-pom-plugin name="@{name}" version="@{version}" />
        <deploy-remote-signed-single
           pom="plugins/@{name}/@{name}-pom-fixed.xml"
           repository="@{repository}"
           jar="plugins/@{name}/@{name}.jar"
           srcjar="plugins/@{name}/@{name}-src.jar"
           docjar="plugins/@{name}/@{name}-docs.jar" />
      </sequential>
    </macrodef>
    <macrodef name="deploy-remote-signed-all">
      <attribute name="repository" />
      <attribute name="version" />
      <sequential>
        <deploy-remote-plugin-signed name="continuations" version="@{version}" repository="@{repository}"/> 
      	<deploy-remote-signed name="scala-library" version="@{version}" repository="@{repository}"/>
      	<deploy-remote-signed name="jline" version="@{version}" repository="@{repository}"/>
        <deploy-remote-signed name="scala-compiler" version="@{version}" repository="@{repository}" />
        <deploy-remote-signed name="scala-dbc" version="@{version}" repository="@{repository}" />
        <deploy-remote-signed name="scala-swing" version="@{version}" repository="@{repository}"/>
      	<deploy-remote-signed name="scalap" version="@{version}" repository="@{repository}"/>
      	<deploy-remote-signed name="scala-partest" version="@{version}" repository="@{repository}"/>
      </sequential>
    </macrodef>
  </target>

  <!-- Local Targets -->
  <target name="deploy.snapshot.local" depends="deploy.local.init" description="Deploys the bundled snapshot of the Scala Lanaguage to a local maven repository">
    <deploy-local-all version="${maven.snapshot.version.number}" repository="${local.snapshot.repository}" />
  </target>

  <target name="deploy.release.local" depends="deploy.local.init" description="Deploys the bundled files as a release into the local Maven repository">
    <deploy-local-all version="${version.number}" repository="${local.release.repository}" />
  </target>

  <!-- Remote Targets -->
  <target name="deploy.signed.snapshot" depends="deploy.remote.init" description="Deploys the bundled files as a snapshot into the desired remote Maven repository">
      <deploy-remote-signed-all version="${maven.snapshot.version.number}" repository="${remote.snapshot.repository}" />
  </target>

  <target name="deploy.signed.release" depends="deploy.remote.init" description="Deploys the bundled files as a release into the desired remote Maven repository">
    <deploy-remote-signed-all version="${version.number}" repository="${remote.release.repository}" />
  </target>

  <target name="deploy.snapshot" depends="deploy.remote.init" description="Deploys the bundled files as a snapshot into the desired remote Maven repository">
      <deploy-remote-all version="${maven.snapshot.version.number}" repository="${remote.snapshot.repository}" />
  </target>

  <target name="deploy.release" depends="deploy.remote.init" description="Deploys the bundled files as a release into the desired remote Maven repository">
    <deploy-remote-all version="${version.number}" repository="${remote.release.repository}" />
  </target>
</project>