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

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


The following commit(s) were added to refs/heads/master by this push:
     new 7f3675a  [quarkus] in JVM mode we should no restrict the languages we 
can use #1154
7f3675a is described below

commit 7f3675acb0b17b91b456d9b298f6d7d051ca52eb
Author: lburgazzoli <lburgazz...@gmail.com>
AuthorDate: Wed Dec 18 13:14:11 2019 +0100

    [quarkus] in JVM mode we should no restrict the languages we can use #1154
---
 pkg/builder/runtime/quarkus.go | 12 +++++++++++-
 pkg/trait/quarkus.go           | 19 ++++++++++++++-----
 2 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/pkg/builder/runtime/quarkus.go b/pkg/builder/runtime/quarkus.go
index e7dea56..5e94ba4 100644
--- a/pkg/builder/runtime/quarkus.go
+++ b/pkg/builder/runtime/quarkus.go
@@ -59,11 +59,21 @@ func loadCamelQuarkusCatalog(ctx *builder.Context) error {
 
 func generateQuarkusProject(ctx *builder.Context) error {
        p := maven.NewProjectWithGAV("org.apache.camel.k.integration", 
"camel-k-integration", defaults.Version)
-       p.Properties = ctx.Build.Properties
        p.DependencyManagement = &maven.DependencyManagement{Dependencies: 
make([]maven.Dependency, 0)}
        p.Dependencies = make([]maven.Dependency, 0)
        p.Build = &maven.Build{Plugins: make([]maven.Plugin, 0)}
 
+       p.Properties = make(map[string]string)
+       for k, v := range ctx.Build.Properties {
+               p.Properties[k] = v
+       }
+
+       // camel-quarkus doe routes discovery at startup but we don't want
+       // this to happen as routes are loaded at runtime and looking for
+       // routes at build time may try to load camel-k-runtime routes builder
+       // proxies which in some case may fail
+       p.Properties["quarkus.camel.main.routes-discovery.enabled"] = "false"
+
        // DependencyManagement
        p.DependencyManagement.Dependencies = 
append(p.DependencyManagement.Dependencies,
                maven.Dependency{
diff --git a/pkg/trait/quarkus.go b/pkg/trait/quarkus.go
index 3b75eed..fd24438 100644
--- a/pkg/trait/quarkus.go
+++ b/pkg/trait/quarkus.go
@@ -47,6 +47,8 @@ type quarkusTrait struct {
        QuarkusVersion string `property:"quarkus-version"`
        // The Camel-Quarkus version to use for the integration
        CamelQuarkusVersion string `property:"camel-quarkus-version"`
+       // The Quarkus runtime type (reserved for future use)
+       Native bool `property:"native"`
 }
 
 func newQuarkusTrait() *quarkusTrait {
@@ -156,16 +158,23 @@ func (t *quarkusTrait) addRuntimeDependencies(e 
*Environment) error {
 
        for _, s := range e.Integration.Sources() {
                meta := metadata.Extract(e.CamelCatalog, s)
+               lang := s.InferLanguage()
 
-               switch language := s.InferLanguage(); language {
-               case v1alpha1.LanguageYaml:
+               switch {
+               case lang == v1alpha1.LanguageYaml:
                        addRuntimeDependency("camel-k-quarkus-loader-yaml", 
dependencies)
-               case v1alpha1.LanguageXML:
+               case lang == v1alpha1.LanguageXML:
                        addRuntimeDependency("camel-k-quarkus-loader-xml", 
dependencies)
-               case v1alpha1.LanguageJavaScript:
+               case lang == v1alpha1.LanguageJavaScript:
                        addRuntimeDependency("camel-k-quarkus-loader-js", 
dependencies)
+               case lang == v1alpha1.LanguageGroovy && !t.Native:
+                       addRuntimeDependency("camel-k-quarkus-loader-groovy", 
dependencies)
+               case lang == v1alpha1.LanguageKotlin && !t.Native:
+                       addRuntimeDependency("camel-k-quarkus-loader-kotlin", 
dependencies)
+               case lang == v1alpha1.LanguageJavaSource && !t.Native:
+                       addRuntimeDependency("camel-k-quarkus-loader-java", 
dependencies)
                default:
-                       return fmt.Errorf("unsupported language for Quarkus 
runtime: %s", language)
+                       return fmt.Errorf("unsupported language for Quarkus 
runtime: %s (native=%t)", lang, t.Native)
                }
 
                if strings.HasPrefix(s.Loader, "knative-source") {

Reply via email to