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

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


The following commit(s) were added to refs/heads/2.x by this push:
     new 77359b3f63 Fix Log4j Docgen execution
77359b3f63 is described below

commit 77359b3f639089765f0b914d3566779c475de6e9
Author: Volkan Yazıcı <[email protected]>
AuthorDate: Wed May 22 15:22:33 2024 +0200

    Fix Log4j Docgen execution
---
 log4j-core-test/pom.xml                 |  1 +
 log4j-layout-template-json-test/pom.xml |  1 +
 log4j-osgi-test/pom.xml                 |  1 +
 log4j-parent/pom.xml                    | 35 ++++++++++++++++++++++++++++++++-
 log4j-perf-test/pom.xml                 |  1 +
 pom.xml                                 | 21 ++++++++++++--------
 6 files changed, 51 insertions(+), 9 deletions(-)

diff --git a/log4j-core-test/pom.xml b/log4j-core-test/pom.xml
index f005dc8a95..7c99ce2d50 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-layout-template-json-test/pom.xml 
b/log4j-layout-template-json-test/pom.xml
index ed7b188b13..7031fd4d80 100644
--- a/log4j-layout-template-json-test/pom.xml
+++ b/log4j-layout-template-json-test/pom.xml
@@ -32,6 +32,7 @@
 
   <properties>
 
+    <log4j.docgen.skip>true</log4j.docgen.skip>
     <bnd.baseline.skip>true</bnd.baseline.skip>
     <maven.deploy.skip>true</maven.deploy.skip>
     <sign.skip>true</sign.skip>
diff --git a/log4j-osgi-test/pom.xml b/log4j-osgi-test/pom.xml
index 19dcd37e65..5d592e8d8d 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 aa2ac95d92..e8da1b50d1 100644
--- a/log4j-parent/pom.xml
+++ b/log4j-parent/pom.xml
@@ -1167,6 +1167,39 @@
       <build>
         <plugins>
 
+          <!-- 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 -->
+          <plugin>
+            <groupId>org.codehaus.mojo</groupId>
+            <artifactId>build-helper-maven-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>define-log4j.docgen.descriptorFilePath</id>
+                <goals>
+                  <goal>bsh-property</goal>
+                </goals>
+                <phase>process-resources</phase>
+                <configuration>
+                  <properties>
+                    <property>log4j.docgen.descriptorFilePath</property>
+                  </properties>
+                  <source><![CDATA[properties = project.getProperties();
+skipped = properties.getProperty("log4j.docgen.skip");
+pluginDescriptorsDir = "true".equals(skipped)
+        ? properties.getProperty("log4j.docgen.pluginDescriptorsDir.skipped")
+        : properties.getProperty("log4j.docgen.pluginDescriptorsDir");
+log4j.docgen.descriptorFilePath = pluginDescriptorsDir + '/' + 
project.getArtifactId() + "-plugins.xml";
+]]></source>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+
           <!-- We will compile sources as usual and make a second pass to 
process plugins, because...
                `log4j-core` contains `PluginProcessor`, that is responsible 
for generating `Log4j2Plugins.dat` from `@Plugin`-annotated members.
                `log4j-core` also contains `@Plugin`-annotated members too.
@@ -1228,7 +1261,7 @@
                   </annotationProcessors>
                   <compilerArgs>
                     <!-- Provide 
`org.apache.logging.log4j.docgen.processor.DescriptorGenerator` arguments: -->
-                    
<arg>-Alog4j.docgen.descriptorFilePath=${log4j.docgen.pluginDescriptorsDir}/${project.artifactId}-plugins.xml</arg>
+                    
<arg>-Alog4j.docgen.descriptorFilePath=${log4j.docgen.descriptorFilePath}</arg>
                     <arg>-Alog4j.docgen.groupId=${project.groupId}</arg>
                     <arg>-Alog4j.docgen.artifactId=${project.artifactId}</arg>
                     <arg>-Alog4j.docgen.version=${project.version}</arg>
diff --git a/log4j-perf-test/pom.xml b/log4j-perf-test/pom.xml
index 1bbd3ea453..79c04c33fc 100644
--- a/log4j-perf-test/pom.xml
+++ b/log4j-perf-test/pom.xml
@@ -31,6 +31,7 @@
 
   <properties>
     <uberjar.name>benchmarks</uberjar.name>
+    <log4j.docgen.skip>true</log4j.docgen.skip>
     <bnd.baseline.skip>true</bnd.baseline.skip>
     <maven.test.skip>true</maven.test.skip>
     <maven.deploy.skip>true</maven.deploy.skip>
diff --git a/pom.xml b/pom.xml
index ac79f1bd05..1744177b73 100644
--- a/pom.xml
+++ b/pom.xml
@@ -355,6 +355,7 @@
     <!-- Directories where `log4j-docgen` annotation processor will emit files 
to -->
     
<log4j.docgen.pluginDescriptorsDir.phase1>${maven.multiModuleProjectDirectory}/target/plugin-descriptors/phase1</log4j.docgen.pluginDescriptorsDir.phase1>
     
<log4j.docgen.pluginDescriptorsDir.phase2>${maven.multiModuleProjectDirectory}/target/plugin-descriptors/phase2</log4j.docgen.pluginDescriptorsDir.phase2>
+    
<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>
@@ -825,14 +826,18 @@
             <phase>pre-site</phase>
             <configuration>
               
<templateDirectory>${project.basedir}/src/docgen</templateDirectory>
-              <indexTemplate>
-                <source>index.adoc.ftl</source>
-                
<target>${project.build.directory}/generated-site/antora/modules/ROOT/pages/plugin-reference.adoc</target>
-              </indexTemplate>
-              <typeTemplate>
-                <source>type.adoc.ftl</source>
-                
<target>${project.build.directory}/generated-site/antora/modules/ROOT/pages/_plugin-reference/%g-%a-%c.adoc</target>
-              </typeTemplate>
+              <indexTemplates>
+                <template>
+                  <source>index.adoc.ftl</source>
+                  
<target>${project.build.directory}/generated-site/antora/modules/ROOT/pages/plugin-reference.adoc</target>
+                </template>
+              </indexTemplates>
+              <typeTemplates>
+                <template>
+                  <source>type.adoc.ftl</source>
+                  
<target>${project.build.directory}/generated-site/antora/modules/ROOT/pages/_plugin-reference/%g-%a-%c.adoc</target>
+                </template>
+              </typeTemplates>
             </configuration>
           </execution>
 

Reply via email to