From e051a447ccdc836221f54ea59cbac2f527e7caf6 Mon Sep 17 00:00:00 2001 From: Peter Palaga Date: Mon, 21 Oct 2024 11:38:59 +0200 Subject: [PATCH] UpdateExtensionDocPageMojo is broken, fix #6418 --- .../maven/UpdateExtensionDocPageMojo.java | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/UpdateExtensionDocPageMojo.java b/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/UpdateExtensionDocPageMojo.java index 294576f9cc6b..525e78a4cfc0 100644 --- a/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/UpdateExtensionDocPageMojo.java +++ b/tooling/maven-plugin/src/main/java/org/apache/camel/quarkus/maven/UpdateExtensionDocPageMojo.java @@ -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; @@ -87,10 +89,8 @@ public class UpdateExtensionDocPageMojo extends AbstractDocGeneratorMojo { private static final String TOOLTIP_MACRO = "tooltip:%s[%s]"; private static final String MORE_INFO_ABOUT_TYPE_FORMAT = "link:#%s[icon:question-circle[title=More information about the %s format]]"; - // TODO: Revert the default back to false - // https://github.com/apache/camel-quarkus/issues/6418 - @Parameter(defaultValue = "true", property = "camel-quarkus.update-extension-doc-page.skip") - boolean skip = true; + @Parameter(defaultValue = "false", property = "camel-quarkus.update-extension-doc-page.skip") + boolean skip = false; @Parameter(defaultValue = "${project}", readonly = true) MavenProject project; @@ -487,10 +487,9 @@ static List listConfigOptions(Path runtimeModuleDir, Path deployment final JavadocRepository javadocRepository = JavadocMerger.mergeJavadocElements(targetDirectories); final MergedModel mergedModel = ModelMerger.mergeModel(targetDirectories); - for (Entry> extensionConfigRootsEntry : mergedModel - .getConfigRoots().entrySet()) { - for (Entry configRootEntry : extensionConfigRootsEntry.getValue() - .entrySet()) { + for (Entry> extensionConfigRootsEntry : mergedModel.getConfigRoots() + .entrySet()) { + for (Entry configRootEntry : extensionConfigRootsEntry.getValue().entrySet()) { final ConfigRoot configRoot = configRootEntry.getValue(); for (AbstractConfigItem configItem : configRoot.getItems()) { if (configItem instanceof ConfigProperty) { @@ -592,19 +591,18 @@ public static class ConfigItem { public static ConfigItem of(ConfigProperty configDocItem, JavadocRepository javadocRepository, String artifactIdBase) { final Optional 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, @@ -613,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,