Avoid existing site checkout in all child modules

This commit is contained in:
Alex Herbert 2021-08-13 14:11:47 +01:00
parent 0230ab72ce
commit c9b95e6eaf
1 changed files with 84 additions and 15 deletions

97
pom.xml
View File

@ -69,6 +69,7 @@
<math.commons.math3.version>3.6.1</math.commons.math3.version> <math.commons.math3.version>3.6.1</math.commons.math3.version>
<math.junit5.version>5.7.2</math.junit5.version> <math.junit5.version>5.7.2</math.junit5.version>
<math.surefire.version>3.0.0-M5</math.surefire.version> <math.surefire.version>3.0.0-M5</math.surefire.version>
<math.antrun.version>1.8</math.antrun.version>
<!-- Workaround to avoid duplicating config files. --> <!-- Workaround to avoid duplicating config files. -->
<math.parent.dir>${basedir}</math.parent.dir> <math.parent.dir>${basedir}</math.parent.dir>
@ -94,6 +95,10 @@
<math.jgit.buildnumber.version>1.2.10</math.jgit.buildnumber.version> <math.jgit.buildnumber.version>1.2.10</math.jgit.buildnumber.version>
<implementation.build>${git.revision}; ${maven.build.timestamp}</implementation.build> <implementation.build>${git.revision}; ${maven.build.timestamp}</implementation.build>
<!-- Workaround to avoid the SVN site checkout in all modules.
This flag should be deactivated by child modules. -->
<perform.site.checkout>true</perform.site.checkout>
<!-- <!--
Override so that "mvn commons:download-page" will generates a web page Override so that "mvn commons:download-page" will generates a web page
referring to the files created by the "dist-archive" module. referring to the files created by the "dist-archive" module.
@ -597,10 +602,25 @@
</build> </build>
</profile> </profile>
<profile> <profile>
<!-- Override a parent property if the SVN site checkout should not be performed.
This should activate for child modules. -->
<id>is-child-module</id>
<activation>
<file>
<missing>${basedir}/CONTRIBUTING.md</missing>
</file>
</activation>
<properties>
<perform.site.checkout>false</perform.site.checkout>
</properties>
</profile>
<profile>
<!-- Runs if the SVN site checkout does not exist.
This is either obtained using svn (for the parent) or an empty directory is created. -->
<id>setup-checkout</id> <id>setup-checkout</id>
<activation> <activation>
<file> <file>
<missing>site-content</missing> <missing>${commons.scmPubCheckoutDirectory}</missing>
</file> </file>
</activation> </activation>
<build> <build>
@ -608,7 +628,25 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId> <artifactId>maven-antrun-plugin</artifactId>
<version>${math.antrun.version}</version>
<executions> <executions>
<!-- For multi-module builds, only the parent directory requires a site checkout.
This task will create an empty directory as the site checkout is missing. -->
<execution>
<id>empty-checkout</id>
<phase>pre-site</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target name="empty-checkout" unless="${perform.site.checkout}">
<mkdir dir="${commons.scmPubCheckoutDirectory}"/>
<echo file="${commons.scmPubCheckoutDirectory}${file.separator}README"
message="The '${commons.scmPubCheckoutDirectory}' directory is empty in child modules."/>
</target>
</configuration>
</execution>
<!-- Checkout the top-level directory of the site using SVN. -->
<execution> <execution>
<id>prepare-checkout</id> <id>prepare-checkout</id>
<phase>pre-site</phase> <phase>pre-site</phase>
@ -616,22 +654,53 @@
<goal>run</goal> <goal>run</goal>
</goals> </goals>
<configuration> <configuration>
<tasks> <target name="prepare-checkout" if="${perform.site.checkout}">
<exec executable="svn"> <!-- Top level directory -->
<exec executable="svn" failifexecutionfails="false">
<arg line="checkout --depth immediates ${commons.scmPubUrl} ${commons.scmPubCheckoutDirectory}" /> <arg line="checkout --depth immediates ${commons.scmPubUrl} ${commons.scmPubCheckoutDirectory}" />
</exec> </exec>
<!-- Create the directory in the event that no svn exectuable is on the path -->
<mkdir dir="${commons.scmPubCheckoutDirectory}"/>
<exec executable="svn"> <echo file="${commons.scmPubCheckoutDirectory}.README">The '${commons.scmPubCheckoutDirectory}' directory is controlled by "subversion".
<arg line="update --set-depth exclude ${commons.scmPubCheckoutDirectory}/javadocs"/> Running "svn up" will download *all* the files of the live web site at
</exec> https://commons.apache.org/math
This is avoided by creating an empty directory when svn is not available.
<pathconvert pathsep=" " property="dirs"> </echo>
<dirset dir="${commons.scmPubCheckoutDirectory}" includes="*"/> </target>
</pathconvert> </configuration>
<exec executable="svn"> </execution>
<arg line="update --set-depth infinity ${dirs}"/> </executions>
</exec> </plugin>
</tasks> </plugins>
</build>
</profile>
<profile>
<!-- Allow the SVN site checkout to be removed in the clean phase. -->
<id>clean-checkout</id>
<activation>
<file>
<exists>${commons.scmPubCheckoutDirectory}</exists>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>${math.antrun.version}</version>
<executions>
<execution>
<id>remove-checkout</id>
<phase>clean</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target name="remove-checkout">
<delete dir="${commons.scmPubCheckoutDirectory}" quiet="true"/>
<delete file="${commons.scmPubCheckoutDirectory}.README" quiet="true"/>
</target>
</configuration> </configuration>
</execution> </execution>
</executions> </executions>