Skip to content

Commit

Permalink
[quarkus] in JVM mode we should no restrict the languages we can use a…
Browse files Browse the repository at this point in the history
  • Loading branch information
lburgazzoli committed Dec 18, 2019
1 parent d66c346 commit 68d418c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
12 changes: 11 additions & 1 deletion pkg/builder/runtime/quarkus.go
Expand Up @@ -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{
Expand Down
19 changes: 14 additions & 5 deletions pkg/trait/quarkus.go
Expand Up @@ -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 {
Expand Down Expand Up @@ -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") {
Expand Down

0 comments on commit 68d418c

Please sign in to comment.