]> source.dussan.org Git - aspectj.git/commitdiff
Use Antrun plugin to eliminate javadoc version number in HTML
authorAlexander Kriegisch <Alexander@Kriegisch.name>
Sat, 17 Feb 2024 04:37:08 +0000 (11:37 +0700)
committerAlexander Kriegisch <Alexander@Kriegisch.name>
Sat, 17 Feb 2024 04:37:08 +0000 (11:37 +0700)
This is the one issue that cannot be solved regarding reproducible
builds by setting javadoc options, because that header comment is
hard-coded into the JDK with no option to avoid it. I just created an
OpenJDK issue (internal review ID 9076583, not published yet) for it,
but that does not help us today.

Signed-off-by: Alexander Kriegisch <Alexander@Kriegisch.name>
aspectjmatcher/pom.xml
aspectjrt/pom.xml
aspectjtools/pom.xml
aspectjweaver/pom.xml
pom.xml

index ee20f307c96b3c85eed059051cc0fb1038ae8e8c..1c56f1210cc02348450664cd0107c89ab69a6a84 100644 (file)
                                </executions>
                        </plugin>
 
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-antrun-plugin</artifactId>
+                               <executions>
+                                       <!-- Remove javadoc version number from HTML comment to keep website diffs small -->
+                                       <execution>
+                                               <id>filter-javadocs</id>
+                                               <!-- Override default phase 'none' from parent -->
+                                               <phase>package</phase>
+                                       </execution>
+                               </executions>
+                       </plugin>
+
                        <!-- Caveat: Attaching the flattened POM needs packaging=jar, so do not use packaging=pom for this module -->
                        <plugin>
                                <groupId>org.codehaus.mojo</groupId>
index 4377c3e769a37fa9d559e6da8f1aa89cb56430e7..be1bc70597f4798acdc81fabf7c7a954645bfdaf 100644 (file)
                                </executions>
                        </plugin>
 
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-antrun-plugin</artifactId>
+                               <executions>
+                                       <!-- Remove javadoc version number from HTML comment to keep website diffs small -->
+                                       <execution>
+                                               <id>filter-javadocs</id>
+                                               <!-- Override default phase 'none' from parent -->
+                                               <phase>package</phase>
+                                       </execution>
+                               </executions>
+                       </plugin>
+
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-resources-plugin</artifactId>
index 5df90da854dbc002343dba0f41c6720c8c54cf47..a872b1ea7afc68acade24df4e7d08c84cdaa488c 100644 (file)
                                </executions>
                        </plugin>
 
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-antrun-plugin</artifactId>
+                               <executions>
+                                       <!-- Remove javadoc version number from HTML comment to keep website diffs small -->
+                                       <execution>
+                                               <id>filter-javadocs</id>
+                                               <!-- Override default phase 'none' from parent -->
+                                               <phase>package</phase>
+                                       </execution>
+                               </executions>
+                       </plugin>
+
                        <!-- Caveat: Attaching the flattened POM needs packaging=jar, so do not use packaging=pom for this module -->
                        <plugin>
                                <groupId>org.codehaus.mojo</groupId>
index b8ad8cd247dcd767aad251b788a1318bcaeeb6db..9648212550b5628505d8dd8650b9616e4b41edde 100644 (file)
                                </executions>
                        </plugin>
 
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-antrun-plugin</artifactId>
+                               <executions>
+                                       <!-- Remove javadoc version number from HTML comment to keep website diffs small -->
+                                       <execution>
+                                               <id>filter-javadocs</id>
+                                               <!-- Override default phase 'none' from parent -->
+                                               <phase>package</phase>
+                                       </execution>
+                               </executions>
+                       </plugin>
+
                        <plugin>
                                <groupId>org.apache.maven.plugins</groupId>
                                <artifactId>maven-resources-plugin</artifactId>
diff --git a/pom.xml b/pom.xml
index 8855eee7a04e414ee5ae2f995c26c844e810211b..8e0afc598354a9ffcb72cd175d46c7759afc6f3b 100644 (file)
--- a/pom.xml
+++ b/pom.xml
                                                <windowtitle>${project.name} API</windowtitle>
                                        </configuration>
                                </plugin>
+                               <plugin>
+                                       <groupId>org.apache.maven.plugins</groupId>
+                                       <artifactId>maven-antrun-plugin</artifactId>
+                                       <version>3.1.0</version>
+                                       <executions>
+                                               <!--
+                                                       Remove javadoc version number from HTML comment to keep website diffs small.
+
+                                                       Attention: This has no effect on javadocs generated by the 'jar' goal, because they are archived while
+                                                       Maven Javadoc runs, i.e. before this plugin execution kicks in. However, it cleans the javadocs before
+                                                       Maven Resources copies them to aj-build/dist/docs/doc. I.e., they will be clean on the website, if copied
+                                                       from that folder, and also in the installer.
+
+                                                       TODO: In the future, maybe this execution or the whole Antrun plugin can go away, after a JDK feature
+                                                         request I just created (internal review ID 9076583) has been implemented and back-ported into all JDK
+                                                         versions we support for javadoc generation. But if that ever happens, it might take a while.
+                                               -->
+                                               <execution>
+                                                       <id>filter-javadocs</id>
+                                                       <!-- Override phase to 'package' in modules which need to filter javadocs -->
+                                                       <phase>none</phase>
+                                                       <goals>
+                                                               <goal>run</goal>
+                                                       </goals>
+                                                       <configuration>
+                                                               <target>
+                                                                       <!-- See https://ant.apache.org/manual/Tasks/replaceregexp.html -->
+                                                                       <replaceregexp byline="true">
+                                                                               <regexp pattern="^(&lt;!-- Generated by javadoc ).* (--&gt;)$"/>
+                                                                               <substitution expression="\1\2"/>
+                                                                               <fileset dir="${project.build.directory}/apidocs">
+                                                                                       <include name="**/*.html"/>
+                                                                               </fileset>
+                                                                       </replaceregexp>
+                                                               </target>
+                                                       </configuration>
+                                               </execution>
+                                       </executions>
+                               </plugin>
                                <plugin>
                                        <groupId>org.asciidoctor</groupId>
                                        <artifactId>asciidoctor-maven-plugin</artifactId>