diff --git a/docs/pom.xml b/docs/pom.xml index 02a7561ef8aed..b53b9950ed5b4 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -2608,8 +2608,7 @@ ${skipDocs} io.quarkus.docs.generation.AllConfigGenerator - ${project.version} - ${project.basedir}/../devtools/platform-descriptor-json/target/classes/quarkus-bom-descriptor/extensions.json + ${project.basedir}/../devtools/bom-descriptor-json/target/quarkus-bom-quarkus-platform-descriptor-${project.version}-${project.version}.json ${env.MAVEN_CMD_LINE_ARGS} diff --git a/docs/src/main/java/io/quarkus/docs/generation/AllConfigGenerator.java b/docs/src/main/java/io/quarkus/docs/generation/AllConfigGenerator.java index 5fb7b4c999604..d62199658a715 100644 --- a/docs/src/main/java/io/quarkus/docs/generation/AllConfigGenerator.java +++ b/docs/src/main/java/io/quarkus/docs/generation/AllConfigGenerator.java @@ -27,7 +27,6 @@ import io.quarkus.annotation.processor.generate_doc.ConfigDocSection; import io.quarkus.annotation.processor.generate_doc.ConfigDocWriter; import io.quarkus.annotation.processor.generate_doc.DocGeneratorUtil; -import io.quarkus.bootstrap.resolver.maven.BootstrapMavenException; import io.quarkus.bootstrap.resolver.maven.MavenArtifactResolver; import io.quarkus.maven.ArtifactCoords; import io.quarkus.registry.catalog.Extension; @@ -41,20 +40,18 @@ public static Artifact toAetherArtifact(ArtifactCoords coords) { coords.getVersion()); } - public static void main(String[] args) throws BootstrapMavenException, IOException { - if (args.length != 2) { + public static void main(String[] args) throws Exception { + if (args.length != 1) { // exit 1 will break Maven - throw new IllegalArgumentException("Usage: "); + throw new IllegalArgumentException("Usage: "); } - String version = args[0]; - String extensionFile = args[1]; + String jsonCatalog = args[0]; // This is where we produce the entire list of extensions - File jsonFile = new File(extensionFile); + File jsonFile = new File(jsonCatalog); if (!jsonFile.exists()) { - System.err.println("WARNING: could not generate all-config file because extensions list is missing: " + jsonFile); - // exit 0 will break Maven - return; + throw new RuntimeException( + "Could not generate all-config file because extension catalog file is missing: " + jsonFile); } MavenArtifactResolver resolver = MavenArtifactResolver.builder().setWorkspaceDiscovery(false).build(); @@ -66,10 +63,8 @@ public static void main(String[] args) throws BootstrapMavenException, IOExcepti Map extensionsByGav = new HashMap<>(); Map extensionsByConfigRoots = new HashMap<>(); for (Extension extension : extensionJson.getExtensions()) { - ArtifactRequest request = new ArtifactRequest(); - Artifact artifact = toAetherArtifact(extension.getArtifact()); - request.setArtifact(artifact); - requests.add(request); + final Artifact artifact = toAetherArtifact(extension.getArtifact()); + requests.add(new ArtifactRequest().setArtifact(artifact)); // record the extension for this GAV extensionsByGav.put(artifact.getGroupId() + ":" + artifact.getArtifactId(), extension); } @@ -77,7 +72,7 @@ public static void main(String[] args) throws BootstrapMavenException, IOExcepti // examine all the extension jars List deploymentRequests = new ArrayList<>(extensionJson.getExtensions().size()); for (ArtifactResult result : resolver.resolve(requests)) { - Artifact artifact = result.getArtifact(); + final Artifact artifact = result.getArtifact(); // which extension was this for? Extension extension = extensionsByGav.get(artifact.getGroupId() + ":" + artifact.getArtifactId()); try (ZipFile zf = new ZipFile(artifact.getFile())) { @@ -91,13 +86,11 @@ public static void main(String[] args) throws BootstrapMavenException, IOExcepti new InputStreamReader(zf.getInputStream(entry), StandardCharsets.UTF_8))) { Properties properties = new Properties(); properties.load(reader); - String deploymentGav = (String) properties.get("deployment-artifact"); + final String deploymentCoords = (String) properties.get("deployment-artifact"); // if it has one, load it - if (deploymentGav != null) { - ArtifactRequest request = new ArtifactRequest(); - Artifact deploymentArtifact = new DefaultArtifact(deploymentGav); - request.setArtifact(deploymentArtifact); - deploymentRequests.add(request); + if (deploymentCoords != null) { + final Artifact deploymentArtifact = toAetherArtifact(ArtifactCoords.fromString(deploymentCoords)); + deploymentRequests.add(new ArtifactRequest().setArtifact(deploymentArtifact)); // tie this artifact to its extension extensionsByGav.put(deploymentArtifact.getGroupId() + ":" + deploymentArtifact.getArtifactId(), extension); @@ -109,7 +102,7 @@ public static void main(String[] args) throws BootstrapMavenException, IOExcepti // now examine all the extension deployment jars for (ArtifactResult result : resolver.resolve(deploymentRequests)) { - Artifact artifact = result.getArtifact(); + final Artifact artifact = result.getArtifact(); // which extension was this for? Extension extension = extensionsByGav.get(artifact.getGroupId() + ":" + artifact.getArtifactId()); try (ZipFile zf = new ZipFile(artifact.getFile())) { @@ -119,22 +112,21 @@ public static void main(String[] args) throws BootstrapMavenException, IOExcepti } // load all the config items per config root - ConfigDocItemScanner configDocItemScanner = new ConfigDocItemScanner(); - Map> docItemsByConfigRoots = configDocItemScanner + final ConfigDocItemScanner configDocItemScanner = new ConfigDocItemScanner(); + final Map> docItemsByConfigRoots = configDocItemScanner .loadAllExtensionsConfigurationItems(); - Map artifactIdsByName = new HashMap<>(); + final Map artifactIdsByName = new HashMap<>(); ConfigDocWriter configDocWriter = new ConfigDocWriter(); - // build a list of sorted config items by extension - List allItems = new ArrayList<>(); - SortedMap> sortedConfigItemsByExtension = new TreeMap<>(); - // Temporary fix for https://github.com/quarkusio/quarkus/issues/5214 until we figure out how to fix it Extension openApi = extensionsByGav.get("io.quarkus:quarkus-smallrye-openapi"); if (openApi != null) { extensionsByConfigRoots.put("io.quarkus.smallrye.openapi.common.deployment.SmallRyeOpenApiConfig", openApi); } + // build a list of sorted config items by extension + final SortedMap> sortedConfigItemsByExtension = new TreeMap<>(); + // sort extensions by name, assign their config items based on their config roots for (Entry entry : extensionsByConfigRoots.entrySet()) { List items = docItemsByConfigRoots.get(entry.getKey()); @@ -163,6 +155,7 @@ public static void main(String[] args) throws BootstrapMavenException, IOExcepti } // now we have all the config items sorted by extension, let's build the entire list + final List allItems = new ArrayList<>(); for (Map.Entry> entry : sortedConfigItemsByExtension.entrySet()) { final List configDocItems = entry.getValue(); // sort the items