### Eclipse Workspace Patch 1.0
#P m2release-hudson
Index: plugin/src/main/resources/org/jvnet/hudson/plugins/m2release/M2ReleaseAction/index.jelly
===================================================================
--- plugin/src/main/resources/org/jvnet/hudson/plugins/m2release/M2ReleaseAction/index.jelly (revision 27857)
+++ plugin/src/main/resources/org/jvnet/hudson/plugins/m2release/M2ReleaseAction/index.jelly (working copy)
@@ -2,18 +2,25 @@
Displays the form to choose the tag name.
This belongs to a build view.
+
+
-->
-
+
-
+
+
+
+
+
+
@@ -42,8 +49,9 @@
-
-
+
+
+
\ No newline at end of file
Index: plugin/src/main/resources/index.jelly
===================================================================
--- plugin/src/main/resources/index.jelly (revision 27857)
+++ plugin/src/main/resources/index.jelly (working copy)
@@ -4,5 +4,5 @@
Since we don't really have anything dynamic here, let's just use static HTML.
-->
\ No newline at end of file
Index: plugin/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseBuildWrapper.java
===================================================================
--- plugin/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseBuildWrapper.java (revision 27857)
+++ plugin/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseBuildWrapper.java (working copy)
@@ -79,6 +79,7 @@
private transient Map versions;
private transient boolean appendHudsonBuildNumber;
private transient String repoDescription;
+ private transient String VCSVersion;
public String releaseGoals = DescriptorImpl.DEFAULT_RELEASE_GOALS;
@@ -98,6 +99,7 @@
MavenModuleSet mmSet;
final String mavenOpts;
+
synchronized (getModuleSet(build)) {
if (!doRelease) {
// we are not performing a release so don't need a custom tearDown.
@@ -119,6 +121,9 @@
else {
mmSet.setGoals(releaseGoals);
}
+ if(versions.get("VCSVersion") != null) {
+ mmSet.setGoals(generateVersionString(build.getNumber()) + releaseGoals+" -Dtag="+versions.get("VCSVersion"));
+ }
}
else {
// can this be so?
@@ -161,6 +166,7 @@
getDescriptor().getNexusUser(),
getDescriptor().getNexusPassword());
MavenModule rootModule = mmSet.getRootModule();
+
// TODO add support for a user supplied comment.
StageRepository repo = client.getOpenStageRepositoryForUser(rootModule.getModuleName().groupId,
rootModule.getModuleName().artifactId,
@@ -199,6 +205,10 @@
// expects a map of key="-Dproject.rel.${m.moduleName}" value="version"
this.versions = versions;
}
+
+ void setVersionsVCSVersion(String VCSVersion) {
+ this.VCSVersion = VCSVersion;
+ }
public void setAppendHudsonBuildNumber(boolean appendHudsonBuildNumber) {
@@ -218,15 +228,18 @@
// -Dproject.rel.org.mycompany.group.project=version ....
StringBuilder sb = new StringBuilder();
for (String key : versions.keySet()) {
- sb.append(key);
- sb.append('=');
- sb.append(versions.get(key));
- if (appendHudsonBuildNumber && key.startsWith("-Dproject.rel")) { //$NON-NLS-1$
- sb.append('-');
- sb.append(buildNumber);
+ if(!key.startsWith("VCSVersion")) {
+ sb.append(key);
+ sb.append('=');
+ sb.append(versions.get(key));
+ if (appendHudsonBuildNumber && key.startsWith("-Dproject.rel")) { //$NON-NLS-1$
+ sb.append('!');
+ sb.append(buildNumber);
+ }
+ sb.append(' ');
}
- sb.append(' ');
}
+
return sb.toString();
}
Index: plugin/src/main/java/org/jvnet/hudson/plugins/m2release/ReleaseCause.java
===================================================================
--- plugin/src/main/java/org/jvnet/hudson/plugins/m2release/ReleaseCause.java (revision 27857)
+++ plugin/src/main/java/org/jvnet/hudson/plugins/m2release/ReleaseCause.java (working copy)
@@ -23,6 +23,8 @@
*/
package org.jvnet.hudson.plugins.m2release;
+import org.acegisecurity.vote.AuthenticatedVoter;
+
import hudson.model.Hudson;
import hudson.model.Cause.UserCause;
Index: plugin/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseAction.java
===================================================================
--- plugin/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseAction.java (revision 27857)
+++ plugin/src/main/java/org/jvnet/hudson/plugins/m2release/M2ReleaseAction.java (working copy)
@@ -23,6 +23,7 @@
*/
package org.jvnet.hudson.plugins.m2release;
+
import hudson.maven.MavenModule;
import hudson.maven.MavenModuleSet;
import hudson.model.Action;
@@ -41,7 +42,7 @@
import org.kohsuke.stapler.StaplerResponse;
/**
- * The action appears as the link in the side bar that users will click on in order to start the release
+ * The action appears as thelink in the side bar that users will click on in order to start the release
* process.
*
* @author James Nord
@@ -50,6 +51,7 @@
public class M2ReleaseAction implements Action {
private MavenModuleSet project;
+ public boolean i = true;
public M2ReleaseAction(MavenModuleSet project) {
@@ -75,7 +77,7 @@
return "m2release"; //$NON-NLS-1$
}
- public Collection getModules() {
+ public Collection getModules(){
return project.getModules();
}
@@ -83,6 +85,24 @@
return version.replace("-SNAPSHOT", ""); //$NON-NLS-1$ //$NON-NLS-2$
}
+
+
+ public String computeReleaseVCSVersion(String version) {
+ i = false;
+
+ String temp = "v"+version.replace(".","_");
+ return temp.replace("-SNAPSHOT", "");
+ }
+
+ public boolean isRazVCSVersion() {
+ this.i = true;
+ return i;
+ }
+
+ public boolean isAfficheVCSVersion(){
+ return i;
+ }
+
public String computeRepoDescription() {
return "Release " + computeReleaseVersion(project.getRootModule().getVersion()) + " of " + project.getRootModule().getName();
}
@@ -126,7 +146,6 @@
public void doSubmit(StaplerRequest req, StaplerResponse resp) throws IOException, ServletException {
M2ReleaseBuildWrapper.checkReleasePermission(project);
M2ReleaseBuildWrapper m2Wrapper = project.getBuildWrappers().get(M2ReleaseBuildWrapper.class);
-
// JSON collapses everything in the dynamic specifyVersions section so we need to fall back to
// good old http...
Map,?> httpParams = req.getParameterMap();
@@ -140,10 +159,13 @@
if (httpParams.containsKey("specifyVersions")) {
versions = new HashMap();
for (Object key : httpParams.keySet()) {
- String keyStr = (String)key;
+ String keyStr = (String)key;
if (keyStr.startsWith("-Dproject.")) {
versions.put(keyStr, (String)(((Object[])httpParams.get(key))[0]));
}
+ if (keyStr.startsWith("VCSVersion")) {
+ versions.put(keyStr, (String)(((Object[])httpParams.get(key))[0]));
+ }
}
}
@@ -160,5 +182,4 @@
// redirect to status page
resp.sendRedirect(project.getAbsoluteUrl());
}
-
}