You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2019/10/08 13:09:42 UTC

[camel-quarkus] 11/12: #75: Adding camel-quarkus-catalog (work in progress)

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch catalog
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git

commit 4bad575aaafd648025ad74a2d4be6d5cd16fff4b
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Oct 8 14:31:30 2019 +0200

    #75: Adding camel-quarkus-catalog (work in progress)
---
 extensions/core-cloud/runtime/pom.xml              |  7 +++
 extensions/core/runtime/pom.xml                    |  7 +++
 extensions/platform-http/runtime/pom.xml           |  7 +++
 extensions/reactive-executor/runtime/pom.xml       |  2 +
 .../quarkus/maven/PrepareCatalogQuarkusMojo.java   | 53 +++++++++++++++++++---
 5 files changed, 70 insertions(+), 6 deletions(-)

diff --git a/extensions/core-cloud/runtime/pom.xml b/extensions/core-cloud/runtime/pom.xml
index b054ea5..abfd5d5 100644
--- a/extensions/core-cloud/runtime/pom.xml
+++ b/extensions/core-cloud/runtime/pom.xml
@@ -28,6 +28,13 @@
 
     <artifactId>camel-quarkus-core-cloud</artifactId>
     <name>Camel Quarkus :: Core :: Cloud :: Runtime</name>
+    <description>The Camel Quarkus core cloud module</description>
+
+    <properties>
+        <title>Camel Quarkus Core Cloud</title>
+        <firstVersion>0.2.0</firstVersion>
+        <label>core,cloud</label>
+    </properties>
 
     <dependencyManagement>
         <dependencies>
diff --git a/extensions/core/runtime/pom.xml b/extensions/core/runtime/pom.xml
index 5683b69..1f68914 100644
--- a/extensions/core/runtime/pom.xml
+++ b/extensions/core/runtime/pom.xml
@@ -27,6 +27,13 @@
 
     <artifactId>camel-quarkus-core</artifactId>
     <name>Camel Quarkus :: Core :: Runtime</name>
+    <description>The Camel Quarkus core module</description>
+
+    <properties>
+        <title>Camel Quarkus Core</title>
+        <firstVersion>0.2.0</firstVersion>
+        <label>core</label>
+    </properties>
 
     <dependencyManagement>
         <dependencies>
diff --git a/extensions/platform-http/runtime/pom.xml b/extensions/platform-http/runtime/pom.xml
index 73427a6..f8d74b0 100644
--- a/extensions/platform-http/runtime/pom.xml
+++ b/extensions/platform-http/runtime/pom.xml
@@ -30,6 +30,13 @@
 
     <artifactId>camel-quarkus-platform-http</artifactId>
     <name>Camel Quarkus :: Platform HTTP :: Runtime</name>
+    <description>HTTP platform component is used for integrating Camel HTTP with Quarkus HTTP layer</description>
+
+    <properties>
+        <title>Camel Quarkus Platform HTTP</title>
+        <firstVersion>0.2.1</firstVersion>
+        <label>core,http</label>
+    </properties>
 
     <dependencyManagement>
         <dependencies>
diff --git a/extensions/reactive-executor/runtime/pom.xml b/extensions/reactive-executor/runtime/pom.xml
index d44377e..0a1ea5d 100644
--- a/extensions/reactive-executor/runtime/pom.xml
+++ b/extensions/reactive-executor/runtime/pom.xml
@@ -31,7 +31,9 @@
     <description>To use Quarkus reactive executor with Camel</description>
 
     <properties>
+        <title>Camel Quarkus Reactive Executor</title>
         <firstVersion>0.2.1</firstVersion>
+        <label>core</label>
     </properties>
 
     <dependencyManagement>
diff --git a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
index 373df70..17bf3d2 100644
--- a/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
+++ b/tooling/maven/package-maven-plugin/src/main/java/org/apache/camel/quarkus/maven/PrepareCatalogQuarkusMojo.java
@@ -17,6 +17,7 @@
 package org.apache.camel.quarkus.maven;
 
 import java.io.File;
+import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
@@ -131,7 +132,7 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
         executeComponents(artifacts);
         executeLanguages(artifacts);
         executeDataFormats(artifacts);
-//        executeOthers(artifacts); // TODO: implement me
+        executeOthers(extensions);
     }
 
     private Set<String> extractArtifactIds(Set<String> extensions) throws MojoFailureException {
@@ -264,11 +265,15 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
 
         for (String extension : extensions) {
             // skip if the extension is already one of the following
-            boolean component = new File(componentsOutDir, extension + ".json").exists();
-            boolean language = new File(languagesOutDir, extension + ".json").exists();
-            boolean dataFormat = new File(dataFormatsOutDir, extension + ".json").exists();
-            if (component || language || dataFormat) {
-                continue;
+            try {
+                boolean component = isComponent(extension);
+                boolean language = isLanguage(extension);
+                boolean dataFormat = isDataFormat(extension);
+                if (component || language || dataFormat) {
+                    continue;
+                }
+            } catch (IOException e) {
+                throw new MojoFailureException("Error reading generated files for extension " + extension, e);
             }
 
             try {
@@ -338,6 +343,42 @@ public class PrepareCatalogQuarkusMojo extends AbstractMojo {
         }
     }
 
+    private boolean isComponent(String extension) throws IOException {
+        for (File file : componentsOutDir.listFiles()) {
+            FileInputStream fis = new FileInputStream(file);
+            String text = loadText(fis);
+            fis.close();
+            if (text.contains("camel-quarkus-" + extension)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private boolean isLanguage(String extension) throws IOException {
+        for (File file : languagesOutDir.listFiles()) {
+            FileInputStream fis = new FileInputStream(file);
+            String text = loadText(fis);
+            fis.close();
+            if (text.contains("camel-quarkus-" + extension)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private boolean isDataFormat(String extension) throws IOException {
+        for (File file : dataFormatsOutDir.listFiles()) {
+            FileInputStream fis = new FileInputStream(file);
+            String text = loadText(fis);
+            fis.close();
+            if (text.contains("camel-quarkus-" + extension)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
     private MavenProject getMavenProject(String groupId, String artifactId, String version) throws ProjectBuildingException {
         Artifact pomArtifact = repositorySystem.createProjectArtifact(groupId, artifactId, version);
         ProjectBuildingResult build = mavenProjectBuilder.build(pomArtifact, session.getProjectBuildingRequest());