-
Notifications
You must be signed in to change notification settings - Fork 144
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
google.java.functions-framework builder does not support Gradle Kotlin DSL build.gradle.kts #406
Comments
Hi @StephenWithPH, thank you for spotting this issue, and for providing the detailed analysis. I can reproduce this issue on my end. I'm working on a fix for this. In the meantime, could you share the test app that you created? If possible, could you share it as a Github repo? I am specifically interested in the |
@SandeepTuniki ... that's great to hear! Thank you for picking this one up. You can see a repro (same code works with Groovy DSL and fails with Kotlin DSL) at https://github.com/StephenWithPH/buildpack-kotlin-dsl-repro . |
Hi @StephenWithPH, thanks for the extra details! I dug into this and found that the fix is a bit more involved than just adding a check to the We've got this on our radar for future updates, but for now, I'd recommend using either Maven or Gradle with Groovy DSL. We've got some helpful guides on that here: https://cloud.google.com/functions/docs/create-deploy-http-java. |
@SandeepTuniki ... the non-functions-framework builder for Java does handle Kotlin DSL. See #26 and 37ecf33 . Possible to crib from that in the functions-framework Java builder? |
@StephenWithPH Yes, I went through that issue and PR already while investigating. We found that changes for Functions are not as straightforward as the earlier ones. This feature is on our roadmap, but I can't provide a specific timeline right now due to other pressing priorities. Rest assured, I'll share updates as soon as we have a clearer picture. |
Describe the bug
Having created a project via
gradle init
(Gradle 8.7) and chosen the Kotlin DSL, the following error ultimately surfaces:Creating a project via
gradle init
and choosing the Groovy DSL leads to a buildable project.Note that it seems necessary to "flatten" the project out of its default, multi-module shape. I don't believe this is relevant to the above, but will be necessary to avoid masking the error above.
Additional context
How are you using GCP buildpacks?
pack
and thegcr.io/buildpacks/builder
Did this used to work?
(Yes/No)
Unknown
What language is your project primarily written in?
(Python/Java/Node.js/Go/etc.)
Kotlin
Steps To Reproduce
Steps to reproduce the behavior:
gradle init
per above, choosingApplication
,Kotlin
, Java21
,Single application project
,Kotlin
DSL,no
new apis/behaviorssrc
up out ofapp
and removing theinclude
fromsettings.gradle
. Note that this is to avoid masking the error.pack build \ --builder gcr.io/buildpacks/builder:latest \ --env GOOGLE_FUNCTION_SIGNATURE_TYPE=http \ --env GOOGLE_FUNCTION_TARGET=org.example.App \ --env GOOGLE_RUNTIME_VERSION=21 \ my-first-function
Expected behavior
It builds.
Actual behavior
It gives the error above:
The error appears to come from:
buildpacks/cmd/java/functions_framework/main.go
Line 146 in 5bbd4eb
Earlier in that
func classpath
, the Gradle check only checks for (Groovy DSL syntax)build.gradle
, neglecting to check forbuild.gradle.kts
:buildpacks/cmd/java/functions_framework/main.go
Line 119 in 5bbd4eb
Note that a fix to support
build.gradle.kts
went into thegoogle.java
builder in 37ecf33 , but that did not touch the functions-framework builder.The text was updated successfully, but these errors were encountered: