Running a function with Gradle & Kotlin (build.gradle.kts)
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 35/100
- Issue 类型
- 文档
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
调研方向
从文档中的 Gradle 示例开始,并将其与提供的 build.gradle.kts 配置进行比较。更新文档,以包含 Kotlin DSL 形式以及缺少 runFunction.target 时的 fallback,然后验证该示例是否与所述的 Kotlin 和 Gradle 版本兼容。
由索引模型根据 Issue 内容生成。
描述
Thanks for putting all this together! I was trying to get the local invoker working on my local machine, which is setup using kotlin (1.3.72) and gradle (6.4.1) via the build.gradle.kts file.
The Gradle example in the documentation uses a format that doesn't seem compatible with the build.gradle.kts file, so I'm hoping sharing that particular configuration helps people set up their project.
build.gradle.kts
val invoker by configurations.creating
dependencies {
implementation("com.google.cloud.functions:functions-framework-api:1.0.1")
invoker("com.google.cloud.functions.invoker:java-function-invoker:1.0.0-alpha-2-rc5")
}
task<JavaExec>("runFunction") {
main = "com.google.cloud.functions.invoker.runner.Invoker"
classpath(invoker)
inputs.files(configurations.runtimeClasspath, sourceSets["main"].output)
args(
"--target", project.findProperty("runFunction.target") ?: "",
"--port", project.findProperty("runFunction.port") ?: 8080
)
doFirst {
args("--classpath", files(configurations.runtimeClasspath, sourceSets["main"].output).asPath)
}
}
Apart from the particular formatting for the .kts version, I did have to add one thing:
- I had to add the elvis operator
?: ""for ``--target, otherwise you cannot build the project due toIllegal null value provided in this collection: [--target, null, --port, 8080]`
- 主要语言
- Java
- 星标
- 154
- 派生
- 63
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
GoogleCloudPlatform/functions-framework-java 的其他 Issue
-
enhancement P2
难度 1/5 1 小时以内 新手友好度 65/100
-
enhancement
GoogleCloudPlatform/functions-framework-java#375 · 1 条评论 · 1 个 reaction · 已指派 1 人 ·
-
enhancement P2
难度 5/5 一周以上 新手友好度 30/100
GoogleCloudPlatform/functions-framework-java#372 · 1 条评论 ·
-
enhancement P3
GoogleCloudPlatform/functions-framework-java#261 · 已指派 1 人 ·
-
P3 question
难度 4/5 3-5 天 新手友好度 35/100
GoogleCloudPlatform/functions-framework-java#254 · 1 条评论 ·
查看 GoogleCloudPlatform/functions-framework-java 的全部 Issue
相似的 Issue
-
certification
难度 1/5 1 小时以内 新手友好度 80/100
-
难度 2/5 1-3 小时 新手友好度 75/100
-
[BUG] ECR GetAuthorizationToken returns a proxyEndpoint for the default region, not the request's 未关闭bug ecr
难度 2/5 1-3 小时 新手友好度 75/100
-
Needs: Triage Type: Feature request
难度 2/5 1-3 小时 新手友好度 70/100
AntennaPod/AntennaPod#8794 ·
-
agentic-workflows
难度 2/5 1-3 小时 新手友好度 65/100
github/copilot-sdk#2760 ·