Browse Source

Build libs without additional profiles, add Enforcer rule

Because 'libx' no longer is a submodule of the AspectJ parent POM, it
will not be built automatically each time an AspectJ build runs.
Therefore, is is no longer necessary to shield the zip/unzip steps from
repetitive execution by profiles with auto-activation based on the
(non-)existence of files. An AspectJ developer knows when to build the
module, she does it manually anyway.

A new Enforcer rule makes sure to warn the developer if some files it
expects to exist in the libs folder are not actually present.

Now we also have a Maven Clean rule which wipes away all downloaded and
(un-)zipped files.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
tags/V1_9_7_M2
Alexander Kriegisch 3 years ago
parent
commit
d98f01fb7e
2 changed files with 291 additions and 276 deletions
  1. 247
    276
      libx/pom.xml
  2. 44
    0
      pom.xml

+ 247
- 276
libx/pom.xml View File

@@ -3,6 +3,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<!-- The AspectJ root POM is the parent, but this module is not a submodule -->
<parent>
<groupId>org.aspectj</groupId>
<artifactId>aspectj-parent</artifactId>
@@ -11,6 +12,26 @@

<artifactId>libx</artifactId>

<name>AspectJ Test Libraries</name>
<description>
This module downloads + installs libraries used by many tests, especially those running as Ant jobs. You should not
build this module during every build because it is somewhat slow, downloading stuff from 3rd-party websites,
unzipping some libraries (e.g. a full Ant distribution) and creating new ZIP files (e.g. source JARs, compound JARs
containing multiple libraries).

So just run 'mvn compile' once after cloning the AspectJ repository and you should be all set to subsequently build
AspectJ itself. If you forget this step, a Maven Enforcer rule in the AspectJ root POM will fail the build and
remind you to build this module.

Normally you never have to call 'mvn clean' here, but if for some reason the installed libraries are in an
inconsistent state (e.g. after an incomplete download), you can do so and then run 'mvn compile' again.

BTW, running 'mvn compile' multiple times will not repeat any download via Maven Dependency or Download Maven
plugins, but repeat all zip/unzip steps in TrueZIP Maven plugin. So try not to call it unnecessarily.
</description>

<!-- TODO: Add libx (for now, then finally lib) to .gitignore -->

<properties>
<lib.ant.name>apache-ant</lib.ant.name>
<lib.ant.artifact>${lib.ant.name}-${lib.ant.version}</lib.ant.artifact>
@@ -19,6 +40,21 @@
<build>
<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<!--
Deactivate this execution from the parent, because here it would be counter-productive, given the fact
that this module must be built before the enforcer rule can even pass elsewhere.
-->
<id>enforce-libraries-exist</id>
<phase>none</phase>
</execution>
</executions>
</plugin>

<plugin>
<groupId>com.googlecode.maven-download-plugin</groupId>
<artifactId>download-maven-plugin</artifactId>
@@ -68,9 +104,9 @@
<goal>wget</goal>
</goals>
<configuration>
<url>https://github.com/apache/commons-collections/archive/refs/tags/collections-2.0.zip</url>
<url>https://github.com/apache/commons-collections/archive/refs/tags/${lib.commons.collections.tag}.zip</url>
<outputDirectory>commons</outputDirectory>
<outputFileName>commons-collections-2.0-sources.jar</outputFileName>
<outputFileName>commons-collections-${lib.commons.collections.version}-sources.jar</outputFileName>
<sha1>824cacd0aafe21a94fb142388fd62f28a12df5ef</sha1>
</configuration>
</execution>
@@ -284,281 +320,216 @@
</executions>
</plugin>

</plugins>
</build>

<profiles>

<profile>
<id>unzip-ant-binaries</id>
<activation>
<file>
<!-- Only unzip if this file is missing in order to avoid doing it for each build -->
<missing>ant/bin/ant.bat</missing>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>truezip-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>unzip-ant-binaries</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<verbose>true</verbose>
<fileset>
<!--
This is why we use the TrueZIP plugin: It can seamlessly copy out of or into ZIP files as if they
were normal file system paths. No additional moves and deletes with Antrun are necessary.
-->
<directory>ant/${lib.ant.artifact}-bin.zip/${lib.ant.artifact}</directory>
<outputDirectory>ant</outputDirectory>
</fileset>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>zip-ant-sources</id>
<activation>
<file>
<!-- Only create archive if this file is missing in order to avoid doing it for each build -->
<missing>ant/ant-src.zip</missing>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>truezip-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>zip-ant-sources</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<verbose>true</verbose>
<fileset>
<!--
This is why we use the TrueZIP plugin: It can seamlessly copy out of or into ZIP files as if they
were normal file system paths. No additional moves and deletes with Antrun are necessary.
-->
<directory>ant/${lib.ant.artifact}-src.zip/${lib.ant.artifact}/src/main</directory>
<outputDirectory>ant/ant-src.zip</outputDirectory>
</fileset>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>zip-commons-binaries</id>
<activation>
<file>
<!-- Only create archive if this file is missing in order to avoid doing it for each build -->
<missing>commons/commons.jar</missing>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>truezip-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>zip-beanutils-binaries</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<verbose>true</verbose>
<fileset>
<!--
This is why we use the TrueZIP plugin: It can seamlessly copy out of or into ZIP files as if they
were normal file system paths. No additional moves and deletes with Antrun are necessary.
-->
<directory>commons/commons-beanutils-${lib.commons.beanutils.version}.jar</directory>
<outputDirectory>commons/commons.jar</outputDirectory>
</fileset>
</configuration>
</execution>
<execution>
<id>zip-collections-binaries</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<verbose>true</verbose>
<fileset>
<!--
This is why we use the TrueZIP plugin: It can seamlessly copy out of or into ZIP files as if they
were normal file system paths. No additional moves and deletes with Antrun are necessary.
-->
<directory>commons/commons-collections-2.0.jar</directory>
<outputDirectory>commons/commons.jar</outputDirectory>
</fileset>
</configuration>
</execution>
<execution>
<id>zip-digester-binaries</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<verbose>true</verbose>
<fileset>
<!--
This is why we use the TrueZIP plugin: It can seamlessly copy out of or into ZIP files as if they
were normal file system paths. No additional moves and deletes with Antrun are necessary.
-->
<directory>commons/commons-digester-${lib.commons.digester.version}.jar</directory>
<outputDirectory>commons/commons.jar</outputDirectory>
</fileset>
</configuration>
</execution>
<execution>
<id>zip-logging-binaries</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<verbose>true</verbose>
<fileset>
<!--
This is why we use the TrueZIP plugin: It can seamlessly copy out of or into ZIP files as if they
were normal file system paths. No additional moves and deletes with Antrun are necessary.
-->
<directory>commons/commons-logging-${lib.commons.logging.version}.jar</directory>
<outputDirectory>commons/commons.jar</outputDirectory>
</fileset>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>truezip-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>unzip-ant-binaries</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<verbose>true</verbose>
<fileset>
<!--
This is why we use the TrueZIP plugin: It can seamlessly copy out of or into ZIP files as if they
were normal file system paths. No additional moves and deletes with Antrun are necessary.
-->
<directory>ant/${lib.ant.artifact}-bin.zip/${lib.ant.artifact}</directory>
<outputDirectory>ant</outputDirectory>
</fileset>
</configuration>
</execution>
<execution>
<id>zip-ant-sources</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<verbose>true</verbose>
<fileset>
<!--
This is why we use the TrueZIP plugin: It can seamlessly copy out of or into ZIP files as if they
were normal file system paths. No additional moves and deletes with Antrun are necessary.
-->
<directory>ant/${lib.ant.artifact}-src.zip/${lib.ant.artifact}/src/main</directory>
<outputDirectory>ant/ant-src.zip</outputDirectory>
</fileset>
</configuration>
</execution>
<execution>
<id>zip-beanutils-binaries</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<verbose>true</verbose>
<fileset>
<!--
This is why we use the TrueZIP plugin: It can seamlessly copy out of or into ZIP files as if they
were normal file system paths. No additional moves and deletes with Antrun are necessary.
-->
<directory>commons/commons-beanutils-${lib.commons.beanutils.version}.jar</directory>
<outputDirectory>commons/commons.jar</outputDirectory>
</fileset>
</configuration>
</execution>
<execution>
<id>zip-collections-binaries</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<verbose>true</verbose>
<fileset>
<!--
This is why we use the TrueZIP plugin: It can seamlessly copy out of or into ZIP files as if they
were normal file system paths. No additional moves and deletes with Antrun are necessary.
-->
<directory>commons/commons-collections-${lib.commons.collections.version}.jar</directory>
<outputDirectory>commons/commons.jar</outputDirectory>
</fileset>
</configuration>
</execution>
<execution>
<id>zip-digester-binaries</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<verbose>true</verbose>
<fileset>
<!--
This is why we use the TrueZIP plugin: It can seamlessly copy out of or into ZIP files as if they
were normal file system paths. No additional moves and deletes with Antrun are necessary.
-->
<directory>commons/commons-digester-${lib.commons.digester.version}.jar</directory>
<outputDirectory>commons/commons.jar</outputDirectory>
</fileset>
</configuration>
</execution>
<execution>
<id>zip-logging-binaries</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<verbose>true</verbose>
<fileset>
<!--
This is why we use the TrueZIP plugin: It can seamlessly copy out of or into ZIP files as if they
were normal file system paths. No additional moves and deletes with Antrun are necessary.
-->
<directory>commons/commons-logging-${lib.commons.logging.version}.jar</directory>
<outputDirectory>commons/commons.jar</outputDirectory>
</fileset>
</configuration>
</execution>
<execution>
<id>zip-beanutils-sources</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<verbose>true</verbose>
<fileset>
<!--
This is why we use the TrueZIP plugin: It can seamlessly copy out of or into ZIP files as if they
were normal file system paths. No additional moves and deletes with Antrun are necessary.
-->
<directory>commons/commons-beanutils-${lib.commons.beanutils.version}-sources.jar/commons-beanutils-${lib.commons.beanutils.tag}/src/java</directory>
<outputDirectory>commons/commons-src.zip</outputDirectory>
</fileset>
</configuration>
</execution>
<execution>
<id>zip-collections-sources</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<verbose>true</verbose>
<fileset>
<!--
This is why we use the TrueZIP plugin: It can seamlessly copy out of or into ZIP files as if they
were normal file system paths. No additional moves and deletes with Antrun are necessary.
-->
<directory>commons/commons-collections-${lib.commons.collections.version}-sources.jar/commons-collections-${lib.commons.collections.tag}/src/java</directory>
<outputDirectory>commons/commons-src.zip</outputDirectory>
</fileset>
</configuration>
</execution>
<execution>
<id>zip-digester-sources</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<verbose>true</verbose>
<fileset>
<!--
This is why we use the TrueZIP plugin: It can seamlessly copy out of or into ZIP files as if they
were normal file system paths. No additional moves and deletes with Antrun are necessary.
-->
<directory>commons/commons-digester-${lib.commons.digester.version}-sources.jar/commons-digester-${lib.commons.digester.tag}/src/java</directory>
<outputDirectory>commons/commons-src.zip</outputDirectory>
</fileset>
</configuration>
</execution>
<execution>
<id>zip-logging-sources</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<verbose>true</verbose>
<fileset>
<!--
This is why we use the TrueZIP plugin: It can seamlessly copy out of or into ZIP files as if they
were normal file system paths. No additional moves and deletes with Antrun are necessary.
-->
<directory>commons/commons-logging-${lib.commons.logging.version}-sources.jar/commons-logging-${lib.commons.logging.tag}/src/java</directory>
<outputDirectory>commons/commons-src.zip</outputDirectory>
</fileset>
</configuration>
</execution>
</executions>
</plugin>

<profile>
<id>zip-commons-sources</id>
<activation>
<file>
<!-- Only create archive if this file is missing in order to avoid doing it for each build -->
<missing>commons/commons-src.zip</missing>
</file>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>truezip-maven-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>zip-beanutils-sources</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<verbose>true</verbose>
<fileset>
<!--
This is why we use the TrueZIP plugin: It can seamlessly copy out of or into ZIP files as if they
were normal file system paths. No additional moves and deletes with Antrun are necessary.
-->
<directory>commons/commons-beanutils-${lib.commons.beanutils.version}-sources.jar/commons-beanutils-${lib.commons.beanutils.tag}/src/java</directory>
<outputDirectory>commons/commons-src.zip</outputDirectory>
</fileset>
</configuration>
</execution>
<execution>
<id>zip-collections-sources</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<verbose>true</verbose>
<fileset>
<!--
This is why we use the TrueZIP plugin: It can seamlessly copy out of or into ZIP files as if they
were normal file system paths. No additional moves and deletes with Antrun are necessary.
-->
<directory>commons/commons-collections-2.0-sources.jar/commons-collections-collections-2.0/src/java</directory>
<outputDirectory>commons/commons-src.zip</outputDirectory>
</fileset>
</configuration>
</execution>
<execution>
<id>zip-digester-sources</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<verbose>true</verbose>
<fileset>
<!--
This is why we use the TrueZIP plugin: It can seamlessly copy out of or into ZIP files as if they
were normal file system paths. No additional moves and deletes with Antrun are necessary.
-->
<directory>commons/commons-digester-${lib.commons.digester.version}-sources.jar/commons-digester-${lib.commons.digester.tag}/src/java</directory>
<outputDirectory>commons/commons-src.zip</outputDirectory>
</fileset>
</configuration>
</execution>
<execution>
<id>zip-logging-sources</id>
<phase>process-resources</phase>
<goals>
<goal>copy</goal>
</goals>
<configuration>
<verbose>true</verbose>
<fileset>
<!--
This is why we use the TrueZIP plugin: It can seamlessly copy out of or into ZIP files as if they
were normal file system paths. No additional moves and deletes with Antrun are necessary.
-->
<directory>commons/commons-logging-${lib.commons.logging.version}-sources.jar/commons-logging-${lib.commons.logging.tag}/src/java</directory>
<outputDirectory>commons/commons-src.zip</outputDirectory>
</fileset>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<configuration>
<filesets>
<fileset>
<directory>.</directory>
<includes>
<include>ant/**</include>
<include>commons/**</include>
<include>jarjar/**</include>
<include>jdiff/**</include>
<include>junit/**</include>
<include>regexp/**</include>
<include>saxon/**</include>
</includes>
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</plugin>

<!--
TODO:
- Add profile 'clean-libs' to make Maven Clean delete downloads & unpacks (should be off by default in order
not to waste time for re-downloading things like Ant after a simple 'mvn clean').
- Add libx (for now, then finally lib) to .gitignore
-->
</profiles>
</plugins>
</build>

</project>

+ 44
- 0
pom.xml View File

@@ -18,10 +18,14 @@
<lib.regexp.version>1.2</lib.regexp.version>
<lib.commons.beanutils.version>1.4</lib.commons.beanutils.version>
<lib.commons.beanutils.tag>BEANUTILS_1_4</lib.commons.beanutils.tag>
<lib.commons.collections.version>2.0</lib.commons.collections.version>
<lib.commons.collections.tag>collections-2.0</lib.commons.collections.tag>
<lib.commons.digester.version>1.3</lib.commons.digester.version>
<lib.commons.digester.tag>DIGESTER_1_3</lib.commons.digester.tag>
<lib.commons.logging.version>1.0.1</lib.commons.logging.version>
<lib.commons.logging.tag>LOGGING_1_0_1</lib.commons.logging.tag>
<asm.version>9.1</asm.version>
<lib.directory>${maven.multiModuleProjectDirectory}/libx</lib.directory>
</properties>

<modules>
@@ -48,7 +52,11 @@
<module>build</module>
<module>run-all-junit-tests</module>
<module>docs</module>

<!-- FYI: These are NOT meant to be sub-modules but a stand-alone projects built and deployed independently. -->
<!--
<module>libx</module>
-->

<!-- create the important artifacts we care about -->
<module>aspectjrt</module>
@@ -186,6 +194,42 @@
<artifactId>maven-help-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<executions>
<execution>
<id>enforce-libraries-exist</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireFilesExist>
<!--
Do NOT insert any line breaks + indentation inside the message, keep it on a single line.
Maven Enforcer does not strip any whitespace or unindent, which looks quite ugly on the console.
-->
<message>
Please go to module subdirectory 'libx' and run 'mvn compile' there. This should take care of downloading all necessary libraries to that directory, where some tests expect them to be.
</message>
<files>
<file>${lib.directory}/ant/bin/ant</file>
<file>${lib.directory}/ant/lib/junit.jar</file>
<file>${lib.directory}/commons/commons.jar</file>
<file>${lib.directory}/jarjar/jarjar-1.3.jar</file>
<file>${lib.directory}/junit/junit.jar</file>
<file>${lib.directory}/regexp/jakarta-regexp-1.2.jar</file>
<file>${lib.directory}/saxon/saxon.jar</file>
</files>
</requireFilesExist>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>

</plugins>

</build>

Loading…
Cancel
Save