Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experiment with generating config files for the IDEs #42677

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,23 @@
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-extension-deployment-maven-plugin</artifactId>
<version>${project.version}</version>
<executions>
<execution>
<id>generate-config-metadata</id>
<phase>package</phase>
<goals>
<goal>attach-config-metadata</goal>
</goals>
<configuration>
<skip>${skipDocs}</skip>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ public void finalizeProcessing() {

// the model is not written in the jar file
JavadocElements javadocElements = configResolver.resolveJavadoc();
if (!javadocElements.elements().isEmpty()) {
if (!javadocElements.isEmpty()) {
utils.filer().writeModel(Outputs.QUARKUS_CONFIG_DOC_JAVADOC, javadocElements);
}

ResolvedModel resolvedModel = configResolver.resolveModel();
if (!resolvedModel.getConfigRoots().isEmpty()) {
if (!resolvedModel.isEmpty()) {
Path resolvedModelPath = utils.filer().writeModel(Outputs.QUARKUS_CONFIG_DOC_MODEL, resolvedModel);

if (config.isDebug()) {
Expand All @@ -101,5 +101,14 @@ public void finalizeProcessing() {
}
}
}

// Generate files that will be consumed by the Maven plugin present in the deployment module of each extension.
// These files will be included in the jars (for now).
if (!javadocElements.isEmpty()) {
utils.filer().writeYaml(Outputs.META_INF_QUARKUS_CONFIG_JAVADOC_YAML, javadocElements);
}
if (!resolvedModel.isEmpty()) {
utils.filer().writeYaml(Outputs.META_INF_QUARKUS_CONFIG_MODEL_YAML, resolvedModel);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package io.quarkus.annotation.processor.documentation.config.discovery;

import io.quarkus.annotation.processor.documentation.config.model.Deprecation;
import io.quarkus.annotation.processor.documentation.config.model.SourceType;
import io.quarkus.annotation.processor.documentation.config.model.SourceElementType;
import io.quarkus.annotation.processor.documentation.config.util.TypeUtil;
import io.quarkus.annotation.processor.util.Strings;

public class DiscoveryConfigProperty {

private final String path;
private final String sourceClass;
private final String sourceName;
private final SourceType sourceType;
private final String sourceType;
private final String sourceElementName;
private final SourceElementType sourceElementType;
private final String defaultValue;
private final String defaultValueForDoc;
private final Deprecation deprecation;
Expand All @@ -22,15 +22,16 @@ public class DiscoveryConfigProperty {
private final boolean section;
private final boolean sectionGenerated;

public DiscoveryConfigProperty(String path, String sourceClass, String sourceName, SourceType sourceType,
public DiscoveryConfigProperty(String path, String sourceType, String sourceElementName,
SourceElementType sourceElementType,
String defaultValue,
String defaultValueForDoc, Deprecation deprecation, String mapKey, boolean unnamedMapKey,
ResolvedType type, boolean converted, boolean enforceHyphenateEnumValue,
boolean section, boolean sectionGenerated) {
this.path = path;
this.sourceClass = sourceClass;
this.sourceName = sourceName;
this.sourceType = sourceType;
this.sourceElementName = sourceElementName;
this.sourceElementType = sourceElementType;
this.defaultValue = defaultValue;
this.defaultValueForDoc = defaultValueForDoc;
this.deprecation = deprecation;
Expand All @@ -47,16 +48,16 @@ public String getPath() {
return path;
}

public String getSourceClass() {
return sourceClass;
public String getSourceType() {
return sourceType;
}

public String getSourceName() {
return sourceName;
public String getSourceElementName() {
return sourceElementName;
}

public SourceType getSourceType() {
return sourceType;
public SourceElementType getSourceElementType() {
return sourceElementType;
}

public String getDefaultValue() {
Expand Down Expand Up @@ -110,8 +111,8 @@ public String toString() {
public String toString(String prefix) {
StringBuilder sb = new StringBuilder();
sb.append(prefix + "name = " + path + "\n");
sb.append(prefix + "sourceClass = " + sourceClass + "\n");
sb.append(prefix + "sourceName = " + sourceName + "\n");
sb.append(prefix + "sourceType = " + sourceType + "\n");
sb.append(prefix + "sourceElementName = " + sourceElementName + "\n");
sb.append(prefix + "type = " + type + "\n");
if (defaultValue != null) {
sb.append(prefix + "defaultValue = " + defaultValue + "\n");
Expand All @@ -135,16 +136,17 @@ public String toString(String prefix) {
return sb.toString();
}

public static Builder builder(String sourceClass, String sourceName, SourceType sourceType, ResolvedType type) {
return new Builder(sourceClass, sourceName, sourceType, type);
public static Builder builder(String sourceType, String sourceElementName, SourceElementType sourceElementType,
ResolvedType type) {
return new Builder(sourceType, sourceElementName, sourceElementType, type);
}

public static class Builder {

private String name;
private final String sourceClass;
private final String sourceName;
private final SourceType sourceType;
private final String sourceType;
private final String sourceElementName;
private final SourceElementType sourceElementType;
private final ResolvedType type;
private String defaultValue;
private String defaultValueForDoc;
Expand All @@ -156,10 +158,10 @@ public static class Builder {
private boolean section = false;
private boolean sectionGenerated = false;

public Builder(String sourceClass, String sourceName, SourceType sourceType, ResolvedType type) {
this.sourceClass = sourceClass;
this.sourceName = sourceName;
public Builder(String sourceType, String sourceElementName, SourceElementType sourceElementType, ResolvedType type) {
this.sourceType = sourceType;
this.sourceElementName = sourceElementName;
this.sourceElementType = sourceElementType;
this.type = type;
}

Expand Down Expand Up @@ -217,7 +219,8 @@ public DiscoveryConfigProperty build() {
defaultValue = TypeUtil.normalizeDurationValue(defaultValue);
}

return new DiscoveryConfigProperty(name, sourceClass, sourceName, sourceType, defaultValue, defaultValueForDoc,
return new DiscoveryConfigProperty(name, sourceType, sourceElementName, sourceElementType, defaultValue,
defaultValueForDoc,
deprecation, mapKey, unnamedMapKey, type, converted, enforceHyphenateEnumValue, section, sectionGenerated);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public String getQualifiedName() {
}

public void addProperty(DiscoveryConfigProperty discoveryConfigProperty) {
properties.put(discoveryConfigProperty.getSourceName(), discoveryConfigProperty);
properties.put(discoveryConfigProperty.getSourceElementName(), discoveryConfigProperty);
}

public Map<String, DiscoveryConfigProperty> getProperties() {
Expand Down
Loading