commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chtom...@apache.org
Subject commons-release-plugin git commit: COMMONSSITE-113: site unpacked in dist staging area now
Date Fri, 01 Jun 2018 14:38:19 GMT
Repository: commons-release-plugin
Updated Branches:
  refs/heads/master 6ae1e8be9 -> 4cda015b5


COMMONSSITE-113: site unpacked in dist staging area now


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/4cda015b
Tree: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/tree/4cda015b
Diff: http://git-wip-us.apache.org/repos/asf/commons-release-plugin/diff/4cda015b

Branch: refs/heads/master
Commit: 4cda015b5e088dd0d187c507e1982bbb9ee37dba
Parents: 6ae1e8b
Author: Rob Tompkins <chtompki@apache.org>
Authored: Fri Jun 1 10:38:10 2018 -0400
Committer: Rob Tompkins <chtompki@apache.org>
Committed: Fri Jun 1 10:38:10 2018 -0400

----------------------------------------------------------------------
 .../mojos/CommonsDistributionStagingMojo.java   | 45 ++++++++++++++++----
 .../mojos/CommonsSiteCompressionMojo.java       |  3 ++
 .../CommonsDistributionStagingMojoTest.java     |  8 ++++
 .../detach-distributions/target/site/index.html | 24 +++++++++++
 .../target/site/subdirectory/index.html         | 24 +++++++++++
 .../stage-distributions-disabled.xml            |  1 +
 .../stage-distributions/stage-distributions.xml |  1 +
 7 files changed, 98 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/4cda015b/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 edf20e1..af439f4 100755
--- a/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojo.java
+++ b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojo.java
@@ -16,14 +16,7 @@
  */
 package org.apache.commons.release.plugin.mojos;
 
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
+import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.release.plugin.SharedFunctions;
 import org.apache.commons.release.plugin.velocity.HeaderHtmlVelocityDelegate;
@@ -47,6 +40,15 @@ import org.apache.maven.scm.provider.svn.repository.SvnScmProviderRepository;
 import org.apache.maven.scm.provider.svn.svnexe.SvnExeScmProvider;
 import org.apache.maven.scm.repository.ScmRepository;
 
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
 /**
  * This class checks out the dev distribution location, copies the distributions into that
directory
  * structure under the <code>target/commons-release-plugin/scm</code> directory.
Then commits the
@@ -80,6 +82,10 @@ public class CommonsDistributionStagingMojo extends AbstractMojo {
     @Parameter(defaultValue = "${basedir}")
     private File baseDir;
 
+    /** The location to which the site gets built during running <code>mvn site</code>.
*/
+    @Parameter(defaultValue = "${project.build.directory}/site", property = "commons.siteOutputDirectory")
+    private File siteDirectory;
+
     /**
      * The main working directory for the plugin, namely <code>target/commons-release-plugin</code>,
but
      * that assumes that we're using the default maven <code>${project.build.directory}</code>.
@@ -276,12 +282,35 @@ public class CommonsDistributionStagingMojo extends AbstractMojo {
                 filesForMavenScmFileSet.add(copy);
             }
         }
+        filesForMavenScmFileSet.addAll(copySiteToScmDirectory());
         filesForMavenScmFileSet.addAll(buildReadmeAndHeaderHtmlFiles());
         filesForMavenScmFileSet.add(copiedReleaseNotes);
         return filesForMavenScmFileSet;
     }
 
     /**
+     * Copies <code>${basedir}/target/site</code> to <code>${basedir}/target/commons-release-plugin/scm/site</code>.
+     *
+     * @return the {@link List} of {@link File}'s contained in
+     *         <code>${basedir}/target/commons-release-plugin/scm/site</code>,
after the copy is complete.
+     * @throws MojoExecutionException if the site copying fails for some reason.
+     */
+    private List<File> copySiteToScmDirectory() throws MojoExecutionException {
+        if (!siteDirectory.exists()) {
+            getLog().error("\"mvn site\" was not run before this goal, or a siteDirectory
did not exist.");
+            throw new MojoExecutionException(
+                    "\"mvn site\" was not run before this goal, or a siteDirectory did not
exist."
+            );
+        }
+        try {
+            FileUtils.copyDirectoryToDirectory(siteDirectory, distCheckoutDirectory);
+        } catch (IOException e) {
+            throw new MojoExecutionException("Site copying failed", e);
+        }
+        return new ArrayList<>(FileUtils.listFiles(siteDirectory, null, true));
+    }
+
+    /**
      * Builds up <code>README.html</code> and <code>HEADER.html</code>
that reside in following.
      * <ul>
      *     <li>distRoot

http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/4cda015b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsSiteCompressionMojo.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/release/plugin/mojos/CommonsSiteCompressionMojo.java
b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsSiteCompressionMojo.java
index 1cd4e63..2441200 100755
--- a/src/main/java/org/apache/commons/release/plugin/mojos/CommonsSiteCompressionMojo.java
+++ b/src/main/java/org/apache/commons/release/plugin/mojos/CommonsSiteCompressionMojo.java
@@ -42,7 +42,10 @@ import org.apache.maven.plugins.annotations.Parameter;
  *
  * @author chtompki
  * @since 1.0
+ * @deprecated - as we no longer wish to compress the site, we are going to put this functionality
in the
+ *               {@link CommonsDistributionStagingMojo}.
  */
+@Deprecated
 @Mojo(name = "compress-site",
         defaultPhase = LifecyclePhase.POST_SITE,
         threadSafe = true,

http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/4cda015b/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojoTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojoTest.java
b/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojoTest.java
index 052ce60..2542a75 100755
--- a/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojoTest.java
+++ b/src/test/java/org/apache/commons/release/plugin/mojos/CommonsDistributionStagingMojoTest.java
@@ -103,6 +103,10 @@ public class CommonsDistributionStagingMojoTest {
         File srcZipMD5 = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/scm/source/mockAttachedZip-src.zip.md5");
         File srcZipSHA1 = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/scm/source/mockAttachedZip-src.zip.sha1");
         File srcZipSHA256 = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/scm/source/mockAttachedZip-src.zip.sha256");
+        File site = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/scm/site");
+        File siteIndexHtml = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/scm/site/index.html");
+        File siteSubdirectory = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH + "/scm/site/subdirectory");
+        File siteSubdirectoryIndexHtml = new File(COMMONS_RELEASE_PLUGIN_TEST_DIR_PATH +
"/scm/site/subdirectory/index.html");
         assertTrue(targetScmDirectory.exists());
         assertTrue(releaseNotes.exists());
         assertTrue(readmeHtml.exists());
@@ -131,6 +135,10 @@ public class CommonsDistributionStagingMojoTest {
         assertTrue(srcZipMD5.exists());
         assertTrue(srcZipSHA1.exists());
         assertTrue(srcZipSHA256.exists());
+        assertTrue(site.exists());
+        assertTrue(siteIndexHtml.exists());
+        assertTrue(siteSubdirectory.exists());
+        assertTrue(siteSubdirectoryIndexHtml.exists());
     }
 
     @Test

http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/4cda015b/src/test/resources/mojos/detach-distributions/target/site/index.html
----------------------------------------------------------------------
diff --git a/src/test/resources/mojos/detach-distributions/target/site/index.html b/src/test/resources/mojos/detach-distributions/target/site/index.html
new file mode 100644
index 0000000..c9a72dd
--- /dev/null
+++ b/src/test/resources/mojos/detach-distributions/target/site/index.html
@@ -0,0 +1,24 @@
+<html>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<header><title>Mock maven site</title></header>
+<body>
+mock body
+</body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/4cda015b/src/test/resources/mojos/detach-distributions/target/site/subdirectory/index.html
----------------------------------------------------------------------
diff --git a/src/test/resources/mojos/detach-distributions/target/site/subdirectory/index.html
b/src/test/resources/mojos/detach-distributions/target/site/subdirectory/index.html
new file mode 100644
index 0000000..c9a72dd
--- /dev/null
+++ b/src/test/resources/mojos/detach-distributions/target/site/subdirectory/index.html
@@ -0,0 +1,24 @@
+<html>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~   http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<header><title>Mock maven site</title></header>
+<body>
+mock body
+</body>
+</html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/4cda015b/src/test/resources/mojos/stage-distributions/stage-distributions-disabled.xml
----------------------------------------------------------------------
diff --git a/src/test/resources/mojos/stage-distributions/stage-distributions-disabled.xml
b/src/test/resources/mojos/stage-distributions/stage-distributions-disabled.xml
index 0ca4ed8..987e3a2 100755
--- a/src/test/resources/mojos/stage-distributions/stage-distributions-disabled.xml
+++ b/src/test/resources/mojos/stage-distributions/stage-distributions-disabled.xml
@@ -45,6 +45,7 @@
                     <project implementation="org.apache.commons.release.plugin.stubs.DistributionDetachmentProjectStub"
/>
                     <workingDirectory>target/testing-commons-release-plugin</workingDirectory>
                     <distCheckoutDirectory>target/testing-commons-release-plugin/scm</distCheckoutDirectory>
+                    <siteDirectory>${basedir}/target/test-classes/mojos/detach-distributions/target/site</siteDirectory>
                     <releaseNotesFile>src/test/resources/mojos/stage-distributions/RELEASE-NOTES.txt</releaseNotesFile>
                     <distSvnStagingUrl>scm:svn:https://dist.apache.org/repos/dist/dev/commons/release-plugin</distSvnStagingUrl>
                     <isDistModule>false</isDistModule>

http://git-wip-us.apache.org/repos/asf/commons-release-plugin/blob/4cda015b/src/test/resources/mojos/stage-distributions/stage-distributions.xml
----------------------------------------------------------------------
diff --git a/src/test/resources/mojos/stage-distributions/stage-distributions.xml b/src/test/resources/mojos/stage-distributions/stage-distributions.xml
index 8e63d67..cdbb9aa 100755
--- a/src/test/resources/mojos/stage-distributions/stage-distributions.xml
+++ b/src/test/resources/mojos/stage-distributions/stage-distributions.xml
@@ -45,6 +45,7 @@
                     <project implementation="org.apache.commons.release.plugin.stubs.DistributionDetachmentProjectStub"
/>
                     <workingDirectory>target/testing-commons-release-plugin</workingDirectory>
                     <distCheckoutDirectory>target/testing-commons-release-plugin/scm</distCheckoutDirectory>
+                    <siteDirectory>${basedir}/target/test-classes/mojos/detach-distributions/target/site</siteDirectory>
                     <releaseNotesFile>src/test/resources/mojos/stage-distributions/RELEASE-NOTES.txt</releaseNotesFile>
                     <distSvnStagingUrl>scm:svn:https://dist.apache.org/repos/dist/dev/commons/release-plugin</distSvnStagingUrl>
                     <isDistModule>true</isDistModule>


Mime
View raw message