From 1d5e6972bb88e06e22586677db584244e5bfe167 Mon Sep 17 00:00:00 2001 From: Piotr Krzeminski Date: Thu, 20 Jun 2024 18:46:21 +0200 Subject: [PATCH] Print all tasks --- automation/code-generator/build.gradle.kts | 2 ++ .../workflows/ToolingApiExperiment.kt | 20 +++++++++++++++++++ buildSrc/repositories.settings.gradle.kts | 1 + 3 files changed, 23 insertions(+) create mode 100644 automation/code-generator/src/main/kotlin/io/github/typesafegithub/workflows/ToolingApiExperiment.kt diff --git a/automation/code-generator/build.gradle.kts b/automation/code-generator/build.gradle.kts index 726e248725..38c3f80572 100644 --- a/automation/code-generator/build.gradle.kts +++ b/automation/code-generator/build.gradle.kts @@ -16,6 +16,8 @@ dependencies { implementation("io.ktor:ktor-client-content-negotiation") implementation("io.ktor:ktor-serialization-kotlinx-json") implementation("io.arrow-kt:arrow-fx-coroutines:1.2.4") + implementation("org.gradle:gradle-tooling-api:8.8") + runtimeOnly("org.slf4j:slf4j-simple:1.7.10") implementation(projects.actionBindingGenerator) implementation(projects.sharedInternal) diff --git a/automation/code-generator/src/main/kotlin/io/github/typesafegithub/workflows/ToolingApiExperiment.kt b/automation/code-generator/src/main/kotlin/io/github/typesafegithub/workflows/ToolingApiExperiment.kt new file mode 100644 index 0000000000..685429efcf --- /dev/null +++ b/automation/code-generator/src/main/kotlin/io/github/typesafegithub/workflows/ToolingApiExperiment.kt @@ -0,0 +1,20 @@ +package io.github.typesafegithub.workflows + +import org.gradle.tooling.GradleConnector +import org.gradle.tooling.model.GradleProject +import java.io.File + +fun main() { + GradleConnector.newConnector() + .forProjectDirectory(File("/Users/piotr/repos/github-workflows-kt")) + .connect() + .use { gradleConnector -> + val model = gradleConnector.getModel(GradleProject::class.java) + val projects = model.children.all + projects.forEach { project -> + project.tasks.forEach { task -> + println(task) + } + } + } +} diff --git a/buildSrc/repositories.settings.gradle.kts b/buildSrc/repositories.settings.gradle.kts index c4569846e6..8c8df651c1 100644 --- a/buildSrc/repositories.settings.gradle.kts +++ b/buildSrc/repositories.settings.gradle.kts @@ -7,6 +7,7 @@ dependencyResolutionManagement { repositories { mavenCentral() gradlePluginPortal() + maven { url = uri("https://repo.gradle.org/gradle/libs-releases") } // It has to be defined here because preferring repositories config in settings apparently removes the below // additions done by Kotlin/JS plugin.