Type-safe Gradle task accessors
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- github-actions, kotlin
- 領域
- build-system, ci-cd, devops
調査の方向性
Start with the referenced .github/workflows/release.main.kts lines 45-48 and inspect the output of ./gradlew tasks --all, then compare the Gradle tooling API. The issue names no implementation files or tests; done would require an agreed design for generated project and task accessors, unsafe task references, extra flags, and shared tasks across projects.
索引モデルが issue の本文から書いたものです。
説明
Problem
Currently, the only way of calling a specific Gradle task is to give it as string, e.g.:
https://github.com/typesafegithub/github-workflows-kt/blob/7f4b41b5156d811a0d129ade49ebb64569d85ded/.github/workflows/release.main.kts#L48
It requires great attention to type them correctly. It's also risky to keep these as strings with regards to automatic dependency updates. E.g. see https://github.com/gradle-nexus/publish-plugin/releases/tag/v2.0.0:
Backward incompatible changes
- closeAndReleaseStagingRepository has been renamed to closeAndReleaseStagingRepositories for consistency
In this particular example, we don't call the task that was renamed, but if we did, Renovate would allow merging such change. The worst thing is that it would be caught at the moment of running the release workflow, which currently e.g. for github-workflows-kt happens once a month.
Idea
In the spirit of https://docs.gradle.org/current/userguide/kotlin_dsl.html#type-safe-accessors.
Rough notes, nothing formal:
./gradlew tasks --allreturns a list of tasks in a format like [1], there's also Gradle tooling API. We could extract the task hierarchy from there, and generate Kotlin type-safe accessors, e.g.jit-binding-server:runwould map to such Kotlin code:jitBindingServer.run- in the GitHub workflow using the Kotlin script, we would have a type-safe wrapper over Gradle that would allow passing only tasks defined in the previous step (+a way to refer to a task in an unsafe, string-based way), along with being able to pass extra arguments like
--no-configuration-cacheand other free-form arguments - sometimes we want to run the same task for several projects, e.g. when we loop across them (ref). Ideally the proposed feature would allow it, e.g. by understanding that if
project1andproject2expose aruntask, both projects should probably implement a common interface whererunin both cases is the same property in terms of API
Example
Before:
val librariesToPublish = listOf(
":shared-internal",
":github-workflows-kt",
":action-binding-generator",
)
librariesToPublish.forEach { library ->
run(
name = "Publish '$library' to Sonatype",
command = "./gradlew $library:publishToSonatype closeAndReleaseSonatypeStagingRepository --no-configuration-cache",
)
}
After (rough idea, subject to discussion):
val librariesToPublish = listOf(
projects.sharedInternal,
projects.githubWorkflowsKt,
projects.actionBindingGenerator,
)
librariesToPublish.forEach { library ->
runGradle(
name = "Publish '$library' to Sonatype",
tasks = listOf(
library.publishToSonatype,
tasks.closeAndReleaseSonatypeStagingRepository,
),
flags = listOf(noConfigurationCache),
)
}
[1]
> Task :tasks
------------------------------------------------------------
Tasks runnable from root project 'github-workflows-kt-monorepo'
------------------------------------------------------------
Application tasks
-----------------
automation:code-generator:run - Runs this project as a JVM application
jit-binding-server:run - Runs this project as a JVM application
jit-binding-server:runShadow - Runs this project as a JVM application using the shadow jar
jit-binding-server:startShadowScripts - Creates OS specific scripts to run the project as a JVM application using the shadow jar
Build tasks
-----------
assemble - Assembles the outputs of this project.
action-binding-generator:assemble - Assembles the outputs of this project.
automation:code-generator:assemble - Assembles the outputs of this project.
github-workflows-kt:assemble - Assembles the outputs of this project.
jit-binding-server:assemble - Assembles the outputs of this project.
maven-binding-builder:assemble - Assembles the outputs of this project.
...
- 主要言語
- Kotlin
- スター
- 665
- フォーク
- 30
- 平均マージ
- 6分
- マージ済み PR(30日)
- 10
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
typesafegithub/github-workflows-kt のほかの issue
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
typesafegithub/github-workflows-kt#2389 · コメント 7 件 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 3/5 1〜2日 初心者へのやさしさ 42/100
typesafegithub/github-workflows-kt#2368 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
problem
難易度 4/5 3〜5日 初心者へのやさしさ 42/100
typesafegithub/github-workflows-kt#2348 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Use a lib to interact with GitHub対応中かも @LeoColman が 556 日前に担当しました。 オープンoperational
typesafegithub/github-workflows-kt#1884 · 担当者 1 名 ·
メンテナーはふだん 1 日以内に返信
-
problem
難易度 3/5 1〜2日 初心者へのやさしさ 30/100
typesafegithub/github-workflows-kt#1864 · コメント 5 件 ·
メンテナーはふだん 1 日以内に返信
typesafegithub/github-workflows-kt の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 79/100
supabase-community/supabase-kt#1413 ·
メンテナーはふだん 5 日以内に返信
-
[Submission] 抖音火山版オープンsubmit-adaption submit-adaption-pre
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
BetterAndroid/android-notification-icon-project#744 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
utopia-rise/godot-jvm#1004 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
pedroSG94/RootEncoder#2213 ·
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
elm-tooling/intellij-elm#85 · コメント 1 件 ·