quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.37k stars 2.56k forks source link

Gradle plugin does not generate function.zip if builds from cache #41683

Open mgazim opened 5 days ago

mgazim commented 5 days ago

Describe the bug

When building native image for AWS Lambda with Gradle plugin and Gradle cache is used there's no function.zip generated in build directory, however *-runner image seems to be retrieved from cache. When building with --no-build-cache flag (or in case of any changes in Lambda source code) native image is being packed into function.zip as expected.

Gradle command used:

./gradlew clean build -Dquarkus.native.enabled=true -Dquarkus.package.jar.enabled=false -Dquarkus.native.container-build=true

Note: not only function.zip is not being added into build output but other "helper" artifacts as well (that are present when no Gradle cache is used):

Expected behavior

Native image is being packed into function.zip even if Gradle build cache is used.

Actual behavior

Native image is present in build artifacts, however function.zip is not being generated.

How to Reproduce?

  1. Setup Quarkus Gradle plugin for building Quarkus based AWS Lambda
  2. Run gradle clean build -Dquarkus.native.enabled=true -Dquarkus.package.jar.enabled=false -Dquarkus.native.container-build=true to build a native image (first run will definitely generate function.zip as no artifacts present in Gradle cache)
  3. Run the same command again
  4. Check build directory of the lambda

Output of uname -a or ver

Darwin MacBook-Air-.local 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:34 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T8103 arm64

Output of java -version

openjdk 21.0.3 2024-04-16 LTS OpenJDK Runtime Environment Temurin-21.0.3+9 (build 21.0.3+9-LTS) OpenJDK 64-Bit Server VM Temurin-21.0.3+9 (build 21.0.3+9-LTS, mixed mode)

Quarkus version or git rev

3.12.0

Build tool (ie. output of mvnw --version or gradlew --version)

------------------------------------------------------------ Gradle 8.5 ------------------------------------------------------------ Build time: 2023-11-29 14:08:57 UTC Revision: 28aca86a7180baa17117e0e5ba01d8ea9feca598 Kotlin: 1.9.20 Groovy: 3.0.17 Ant: Apache Ant(TM) version 1.10.13 compiled on January 4 2023 JVM: 21.0.3 (Eclipse Adoptium 21.0.3+9-LTS) OS: Mac OS X 14.2 aarch64

Additional information

quarkus gradle plugin version - 3.12.0.CR1

quarkus-bot[bot] commented 5 days ago

/cc @geoand (kotlin), @glefloch, @gwenneg (cache), @quarkusio/devtools

mschorsch commented 5 days ago

Maybe related https://github.com/quarkusio/quarkus/issues/36808

mgazim commented 9 hours ago

Thanks @mschorsch ! It seems to be the same.