This is an automated email from the ASF dual-hosted git repository.

vy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/logging-log4j2.git


The following commit(s) were added to refs/heads/main by this push:
     new 5568378392 Fix Log4j Docgen execution
5568378392 is described below

commit 55683783928e2ecf5a958ae24765b9961317104d
Author: Volkan Yazıcı <vol...@yazi.ci>
AuthorDate: Wed May 22 16:18:24 2024 +0200

    Fix Log4j Docgen execution
---
 log4j-core-test/pom.xml                 |  1 +
 log4j-core/pom.xml                      |  2 +-
 log4j-layout-template-json-test/pom.xml |  1 +
 log4j-osgi-test/pom.xml                 |  1 +
 log4j-parent/pom.xml                    | 40 +++++++++++++++++++++++++++++----
 5 files changed, 40 insertions(+), 5 deletions(-)

diff --git a/log4j-core-test/pom.xml b/log4j-core-test/pom.xml
index e893432684..ec83eae417 100644
--- a/log4j-core-test/pom.xml
+++ b/log4j-core-test/pom.xml
@@ -32,6 +32,7 @@
   <description>The Apache Log4j Implementation Tests</description>
 
   <properties>
+    <log4j.docgen.skip>true</log4j.docgen.skip>
     <!-- Ignore less important (high rank) bugs for test artifacts -->
     <spotbugs.maxRank>9</spotbugs.maxRank>
 
diff --git a/log4j-core/pom.xml b/log4j-core/pom.xml
index 98a84a0546..43a7a7af4d 100644
--- a/log4j-core/pom.xml
+++ b/log4j-core/pom.xml
@@ -71,7 +71,7 @@
       org.fusesource.jansi;transitive=false,
     </bnd-extra-module-options>
 
-    
<log4j.docgen.pluginDescriptorsDir.effective>${log4j.docgen.pluginDescriptorsDir.phase1}</log4j.docgen.pluginDescriptorsDir.effective>
+    
<log4j.docgen.pluginDescriptorsDir>${log4j.docgen.pluginDescriptorsDir.phase1}</log4j.docgen.pluginDescriptorsDir>
   </properties>
 
   <dependencies>
diff --git a/log4j-layout-template-json-test/pom.xml 
b/log4j-layout-template-json-test/pom.xml
index a87e8d1874..68df2d6d44 100644
--- a/log4j-layout-template-json-test/pom.xml
+++ b/log4j-layout-template-json-test/pom.xml
@@ -30,6 +30,7 @@
   <name>Tests for the JSON Template Layout of Apache Log4j</name>
 
   <properties>
+    <log4j.docgen.skip>true</log4j.docgen.skip>
     <log4jParentDir>${basedir}/..</log4jParentDir>
 
     <!--
diff --git a/log4j-osgi-test/pom.xml b/log4j-osgi-test/pom.xml
index 20722f8542..3c8cad3374 100644
--- a/log4j-osgi-test/pom.xml
+++ b/log4j-osgi-test/pom.xml
@@ -32,6 +32,7 @@
   <description>The Apache Log4j OSGi tests</description>
 
   <properties>
+    <log4j.docgen.skip>true</log4j.docgen.skip>
     <module.name>org.apache.logging.log4j.osgi</module.name>
     <bnd.baseline.skip>true</bnd.baseline.skip>
     <maven.deploy.skip>true</maven.deploy.skip>
diff --git a/log4j-parent/pom.xml b/log4j-parent/pom.xml
index a66645dd1d..3a954328f0 100644
--- a/log4j-parent/pom.xml
+++ b/log4j-parent/pom.xml
@@ -1043,19 +1043,21 @@
       </activation>
 
       <properties>
-        
<log4j.docgen.pluginDescriptorsDir.effective>${log4j.docgen.pluginDescriptorsDir.phase2}</log4j.docgen.pluginDescriptorsDir.effective>
+        
<log4j.docgen.pluginDescriptorsDir.skipped>${maven.multiModuleProjectDirectory}/target/plugin-descriptors/skipped</log4j.docgen.pluginDescriptorsDir.skipped>
+        
<log4j.docgen.pluginDescriptorsDir>${log4j.docgen.pluginDescriptorsDir.phase2}</log4j.docgen.pluginDescriptorsDir>
       </properties>
 
       <build>
         <plugins>
 
-          <!-- Generate a random target package for `Log4jPlugins.java` -->
           <plugin>
             <groupId>org.codehaus.mojo</groupId>
             <artifactId>build-helper-maven-plugin</artifactId>
             <executions>
+
+              <!-- Generate a random target package for `Log4jPlugins.java` -->
               <execution>
-                <id>generate-plugin-package-for-tests</id>
+                <id>define-log4jPluginPackageForTests</id>
                 <goals>
                   <goal>bsh-property</goal>
                 </goals>
@@ -1081,6 +1083,36 @@
                   ]]></source>
                 </configuration>
               </execution>
+
+              <!-- This is a workaround to effectively disable Log4j Docgen 
`DescriptorGenerator` plugin processor.
+                   Once Log4j Docgen `>0.9.0` is released (containing the new 
`log4j.docgen.skip` argument to `DescriptorGenerator`):
+                   1. Remove this `build-helper:bsh-property` execution
+                   2. Remove the `log4j.docgen.pluginDescriptorsDir.skipped` 
property
+                   3. In the `PluginProcessor` execution configuration
+                      - Add `-Alog4j.docgen.skip=${log4j.docgen.skip}` argument
+                      - Set 
`-Alog4j.docgen.descriptorFilePath=${log4j.docgen.pluginDescriptorsDir}/${project.artifactId}-plugins.xml`
 argument -->
+              <execution>
+                <id>define-log4jDocgenDescriptorFilepath</id>
+                <goals>
+                  <goal>bsh-property</goal>
+                </goals>
+                <phase>process-resources</phase>
+                <configuration>
+                  <properties>
+                    <property>log4jDocgenDescriptorFilepath</property>
+                  </properties>
+                  <source><![CDATA[
+                    Properties properties = project.getProperties();
+                    String pluginDescriptorsDir = 
"true".equals(properties.getProperty("log4j.docgen.skip"))
+                            ? 
properties.getProperty("log4j.docgen.pluginDescriptorsDir.skipped")
+                            : 
properties.getProperty("log4j.docgen.pluginDescriptorsDir");
+                    String log4jDocgenDescriptorFilepath = 
String.format("%s/%s-plugins.xml", new Object[] {
+                        pluginDescriptorsDir, project.getArtifactId()
+                    });
+                  ]]></source>
+                </configuration>
+              </execution>
+
             </executions>
           </plugin>
 
@@ -1108,7 +1140,7 @@
               </annotationProcessorPaths>
               <compilerArgs combine.children="append">
                 <!-- Provide 
`org.apache.logging.log4j.docgen.processor.DescriptorGenerator` arguments: -->
-                
<arg>-Alog4j.docgen.descriptorFilePath=${log4j.docgen.pluginDescriptorsDir.effective}/${project.artifactId}-plugins.xml</arg>
+                
<arg>-Alog4j.docgen.descriptorFilePath=${log4jDocgenDescriptorFilepath}</arg>
                 <arg>-Alog4j.docgen.groupId=${project.groupId}</arg>
                 <arg>-Alog4j.docgen.artifactId=${project.artifactId}</arg>
                 <arg>-Alog4j.docgen.version=${project.version}</arg>

Reply via email to