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-log4j-tools.git
The following commit(s) were added to refs/heads/main by this push:
new f400131 Add `log4j.docgen.skip` argument to the `DescriptorGenerator`
plugin processor
f400131 is described below
commit f4001312f91f6b380103fe75d03e21c451200e53
Author: Volkan Yazıcı <[email protected]>
AuthorDate: Wed May 22 15:14:37 2024 +0200
Add `log4j.docgen.skip` argument to the `DescriptorGenerator` plugin
processor
---
.../logging/log4j/docgen/processor/DescriptorGenerator.java | 9 +++++++++
src/changelog/.0.x.x/add-processor-skip.xml | 7 +++++++
src/site/antora/modules/ROOT/pages/log4j-docgen.adoc | 1 +
3 files changed, 17 insertions(+)
diff --git
a/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/processor/DescriptorGenerator.java
b/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/processor/DescriptorGenerator.java
index cd82d7b..ea09de4 100644
---
a/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/processor/DescriptorGenerator.java
+++
b/log4j-docgen/src/main/java/org/apache/logging/log4j/docgen/processor/DescriptorGenerator.java
@@ -87,6 +87,7 @@ import org.jspecify.annotations.Nullable;
@ServiceProvider(value = Processor.class, resolution = Resolution.OPTIONAL)
@SupportedAnnotationTypes({"org.apache.logging.log4j.core.config.plugins.*",
"org.apache.logging.log4j.plugins.*"})
@SupportedOptions({
+ DescriptorGenerator.SKIP_KEY,
DescriptorGenerator.DESCRIPTOR_FILE_PATH_OPTION_KEY,
DescriptorGenerator.GROUP_ID_OPTION_KEY,
DescriptorGenerator.ARTIFACT_ID_OPTION_KEY,
@@ -98,6 +99,8 @@ import org.jspecify.annotations.Nullable;
@NullMarked
public class DescriptorGenerator extends AbstractProcessor {
+ static final String SKIP_KEY = "log4j.docgen.skip";
+
static final String DESCRIPTOR_FILE_PATH_OPTION_KEY =
"log4j.docgen.descriptorFilePath";
static final String GROUP_ID_OPTION_KEY = "log4j.docgen.groupId";
@@ -141,6 +144,8 @@ public class DescriptorGenerator extends AbstractProcessor {
private final Set<TypeElement> scalarTypesToDocument = new HashSet<>();
+ private boolean skipped;
+
private Predicate<String> classNameFilter;
private PluginSet pluginSet;
@@ -170,6 +175,7 @@ public class DescriptorGenerator extends AbstractProcessor {
@Override
public synchronized void init(final ProcessingEnvironment processingEnv) {
super.init(processingEnv);
+ skipped = Boolean.parseBoolean(getOption(processingEnv, SKIP_KEY));
classNameFilter = createClassNameFilter(processingEnv);
pluginSet = createPluginSet(processingEnv);
descriptorFilePath = Path.of(requireOption(processingEnv,
DESCRIPTOR_FILE_PATH_OPTION_KEY));
@@ -252,6 +258,9 @@ public class DescriptorGenerator extends AbstractProcessor {
@Override
public boolean process(final Set<? extends TypeElement> unused, final
RoundEnvironment roundEnv) {
+ if (skipped) {
+ return false;
+ }
// First step: document plugins
populatePluginTypesToDocument(roundEnv);
pluginTypesToDocument.forEach(this::addPluginDocumentation);
diff --git a/src/changelog/.0.x.x/add-processor-skip.xml
b/src/changelog/.0.x.x/add-processor-skip.xml
new file mode 100644
index 0000000..e26d8f9
--- /dev/null
+++ b/src/changelog/.0.x.x/add-processor-skip.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<entry xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="https://logging.apache.org/xml/ns"
+ xsi:schemaLocation="https://logging.apache.org/xml/ns
https://logging.apache.org/xml/ns/log4j-changelog-0.xsd"
+ type="added">
+ <description format="asciidoc">Add `log4j.docgen.skip` argument to the
`DescriptorGenerator` plugin processor</description>
+</entry>
diff --git a/src/site/antora/modules/ROOT/pages/log4j-docgen.adoc
b/src/site/antora/modules/ROOT/pages/log4j-docgen.adoc
index 2acc46a..d78e02c 100644
--- a/src/site/antora/modules/ROOT/pages/log4j-docgen.adoc
+++ b/src/site/antora/modules/ROOT/pages/log4j-docgen.adoc
@@ -78,6 +78,7 @@ Users are recommended to integrate this annotation processor
into their build:
</annotationProcessorPaths>
<compilerArgs combine.children="append">
<!-- Provide
`org.apache.logging.log4j.docgen.processor.DescriptorGenerator` arguments: -->
+ <arg>-Alog4j.docgen.skip=false</arg><!-- optional (defaults to `false`)
-->
<arg>-Alog4j.docgen.descriptorFilePath=${project.build.directory}/${project.artifactId}-plugins.xml</arg>
<arg>-Alog4j.docgen.groupId=${project.groupId}</arg>
<arg>-Alog4j.docgen.artifactId=${project.artifactId}</arg>