This is an automated email from the ASF dual-hosted git repository.
snazy pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/polaris.git
The following commit(s) were added to refs/heads/main by this push:
new 4992cbe9 Generate docs for Quarkus configs (#742)
4992cbe9 is described below
commit 4992cbe9275321b21d30e17305c07e405394851b
Author: Robert Stupp <[email protected]>
AuthorDate: Tue Jan 14 13:53:25 2025 +0100
Generate docs for Quarkus configs (#742)
... also fixes an issue when resolving _inner_ classes leading to `$` to be
replaced with `.` (not 100% conformant, but works).
The generated docs can currently only be inspected after running `./gradlew
:polaris-config-docs-site:generateDocs` in
`tools/config-docs/site/build/markdown-docs`.
---
.../polaris/docs/generator/SmallRyeConfigs.java | 20 ++++++++++++--------
tools/config-docs/site/build.gradle.kts | 5 ++++-
2 files changed, 16 insertions(+), 9 deletions(-)
diff --git
a/tools/config-docs/generator/src/main/java/org/apache/polaris/docs/generator/SmallRyeConfigs.java
b/tools/config-docs/generator/src/main/java/org/apache/polaris/docs/generator/SmallRyeConfigs.java
index 3895f174..f655c722 100644
---
a/tools/config-docs/generator/src/main/java/org/apache/polaris/docs/generator/SmallRyeConfigs.java
+++
b/tools/config-docs/generator/src/main/java/org/apache/polaris/docs/generator/SmallRyeConfigs.java
@@ -19,6 +19,7 @@
package org.apache.polaris.docs.generator;
import static java.util.Arrays.asList;
+import static java.util.Objects.requireNonNull;
import io.smallrye.config.ConfigMapping;
import io.smallrye.config.ConfigMappingInterface;
@@ -70,17 +71,21 @@ public class SmallRyeConfigs {
return sb.toString();
}
+ TypeElement getTypeElement(String typeName) {
+ var elem = env.getElementUtils().getTypeElement(typeName);
+ if (elem == null) {
+ elem = env.getElementUtils().getTypeElement(typeName.replace('$', '.'));
+ }
+ return requireNonNull(elem, "Could not find type '" + typeName + "'");
+ }
+
public SmallRyeConfigMappingInfo getConfigMappingInfo(Class<?> type) {
var typeName = type.getName();
var info = configMappingByType.get(typeName);
if (info == null) {
info = new SmallRyeConfigMappingInfo("");
configMappingByType.put(typeName, info);
- TypeElement elem = env.getElementUtils().getTypeElement(typeName);
- if (elem == null) {
- throw new NullPointerException("Type " + typeName + " not found");
- }
- elem.accept(visitor(), null);
+ getTypeElement(typeName).accept(visitor(), null);
}
return info;
}
@@ -144,8 +149,7 @@ public class SmallRyeConfigs {
remaining.addAll(asList(superType.getSuperTypes()));
- var superTypeElement =
-
env.getElementUtils().getTypeElement(superType.getInterfaceType().getName());
+ var superTypeElement =
getTypeElement(superType.getInterfaceType().getName());
mappingInfo.processType(env, superType, superTypeElement);
}
@@ -164,7 +168,7 @@ public class SmallRyeConfigs {
continue;
}
- var superTypeElement =
env.getElementUtils().getTypeElement(c.getName());
+ var superTypeElement = getTypeElement(c.getName());
mappingInfo.processType(env, configMappingInterface,
superTypeElement);
if (c.getSuperclass() != null) {
diff --git a/tools/config-docs/site/build.gradle.kts
b/tools/config-docs/site/build.gradle.kts
index 994f5ad2..6d2dd2fb 100644
--- a/tools/config-docs/site/build.gradle.kts
+++ b/tools/config-docs/site/build.gradle.kts
@@ -23,7 +23,10 @@ plugins {
description = "Polaris site - reference docs"
-val genProjectPaths = listOf<String>()
+val genProjectPaths = listOf(
+ ":polaris-quarkus-service",
+ ":polaris-eclipselink",
+)
val genProjects by configurations.creating
val genSources by configurations.creating