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

astefanutti pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 131108db6aa97753d6334731c53de1576dc63ab2
Author: Antonin Stefanutti <[email protected]>
AuthorDate: Wed Oct 23 15:29:17 2019 +0200

    feat(quarkus): Support the camel-quarkus dependency protocol
---
 pkg/apis/camel/v1alpha1/integration_types_support.go | 4 +++-
 pkg/builder/builder_steps.go                         | 8 ++++++++
 pkg/cmd/kit_create.go                                | 2 ++
 pkg/metadata/metadata_dependencies_test.go           | 4 ++--
 pkg/util/source/inspector.go                         | 3 +++
 5 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/pkg/apis/camel/v1alpha1/integration_types_support.go 
b/pkg/apis/camel/v1alpha1/integration_types_support.go
index 9a63d8f..0f4891e 100644
--- a/pkg/apis/camel/v1alpha1/integration_types_support.go
+++ b/pkg/apis/camel/v1alpha1/integration_types_support.go
@@ -86,7 +86,9 @@ func (in *IntegrationSpec) AddDependency(dependency string) {
                in.Dependencies = make([]string, 0)
        }
        newDep := dependency
-       if strings.HasPrefix(newDep, "camel-") {
+       if strings.HasPrefix(newDep, "camel-quarkus") {
+               newDep = "camel-quarkus:" + strings.TrimPrefix(dependency, 
"camel-quarkus-")
+       } else if strings.HasPrefix(newDep, "camel-") {
                newDep = "camel:" + strings.TrimPrefix(dependency, "camel-")
        }
        for _, d := range in.Dependencies {
diff --git a/pkg/builder/builder_steps.go b/pkg/builder/builder_steps.go
index 878ef56..23d15be 100644
--- a/pkg/builder/builder_steps.go
+++ b/pkg/builder/builder_steps.go
@@ -152,6 +152,14 @@ func injectDependencies(ctx *Context) error {
                        }
 
                        
ctx.Maven.Project.AddDependencyGAV("org.apache.camel.k", artifactID, "")
+               case strings.HasPrefix(d, "camel-quarkus:"):
+                       artifactID := strings.TrimPrefix(d, "camel-quarkus:")
+
+                       if !strings.HasPrefix(artifactID, "camel-quarkus-") {
+                               artifactID = "camel-quarkus-" + artifactID
+                       }
+
+                       
ctx.Maven.Project.AddDependencyGAV("org.apache.camel.quarkus", artifactID, "")
                case strings.HasPrefix(d, "mvn:"):
                        mid := strings.TrimPrefix(d, "mvn:")
                        gav := strings.Replace(mid, "/", ":", -1)
diff --git a/pkg/cmd/kit_create.go b/pkg/cmd/kit_create.go
index 1b8d89a..f9475ef 100644
--- a/pkg/cmd/kit_create.go
+++ b/pkg/cmd/kit_create.go
@@ -142,6 +142,8 @@ func (command *kitCreateCommand) run(_ *cobra.Command, args 
[]string) error {
                        ctx.Spec.Dependencies = append(ctx.Spec.Dependencies, 
item)
                case strings.HasPrefix(item, "file:"):
                        ctx.Spec.Dependencies = append(ctx.Spec.Dependencies, 
item)
+               case strings.HasPrefix(item, "camel-quarkus-"):
+                       ctx.Spec.Dependencies = append(ctx.Spec.Dependencies, 
"camel-quarkus:"+strings.TrimPrefix(item, "camel-quarkus-"))
                case strings.HasPrefix(item, "camel-"):
                        ctx.Spec.Dependencies = append(ctx.Spec.Dependencies, 
"camel:"+strings.TrimPrefix(item, "camel-"))
                }
diff --git a/pkg/metadata/metadata_dependencies_test.go 
b/pkg/metadata/metadata_dependencies_test.go
index bd1ceea..a3654f9 100644
--- a/pkg/metadata/metadata_dependencies_test.go
+++ b/pkg/metadata/metadata_dependencies_test.go
@@ -136,8 +136,8 @@ func TestDependenciesQuarkus(t *testing.T) {
 
        assert.ElementsMatch(t,
                []string{
-                       "mvn:org.apache.camel.quarkus:camel-quarkus-log:",
-                       "mvn:org.apache.camel.quarkus:camel-quarkus-twitter:",
+                       "camel-quarkus:log",
+                       "camel-quarkus:twitter",
                },
                meta.Dependencies.List())
 }
diff --git a/pkg/util/source/inspector.go b/pkg/util/source/inspector.go
index 942900b..4ee8897 100644
--- a/pkg/util/source/inspector.go
+++ b/pkg/util/source/inspector.go
@@ -148,6 +148,9 @@ func (i *baseInspector) decodeComponent(uri string) string {
                if component.GroupID == "org.apache.camel" && 
strings.HasPrefix(artifactID, "camel-") {
                        return "camel:" + artifactID[6:]
                }
+               if component.GroupID == "org.apache.camel.quarkus" && 
strings.HasPrefix(artifactID, "camel-quarkus-") {
+                       return "camel-quarkus:" + artifactID[14:]
+               }
                return "mvn:" + component.GroupID + ":" + artifactID + ":" + 
component.Version
        }
        return ""

Reply via email to