From 7f8f38c572a600ba4fe224ef7464dce98033f915 Mon Sep 17 00:00:00 2001 From: Pasquale Congiusti Date: Thu, 16 Jan 2025 18:13:14 +0100 Subject: [PATCH] fix(trait): deprecate old native profile Closes #6021 --- pkg/builder/runtime_support.go | 11 +++-------- pkg/trait/quarkus.go | 11 ++++++----- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/pkg/builder/runtime_support.go b/pkg/builder/runtime_support.go index b65b2a9abf..d44be5be63 100644 --- a/pkg/builder/runtime_support.go +++ b/pkg/builder/runtime_support.go @@ -58,13 +58,14 @@ func (n *NativeSourcesAdapter) NativeMavenProperty() string { } // NativeAdapter used for Camel Quarkus runtime < 3.5.0. +// Deprecated: use NativeSourcesAdapter instead. type NativeAdapter struct { } // BuildCommands -- . func (n *NativeAdapter) BuildCommands() string { // We must override the local repo as it's not shared from the builder container - return "cd " + n.Directory() + " && ./mvnw $(cat MAVEN_CONTEXT) package -Dquarkus.native.enabled=true -Dmaven.repo.local=./repo" + return "cd " + n.Directory() + " && ./mvnw $(cat MAVEN_CONTEXT) package -Dmaven.repo.local=./repo" } // Directory -- . @@ -79,17 +80,11 @@ func (n *NativeAdapter) TargetDirectory(ctxPath, runner string) string { // NativeMavenProperty -- . func (n *NativeAdapter) NativeMavenProperty() string { - // Empty on purpose. The parameter will be provided later by the command (see BuildCommands()). + // Empty on purpose. return "" } // QuarkusRuntimeSupport is used to get the proper native configuration based on the Camel Quarkus version. func QuarkusRuntimeSupport(version string) QuarkusRuntimeNativeAdapter { - // Version 3.6.0 depends on a parameter which is available on JDK-21 based image. - // For this reason we fallback to the "legacy" Quarkus native build. - // Hopefully this will be solved starting from runtime version 3.7.0. - if version < "3.7.0" { - return &NativeAdapter{} - } return &NativeSourcesAdapter{} } diff --git a/pkg/trait/quarkus.go b/pkg/trait/quarkus.go index 3235550749..d210eacddf 100644 --- a/pkg/trait/quarkus.go +++ b/pkg/trait/quarkus.go @@ -383,13 +383,14 @@ func (t *quarkusTrait) applyWhenBuildSubmitted(e *Environment) error { //nolint:nestif if native { + buildTask.Maven.Properties["quarkus.native.enabled"] = "true" if nativePackageType := builder.QuarkusRuntimeSupport(e.CamelCatalog.GetCamelQuarkusVersion()).NativeMavenProperty(); nativePackageType != "" { buildTask.Maven.Properties[nativePackageType] = "true" - if t.NativeBaseImage == "" { - packageTask.BaseImage = QuarkusNativeDefaultBaseImageName - } else { - packageTask.BaseImage = t.NativeBaseImage - } + } + if t.NativeBaseImage == "" { + packageTask.BaseImage = QuarkusNativeDefaultBaseImageName + } else { + packageTask.BaseImage = t.NativeBaseImage } if len(e.IntegrationKit.Spec.Sources) > 0 { buildTask.Sources = e.IntegrationKit.Spec.Sources