You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ch...@apache.org on 2018/01/07 18:21:59 UTC
[15/26] commons-release-plugin git commit: Close to getting maven to
commit to svn...didn't work though
Close to getting maven to commit to svn...didn't work though
Project: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/commit/af188007
Tree: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/tree/af188007
Diff: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/diff/af188007
Branch: refs/heads/master
Commit: af1880079c500cc32bbd5ed6d2923c263563047f
Parents: d1d0cb4
Author: Rob Tompkins <ch...@apache.org>
Authored: Tue Jan 2 15:51:53 2018 -0500
Committer: Rob Tompkins <ch...@apache.org>
Committed: Tue Jan 2 15:51:53 2018 -0500
----------------------------------------------------------------------
.../mojos/CommonsDistributionStagingMojo.java | 27 ++++++++++++++++++--
1 file changed, 25 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/af188007/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojo.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojo.java b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojo.java
index 68d37ab..6e9ad33 100644
--- a/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojo.java
+++ b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojo.java
@@ -23,6 +23,7 @@ import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
+import org.apache.maven.project.MavenProject;
import org.apache.maven.project.artifact.AttachedArtifact;
import org.apache.maven.scm.ScmException;
import org.apache.maven.scm.ScmFileSet;
@@ -40,6 +41,7 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -56,6 +58,11 @@ public class CommonsDistributionStagingMojo extends AbstractMojo {
/**
*/
+ @Parameter( defaultValue = "${project}", required = true )
+ private MavenProject project;
+
+ /**
+ */
@Parameter(defaultValue = "${basedir}")
private File basedir;
@@ -95,7 +102,18 @@ public class CommonsDistributionStagingMojo extends AbstractMojo {
getLog().info("Checking out dist from: " + distSvnStagingUrl);
provider.checkOut(repository, scmFileSet);
copyReleaseNotesToWorkingDirectory();
- copyDistributionsIntoScmDirectoryStructure();
+ List<File> filesToCommit = copyDistributionsIntoScmDirectoryStructure();
+ ScmFileSet scmFileSetToCommit = new ScmFileSet(distCheckoutDirectory, filesToCommit);
+ if (!dryRun) {
+ provider.checkIn(
+ repository,
+ scmFileSetToCommit,
+ "Staging release: " + project.getArtifactId() + ", version: " + project.getVersion()
+ );
+ } else {
+ getLog().info("Would have committed to: " + distSvnStagingUrl);
+ getLog().info("Staging release: " + project.getArtifactId() + ", version: " + project.getVersion());
+ }
} catch (ScmException e) {
getLog().error("Could not commit files to dist: " + distSvnStagingUrl, e);
throw new MojoExecutionException("Could not commit files to dist: " + distSvnStagingUrl, e);
@@ -114,25 +132,30 @@ public class CommonsDistributionStagingMojo extends AbstractMojo {
SharedFunctions.copyFile(getLog(), releaseNotes, copiedReleaseNotes);
}
- private void copyDistributionsIntoScmDirectoryStructure() throws MojoExecutionException {
+ private List<File> copyDistributionsIntoScmDirectoryStructure() throws MojoExecutionException {
List<File> workingDirectoryFiles = Arrays.asList(workingDirectory.listFiles());
String scmBinariesRoot = buildDistBinariesRoot();
String scmSourceRoot = buildDistSourceRoot();
+ List<File> filesForMavenScmFileSet = new ArrayList<>();
File copy;
for (File file : workingDirectoryFiles) {
if (file.getName().contains("src")) {
copy = new File(scmSourceRoot + "/" + file.getName());
SharedFunctions.copyFile(getLog(), file, copy);
+ filesForMavenScmFileSet.add(copy);
} else if (file.getName().contains("bin")) {
copy = new File(scmBinariesRoot + "/" + file.getName());
SharedFunctions.copyFile(getLog(), file, copy);
+ filesForMavenScmFileSet.add(copy);
} else if (file.getName().contains("scm")){
//do nothing because we are copying into scm
} else {
copy = new File(distCheckoutDirectory.getAbsolutePath() + "/" + file.getName());
SharedFunctions.copyFile(getLog(), file, copy);
+ filesForMavenScmFileSet.add(copy);
}
}
+ return filesForMavenScmFileSet;
}
private String buildDistBinariesRoot() {