Skip to content

Commit d3e99ba

Browse files
authored
Merge pull request #44623 from gsmet/doc-improvements
Config Doc - Assorted improvements related to Kubernetes extensions
2 parents a5e8b1c + 51078fa commit d3e99ba

File tree

12 files changed

+55
-18
lines changed

12 files changed

+55
-18
lines changed

core/deployment/pom.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,9 @@
225225
<version>${project.version}</version>
226226
</path>
227227
</annotationProcessorPaths>
228+
<compilerArgs>
229+
<arg>-AsplitOnConfigRootDescription=true</arg>
230+
</compilerArgs>
228231
</configuration>
229232
</execution>
230233
</executions>

core/processor/src/main/java/io/quarkus/annotation/processor/ExtensionAnnotationProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import io.quarkus.annotation.processor.util.Config;
2828
import io.quarkus.annotation.processor.util.Utils;
2929

30-
@SupportedOptions({ Options.LEGACY_CONFIG_ROOT, Options.GENERATE_DOC })
30+
@SupportedOptions({ Options.LEGACY_CONFIG_ROOT, Options.GENERATE_DOC, Options.SPLIT_ON_CONFIG_ROOT_DESCRIPTION })
3131
public class ExtensionAnnotationProcessor extends AbstractProcessor {
3232

3333
private static final String DEBUG = "debug-extension-annotation-processor";

core/processor/src/main/java/io/quarkus/annotation/processor/Options.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ public final class Options {
44

55
public static final String LEGACY_CONFIG_ROOT = "legacyConfigRoot";
66
public static final String GENERATE_DOC = "generateDoc";
7+
public static final String SPLIT_ON_CONFIG_ROOT_DESCRIPTION = "splitOnConfigRootDescription";
78
}

core/processor/src/main/java/io/quarkus/annotation/processor/documentation/config/model/Extension.java

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,29 @@
55
import com.fasterxml.jackson.annotation.JsonIgnore;
66

77
public record Extension(String groupId, String artifactId, String name,
8-
NameSource nameSource, boolean commonOrInternal, String guideUrl, boolean detected) implements Comparable<Extension> {
8+
NameSource nameSource, boolean commonOrInternal, String guideUrl,
9+
boolean splitOnConfigRootDescription, boolean detected) implements Comparable<Extension> {
910

1011
private static final String ARTIFACT_COMMON_SUFFIX = "-common";
1112
private static final String ARTIFACT_INTERNAL_SUFFIX = "-internal";
13+
private static final String NAME_COMMON_SUFFIX = "Common";
14+
private static final String NAME_INTERNAL_SUFFIX = "Internal";
15+
private static final String NAME_SEPARATOR = " - ";
1216

1317
public static Extension of(String groupId, String artifactId, String name,
14-
NameSource nameSource, String guideUrl) {
18+
NameSource nameSource, String guideUrl, boolean splitOnConfigRootDescription) {
1519
boolean commonOrInternal = artifactId.endsWith(ARTIFACT_COMMON_SUFFIX) || artifactId.endsWith(ARTIFACT_INTERNAL_SUFFIX);
1620
if (commonOrInternal) {
1721
nameSource = nameSource == NameSource.EXTENSION_METADATA ? NameSource.EXTENSION_METADATA_COMMON_INTERNAL
1822
: (nameSource == NameSource.POM_XML ? NameSource.POM_XML_COMMON_INTERNAL : nameSource);
1923
}
2024

21-
return new Extension(groupId, artifactId, name, nameSource, commonOrInternal, guideUrl, true);
25+
return new Extension(groupId, artifactId, name, nameSource, commonOrInternal, guideUrl, splitOnConfigRootDescription,
26+
true);
2227
}
2328

2429
public static Extension createNotDetected() {
25-
return new Extension("not.detected", "not.detected", "Not detected", NameSource.NONE, false, null, false);
30+
return new Extension("not.detected", "not.detected", "Not detected", NameSource.NONE, false, null, false, false);
2631
}
2732

2833
@Override
@@ -57,32 +62,39 @@ public boolean isMixedModule() {
5762
return "io.quarkus".equals(groupId) && ("quarkus-core".equals(artifactId) || "quarkus-messaging".equals(artifactId));
5863
}
5964

60-
@JsonIgnore
61-
public boolean splitOnConfigRootDescription() {
62-
// quarkus-core has a lot of config roots and they are very specific
63-
// we need to split them properly in the generated documentation
64-
return "io.quarkus".equals(groupId) && "quarkus-core".equals(artifactId);
65-
}
66-
6765
@JsonIgnore
6866
public Extension normalizeCommonOrInternal() {
6967
if (!commonOrInternal()) {
7068
return this;
7169
}
7270

7371
String normalizedArtifactId = artifactId;
72+
String normalizedName = name;
7473
if (artifactId.endsWith(ARTIFACT_COMMON_SUFFIX)) {
7574
normalizedArtifactId = artifactId.substring(0, artifactId.length() - ARTIFACT_COMMON_SUFFIX.length());
75+
76+
if (name != null && name.endsWith(NAME_COMMON_SUFFIX)) {
77+
normalizedName = name.substring(0, name.length() - NAME_COMMON_SUFFIX.length());
78+
}
7679
}
7780
if (artifactId.endsWith(ARTIFACT_INTERNAL_SUFFIX)) {
7881
normalizedArtifactId = artifactId.substring(0, artifactId.length() - ARTIFACT_INTERNAL_SUFFIX.length());
82+
83+
if (name != null && name.endsWith(NAME_INTERNAL_SUFFIX)) {
84+
normalizedName = name.substring(0, name.length() - NAME_INTERNAL_SUFFIX.length());
85+
}
86+
}
87+
88+
if (normalizedName != null && normalizedName.endsWith(NAME_SEPARATOR)) {
89+
normalizedName = normalizedName.substring(0, normalizedName.length() - NAME_SEPARATOR.length());
7990
}
8091

81-
if (normalizedArtifactId.equals(artifactId)) {
92+
if (normalizedArtifactId.equals(artifactId) && Objects.equals(normalizedName, name)) {
8293
return this;
8394
}
8495

85-
return new Extension(groupId, normalizedArtifactId, name, nameSource, commonOrInternal, null, detected);
96+
return new Extension(groupId, normalizedArtifactId, normalizedName, nameSource, commonOrInternal, null,
97+
splitOnConfigRootDescription, detected);
8698
}
8799

88100
@Override

core/processor/src/main/java/io/quarkus/annotation/processor/util/ExtensionUtil.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
import org.w3c.dom.Node;
1919
import org.w3c.dom.NodeList;
2020

21+
import io.quarkus.annotation.processor.Options;
2122
import io.quarkus.annotation.processor.documentation.config.model.Extension;
2223
import io.quarkus.annotation.processor.documentation.config.model.Extension.NameSource;
2324
import io.quarkus.annotation.processor.documentation.config.model.ExtensionModule;
@@ -151,7 +152,9 @@ private ExtensionModule getExtensionModuleFromPom(Path pom, Document doc) {
151152
}
152153

153154
return ExtensionModule.of(groupId, artifactId, moduleType,
154-
Extension.of(groupId, extensionArtifactId, extensionName, extensionNameSource, guideUrl));
155+
Extension.of(groupId, extensionArtifactId, extensionName, extensionNameSource, guideUrl,
156+
Boolean.parseBoolean(
157+
processingEnv.getOptions().getOrDefault(Options.SPLIT_ON_CONFIG_ROOT_DESCRIPTION, "false"))));
155158
}
156159

157160
private Optional<ExtensionMetadata> getExtensionMetadata() {

core/runtime/pom.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,9 @@
294294
<version>${project.version}</version>
295295
</path>
296296
</annotationProcessorPaths>
297+
<compilerArgs>
298+
<arg>-AsplitOnConfigRootDescription=true</arg>
299+
</compilerArgs>
297300
</configuration>
298301
</execution>
299302
</executions>

extensions/kubernetes/vanilla/deployment/pom.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
<modelVersion>4.0.0</modelVersion>
1111

1212
<artifactId>quarkus-kubernetes-deployment</artifactId>
13-
<name>Quarkus - Kubernetes - Vanilla - Deployment</name>
13+
<name>Quarkus - Kubernetes - Deployment</name>
1414

1515
<dependencies>
1616
<dependency>
@@ -132,6 +132,9 @@
132132
<version>${project.version}</version>
133133
</path>
134134
</annotationProcessorPaths>
135+
<compilerArgs>
136+
<arg>-AsplitOnConfigRootDescription=true</arg>
137+
</compilerArgs>
135138
</configuration>
136139
</execution>
137140
</executions>

extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KnativeConfig.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
import io.smallrye.config.ConfigMapping;
1010
import io.smallrye.config.WithDefault;
1111

12+
/**
13+
* Knative
14+
*/
1215
@ConfigMapping(prefix = "quarkus.knative")
1316
@ConfigRoot(phase = ConfigPhase.BUILD_TIME)
1417
public interface KnativeConfig extends PlatformConfiguration {

extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/KubernetesConfig.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
import io.smallrye.config.ConfigMapping;
1717
import io.smallrye.config.WithDefault;
1818

19+
/**
20+
* Kubernetes
21+
*/
1922
@ConfigMapping(prefix = "quarkus.kubernetes")
2023
@ConfigRoot(phase = ConfigPhase.BUILD_TIME)
2124
public interface KubernetesConfig extends PlatformConfiguration {

extensions/kubernetes/vanilla/deployment/src/main/java/io/quarkus/kubernetes/deployment/OpenShiftConfig.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
import io.smallrye.config.ConfigMapping;
1818
import io.smallrye.config.WithDefault;
1919

20+
/**
21+
* OpenShift
22+
*/
2023
@ConfigMapping(prefix = "quarkus.openshift")
2124
@ConfigRoot(phase = ConfigPhase.BUILD_TIME)
2225
public interface OpenShiftConfig extends PlatformConfiguration {

0 commit comments

Comments
 (0)