Closed gcw-it closed 4 months ago
/cc @Karm (mandrel), @galderz (mandrel), @zakkak (mandrel,native-image)
@gcw-it Fancy trying to implement this yourself? UpxCompressionBuildStep
could be enhanced to see if the binary is already there (and reuse existing is on) and check if the file is already compressed.
@galderz I could tackle this in the next few days, when I find some spare time (Probably on the weekend).
But first and foremost we should come to an understanding, what the expected behaviour should be.
Probably simplest and least surprising would be, to leave an existing artifact alone and skip the compression step.
If we go down the road to compress an existing uncompressed executable, if the compression settings have changed between builds, then we have to consider some other situations:
In my opinion, the cleanest approach would be to take Reuse Existing Executable literally and leave the existing artifact alone. What are your thoughts?
Describe the bug
Building a native executable with
<quarkus.native.reuse-existing>true</quarkus.native.reuse-existing>
set, and compression enabled, leads to a failing build, when the artifact already exists.Expected behavior
The plugin skips the compression step for the already compressed executable, and the build is finished without error.
Actual behavior
The build fails with:
Build step io.quarkus.deployment.pkg.steps.UpxCompressionBuildStep#compress threw an exception: java.lang.IllegalStateException: Unable to compress the native executable
How to Reproduce?
<quarkus.native.container-build>true</quarkus.native.container-build>
<quarkus.native.reuse-existing>true</quarkus.native.reuse-existing>
<quarkus.native.compression.level>1</quarkus.native.compression.level>
mvn package -DskipTests -Dnative
mvn package -DskipTests -Dnative
) the build fails, because the plugin tries to recompress the already compressed executable.Output of
uname -a
orver
Darwin 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:09:52 PDT 2024; root:xnu-10063.121.3~5/RELEASE_X86_64 x86_64
Output of
java -version
java 22.0.1 2024-04-16
Mandrel or GraalVM version (if different from Java)
quay.io/quarkus/ubi-quarkus-mandrel-builder-image:jdk-21
Quarkus version or git rev
3.11.3
Build tool (ie. output of
mvnw --version
orgradlew --version
)Apache Maven 3.9.8 (36645f6c9b5079805ea5009217e36f2cffd34256)
Additional information
No response