Skip to content

Commit

Permalink
fix(trait): run old native process for runtime pre 3.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
squakez committed Oct 2, 2023
1 parent 51ede6e commit 259d393
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 3 additions & 2 deletions pkg/builder/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ func nativeImageContext(ctx *builderContext) error {
ctx.BaseImage = "quay.io/quarkus/quarkus-distroless-image:1.0"
ctx.Artifacts = []v1.Artifact{
{
ID: runner,
Location: filepath.Join(ctx.Path, "maven", "target", "native-sources", runner),
ID: runner,
// Location: filepath.Join(ctx.Path, "maven", "target", "native-sources", runner),
Location: filepath.Join(ctx.Path, "maven", "target", runner),
Target: runner,
},
}
Expand Down
8 changes: 6 additions & 2 deletions pkg/trait/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,12 @@ func (t *builderTrait) Configure(e *Environment) (bool, error) {
return false, err
}
if ok && pointer.BoolDeref(quarkus.Enabled, true) && (isNativeIntegration || isNativeKit) {
nativeArgsCd := filepath.Join("maven", "target", "native-sources")
command := "cd " + nativeArgsCd + " && echo NativeImage version is $(native-image --version) && echo GraalVM expected version is $(cat graalvm.version) && echo WARN: Make sure they are compatible, otherwise the native compilation may results in error && native-image $(cat native-image.args)"
//nativeArgsCd := filepath.Join("maven", "target", "native-sources")
//command := "cd " + nativeArgsCd + " && echo NativeImage version is $(native-image --version) && echo GraalVM expected version is $(cat graalvm.version) && echo WARN: Make sure they are compatible, otherwise the native compilation may results in error && native-image $(cat native-image.args)"
// Workaround pre Camel-Quarkus 3.5.0
nativeArgsCd := filepath.Join("maven")
command := "cd " + nativeArgsCd + " && ./mvnw package -Dquarkus.package.type=native --global-settings settings.xml"

// it should be performed as the last custom task
t.Tasks = append(t.Tasks, fmt.Sprintf(`quarkus-native;%s;/bin/bash -c "%s"`, e.CamelCatalog.GetQuarkusToolingImage(), command))
// Force the build to run in a separate Pod and strictly sequential
Expand Down
2 changes: 1 addition & 1 deletion pkg/trait/quarkus.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ func (t *quarkusTrait) applyWhenBuildSubmitted(e *Environment) error {
}

if native {
buildTask.Maven.Properties["quarkus.package.type"] = string(nativeSourcesPackageType)
// buildTask.Maven.Properties["quarkus.package.type"] = string(nativeSourcesPackageType)
if len(e.IntegrationKit.Spec.Sources) > 0 {
buildTask.Sources = e.IntegrationKit.Spec.Sources
buildSteps = append(buildSteps, builder.Quarkus.PrepareProjectWithSources)
Expand Down

0 comments on commit 259d393

Please sign in to comment.