Projet

Général

Profil

MAY Plugin Release Process » Historique » Version 10

Anonyme, 24/10/2014 10:44

1 1 Anonyme
h1. MAY Plugin Release Process
2 2 Anonyme
3
{{>toc}}
4
5
MAY is an Eclipse plugin, it is thus distributed using an Eclipse update site, but parts of it are also available through Maven Central for [[MAY Maven Standalone Setup|standalone use without Eclipse]].
6
7
h2. General Overview
8
9
h3. Phases
10
11
Releasing MAY implies different phases:
12
# Preparing for the release
13
# Tagging the release on Mercurial
14
# Deploying the release on Maven Central
15
# Deploying the release in the update site
16
# Preparing the next development cycle
17
18 6 Anonyme
All of this is of course fairly automatised using Maven and Tycho for integrating the Eclipse aspects with Maven.
19 2 Anonyme
20
h3. Modules
21
22 5 Anonyme
MAY is decomposed in 5 different software modules (which are 5 Maven projects and some of them Eclipse artefacts):
23 3 Anonyme
* *fr.irit.smac.may.speadl.parent*: it contains general Maven instructions shared by the other modules.
24
* *fr.irit.smac.may.speadl*: it contains the code for the Eclipse plugin, without the UI aspects, and it is also the Maven artefact needed for [[MAY Maven Standalone Setup|standalone use without Eclipse]].
25
* *fr.irit.smac.may.speadl.ui*: it contains the UI code for the Eclipse plugin.
26
* *fr.irit.smac.may.speadl.feature*: it is an installable unit from the update site that combines the two previous Eclipse plugins.
27
* *fr.irit.smac.may.speadl.updatesite*: it contains everything needed for generating and deploying the update site containing the previous feature.
28 2 Anonyme
29
Only the first two are deployed to Maven Central.
30
The plugins and the features will end up in the update site.
31
32
h3. Syntactical Version Numbering
33
34
The Eclipse plugins follow the OSGI version numbering and it is stored in the *MANIFEST.MF* file of each project.
35
The Maven artefact follows the Maven version numbering and it is stored in the *pom.xml* file of each project.
36
All are using the 3 digits "SemVer":http://semver.org/ system (Major.Minor.Patch).
37
38
For the plugins, this is followed by a qualifier (Major.Minor.Patch.qualifier) that is replaced with the compilation time and date.
39
For the Maven artefacts, for non-release (development versions), this is followed  by the SNAPSHOT element (Major.Minor.Patch-SNAPSHOT) that is replaced with the compilation time and date.
40
41
So the plugins always have the qualifier while the Maven artefacts have the SNAPSHOT information only for development.
42
43
h3. Semantic Version Numbering
44
45
The MAJOR number changes when the syntax is incompatible with the previous one.
46
The MINOR number changes when the generated code is incompatible with the previous one.
47
The PATCH number changes for the rest.
48
49
h3. Example
50
51
For the sake of this guide, we will consider that we are releasing a new version numbered 3.4.0 (and thus we were developing 3.4.0-SNAPSHOT).
52
53 4 Anonyme
h2. Preparing for the Release and Tagging it
54 2 Anonyme
55 1 Anonyme
First, everything must be committed to Mercurial before doing the version update (this can be verified with @hg status@ before).
56 4 Anonyme
Let's say we just finished developing the 3.4.0-SNAPSHOT version and want to release the new 3.4.0 version.
57 1 Anonyme
58 4 Anonyme
h3. Updating the POM Files
59
60 2 Anonyme
We must update the POM files to reflect that, but do not touch the MANIFEST files:
61
<pre>
62
$ cd fr.irit.smac.may.speadl.parent
63
$ mvn -Dtycho.mode=maven versions:set -DnewVersion=3.4.0
64
</pre>
65
66
This is done from the parent directory and will impact all the modules.
67
The @-Dtycho.mode=maven@ argument tells Maven not to try to resolve Eclipse aspects that takes time and are useless here.
68 1 Anonyme
69 2 Anonyme
Now our Maven artefacts are versioned 3.4.0 while the plugins are versioned 3.4.0.qualifier.
70
71 4 Anonyme
h3. Tagging the Release
72 2 Anonyme
73
Now we commit these changes and tag them in Mercurial:
74
<pre>
75
$ hg commit -m "prepare for 3.4.0 release"
76
$ hg tag v3.4.0
77
</pre>
78
79
The commit must only change the POM files, nothing else (this can be verified with @hg status@ before).
80
81
h2. Deploying the Release on Maven Central
82 1 Anonyme
83
Then, the release has to be deployed to Maven Central:
84
<pre>
85
$ mvn -P release clean deploy
86 7 Anonyme
$ mvn -Dtycho.mode=maven nexus-staging:release
87 1 Anonyme
</pre>
88
89 3 Anonyme
This will clean the sources, compile everything, create packages, install them in the local maven repository and finally deploy the *fr.irit.smac.may.speadl.parent* and *fr.irit.smac.may.speadl* modules to Maven Central.
90
91
Note that to deploy to Maven Central, it is needed to:
92
* Have a Sonatype JIRA account linked to "this ticket":https://issues.sonatype.org/browse/OSSRH-12012 as explained on "this page":http://central.sonatype.org/pages/ossrh-guide.html.
93
* Have a GnuPG key to sign the packages as explained on "this page":http://central.sonatype.org/pages/requirements.html and "this page":http://central.sonatype.org/pages/apache-maven.html.
94
95
The @-P release@ argument is important so that the deployed artefacts have a source and javadoc associated artefact and are signed as needed by Maven Central.
96 7 Anonyme
The @nexus-staging:release@ goal must be called to actually accept the deployment and release it on Maven Central: that last phase can also be done "trough the Nexus UI":http://central.sonatype.org/pages/releasing-the-deployment.html.
97 3 Anonyme
98
h2. Deploying the Release in the Update Site
99
100
The update site contains all releases of MAY, not just the last one: in order to add a new version, it is first needed to get the current update site, to add the plugins and features, and finally to update some metadata in it.
101
102
h3. Getting the Current Update Site
103
104
The update site of MAY is stored on the IRIT servers.
105
A copy must be made locally, for example using SSH and rsync:
106
<pre>
107
$ rsync -azv -e "ssh USER@sash.irit.fr ssh" USER@bali:/REMOTE/PATH/TO/UPDATE/SITE /LOCAL/PATH/TO/UPDATE/SITE
108
</pre>
109
110
Or directly by mounting it through SSH:
111
<pre>
112
$ sshfs USER@bali:/REMOTE/PATH/TO/UPDATE/SITE /LOCAL/PATH/TO/UPDATE/SITE
113
</pre>
114
115
The choice of the method is out of the scope of this document, the important point is to have a locally accessible directory of the existing update site.
116
117
h3. Add New Version to Update Site and Update Metadata
118
119
Use the following to update the update site with new version:
120 1 Anonyme
<pre>
121
$ cd ../fr.irit.smac.may.speadl.updatesite
122
$ mvn -Dtycho.mode=maven -Dfinal-update-site=/LOCAL/PATH/TO/UPDATE/SITE tycho-p2-extras:publish-features-and-bundles tycho-p2:category-p2-metadata 
123 4 Anonyme
</pre>
124
125
h3. Publish the New Update Site
126
127
If the update site was copied using rsync, it is needed to sync it back, for example with:
128
<pre>
129
$ rsync -azv -e "ssh UGER@sash.irit.fr ssh" /LOCAL/PATH/TO/UPDATE/SITE USER@bali:/REMOTE/PATH/TO/UPDATE/SITE
130
</pre>
131
132
If it was mounted through SSH, nothing has to be done except unmounting if desired:
133
<pre>
134
$ fusermount -u /LOCAL/PATH/TO/UPDATE/SITE
135
</pre>
136
137
Again, this is out of scope of this guide.
138
139
h2. Preparing the Next Development Cycle
140
141
Now everything is deployed, we can prepare the next development cycle by increasing the version to a SNAPSHOT one.
142
Because we changed only the version of the POM file and not the version of the MANIFEST file, it is needed first to revert the version change and then increment the versions all at once:
143
<pre>
144
$ cd ../fr.irit.smac.may.speadl.parent
145
$ mvn -Dtycho.mode=maven versions:set -DnewVersion=3.4.0-SNAPSHOT
146 10 Anonyme
$ mvn -Dtycho.mode=maven org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion=3.4.1-SNAPSHOT
147 4 Anonyme
</pre>
148
149
And then, we can commit it and push all the changes we made:
150
<pre>
151
$ hg commit -m "increment to 3.4.1 development version"
152
$ hg push
153 3 Anonyme
</pre>