Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[quarkus] in JVM mode we should no restrict the languages we can use #1161

Merged
merged 1 commit into from
Dec 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion pkg/builder/runtime/quarkus.go
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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