Skip to content

Commit

Permalink
UpdateExtensionDocPageMojo is broken, fix #6418
Browse files Browse the repository at this point in the history
  • Loading branch information
ppalaga authored and jamesnetherton committed Oct 25, 2024
1 parent c298c17 commit 456ffa9
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@
import io.quarkus.annotation.processor.documentation.config.merger.JavadocMerger;
import io.quarkus.annotation.processor.documentation.config.merger.JavadocRepository;
import io.quarkus.annotation.processor.documentation.config.merger.MergedModel;
import io.quarkus.annotation.processor.documentation.config.merger.MergedModel.ConfigRootKey;
import io.quarkus.annotation.processor.documentation.config.merger.ModelMerger;
import io.quarkus.annotation.processor.documentation.config.model.AbstractConfigItem;
import io.quarkus.annotation.processor.documentation.config.model.ConfigProperty;
import io.quarkus.annotation.processor.documentation.config.model.ConfigProperty.PropertyPath;
import io.quarkus.annotation.processor.documentation.config.model.ConfigRoot;
import io.quarkus.annotation.processor.documentation.config.model.Extension;
import io.quarkus.annotation.processor.documentation.config.model.JavadocElements.JavadocElement;
Expand Down Expand Up @@ -485,10 +487,9 @@ static List<ConfigItem> listConfigOptions(Path runtimeModuleDir, Path deployment

final JavadocRepository javadocRepository = JavadocMerger.mergeJavadocElements(targetDirectories);
final MergedModel mergedModel = ModelMerger.mergeModel(targetDirectories);
for (Entry<Extension, Map<MergedModel.ConfigRootKey, ConfigRoot>> extensionConfigRootsEntry : mergedModel
.getConfigRoots().entrySet()) {
for (Entry<MergedModel.ConfigRootKey, ConfigRoot> configRootEntry : extensionConfigRootsEntry.getValue()
.entrySet()) {
for (Entry<Extension, Map<ConfigRootKey, ConfigRoot>> extensionConfigRootsEntry : mergedModel.getConfigRoots()
.entrySet()) {
for (Entry<ConfigRootKey, ConfigRoot> configRootEntry : extensionConfigRootsEntry.getValue().entrySet()) {
final ConfigRoot configRoot = configRootEntry.getValue();
for (AbstractConfigItem configItem : configRoot.getItems()) {
if (configItem instanceof ConfigProperty) {
Expand Down Expand Up @@ -590,19 +591,18 @@ public static class ConfigItem {

public static ConfigItem of(ConfigProperty configDocItem, JavadocRepository javadocRepository, String artifactIdBase) {
final Optional<JavadocElement> javadoc = javadocRepository
.getElement(configDocItem.getSourceClass(), configDocItem.getSourceName());
.getElement(configDocItem.getSourceType(), configDocItem.getSourceElementName());
final PropertyPath itemPath = configDocItem.getPath();
if (javadoc.isEmpty()) {
throw new IllegalStateException("No JavaDoc for " + configDocItem.getPath() + " alias "
+ configDocItem.getSourceClass() + "#" + configDocItem.getSourceName());
throw new IllegalStateException("No JavaDoc for " + itemPath.property() + " alias "
+ configDocItem.getSourceType() + "#" + configDocItem.getSourceElementName());
}
final String adocSource = LINK_PATTERN.matcher(javadoc.get().description()).replaceAll("xref:$1.adoc");
final String illustration = configDocItem.getPhase().isFixedAtBuildTime() ? "icon:lock[title=Fixed at build time]"
: "";
final TypeInfo typeInfo = typeContent(configDocItem, javadocRepository, true, artifactIdBase);
return new ConfigItem(
// TODO: Fix to use the correct value
// https://github.com/apache/camel-quarkus/issues/6418
configDocItem.getPath().toString(),
itemPath.property(),
illustration,
adocSource,
typeInfo.description,
Expand All @@ -611,7 +611,7 @@ public static ConfigItem of(ConfigProperty configDocItem, JavadocRepository java
configDocItem.getDefaultValue(),
configDocItem.isOptional(),
javadoc.get().since(),
configDocItem.getEnvironmentVariable());
itemPath.environmentVariable());
}

static TypeInfo typeContent(ConfigProperty configProperty, JavadocRepository javadocRepository,
Expand Down

0 comments on commit 456ffa9

Please sign in to comment.