Projet

Général

Profil

MAY Plugin Release Process » Historique » Version 17

Anonyme, 30/10/2014 13:34

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 17 Anonyme
See [[MAY Plugin Architecture]].
23 2 Anonyme
24
h3. Syntactical Version Numbering
25
26
The Eclipse plugins follow the OSGI version numbering and it is stored in the *MANIFEST.MF* file of each project.
27
The Maven artefact follows the Maven version numbering and it is stored in the *pom.xml* file of each project.
28
All are using the 3 digits "SemVer":http://semver.org/ system (Major.Minor.Patch).
29
30 15 Anonyme
For the plugins, this is followed by a qualifier (Major.Minor.Patch.qualifier) that is replaced with the compilation time and date on deployment.
31
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 on deployment.
32 2 Anonyme
33
So the plugins always have the qualifier while the Maven artefacts have the SNAPSHOT information only for development.
34
35
h3. Semantic Version Numbering
36
37
The MAJOR number changes when the syntax is incompatible with the previous one.
38
The MINOR number changes when the generated code is incompatible with the previous one.
39
The PATCH number changes for the rest.
40
41
h3. Example
42
43
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).
44
45 4 Anonyme
h2. Preparing for the Release and Tagging it
46 2 Anonyme
47 1 Anonyme
First, everything must be committed to Mercurial before doing the version update (this can be verified with @hg status@ before).
48 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.
49 1 Anonyme
50 4 Anonyme
h3. Updating the POM Files
51
52 2 Anonyme
We must update the POM files to reflect that, but do not touch the MANIFEST files:
53
<pre>
54
$ cd fr.irit.smac.may.speadl.parent
55
$ mvn -Dtycho.mode=maven versions:set -DnewVersion=3.4.0
56
</pre>
57
58
This is done from the parent directory and will impact all the modules.
59
The @-Dtycho.mode=maven@ argument tells Maven not to try to resolve Eclipse aspects that takes time and are useless here.
60 1 Anonyme
61 2 Anonyme
Now our Maven artefacts are versioned 3.4.0 while the plugins are versioned 3.4.0.qualifier.
62
63 4 Anonyme
h3. Tagging the Release
64 2 Anonyme
65
Now we commit these changes and tag them in Mercurial:
66
<pre>
67
$ hg commit -m "prepare for 3.4.0 release"
68
$ hg tag v3.4.0
69
</pre>
70
71 16 Anonyme
The commit should only change the POM files, nothing else (this can be verified with @hg status@ before).
72 2 Anonyme
73
h2. Deploying the Release on Maven Central
74 1 Anonyme
75
Then, the release has to be deployed to Maven Central:
76
<pre>
77
$ mvn -P release clean deploy
78 7 Anonyme
$ mvn -Dtycho.mode=maven nexus-staging:release
79 1 Anonyme
</pre>
80
81 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.
82
83
Note that to deploy to Maven Central, it is needed to:
84
* 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.
85
* 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.
86
87
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.
88 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.
89 3 Anonyme
90
h2. Deploying the Release in the Update Site
91
92
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.
93
94
h3. Getting the Current Update Site
95
96
The update site of MAY is stored on the IRIT servers.
97
A copy must be made locally, for example using SSH and rsync:
98
<pre>
99 11 Anonyme
$ rsync -azv -e "ssh USER@sash.irit.fr ssh" USER@bali:/REMOTE/PATH/TO/UPDATE/SITE/ /LOCAL/PATH/TO/UPDATE/SITE/
100 3 Anonyme
</pre>
101 13 Anonyme
Example:
102
<pre>
103
$ rsync -azv -e "ssh vnoel@sash.irit.fr ssh" vnoel@bali:~/update-may-3/ ./update-may-3/
104
</pre>
105 3 Anonyme
106
Or directly by mounting it through SSH:
107 11 Anonyme
<pre>
108 3 Anonyme
$ sshfs USER@bali:/REMOTE/PATH/TO/UPDATE/SITE/ /LOCAL/PATH/TO/UPDATE/SITE/
109
</pre>
110
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.
111
112
h3. Add New Version to Update Site and Update Metadata
113
114
Use the following to update the update site with new version:
115 1 Anonyme
<pre>
116
$ cd ../fr.irit.smac.may.speadl.updatesite
117
$ mvn -Dtycho.mode=maven -Dfinal-update-site=/LOCAL/PATH/TO/UPDATE/SITE tycho-p2-extras:publish-features-and-bundles tycho-p2:category-p2-metadata 
118 4 Anonyme
</pre>
119
120
h3. Publish the New Update Site
121
122
If the update site was copied using rsync, it is needed to sync it back, for example with:
123
<pre>
124 1 Anonyme
$ rsync -azv -e "ssh UGER@sash.irit.fr ssh" /LOCAL/PATH/TO/UPDATE//SITE USER@bali:/REMOTE/PATH/TO/UPDATE/SITE/
125 13 Anonyme
</pre>
126
Example:
127
<pre>
128
$ rsync -azv -e "ssh vnoel@sash.irit.fr ssh" ./update-may-3/ vnoel@bali:~/update-may-3/
129 4 Anonyme
</pre>
130
131
If it was mounted through SSH, nothing has to be done except unmounting if desired:
132
<pre>
133 12 Anonyme
$ fusermount -u /LOCAL/PATH/TO/UPDATE/SITE/
134 4 Anonyme
</pre>
135
136
Again, this is out of scope of this guide.
137
138
h2. Preparing the Next Development Cycle
139
140
Now everything is deployed, we can prepare the next development cycle by increasing the version to a SNAPSHOT one.
141
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:
142
<pre>
143
$ cd ../fr.irit.smac.may.speadl.parent
144
$ mvn -Dtycho.mode=maven versions:set -DnewVersion=3.4.0-SNAPSHOT
145 10 Anonyme
$ mvn -Dtycho.mode=maven org.eclipse.tycho:tycho-versions-plugin:set-version -DnewVersion=3.4.1-SNAPSHOT
146 4 Anonyme
</pre>
147
148
And then, we can commit it and push all the changes we made:
149
<pre>
150
$ hg commit -m "increment to 3.4.1 development version"
151
$ hg push
152 3 Anonyme
</pre>