From f63c93224333d04810416bf777a7c89763af63f0 Mon Sep 17 00:00:00 2001 From: "Oleksandr.Karpovich" Date: Thu, 28 May 2026 12:21:26 +0200 Subject: [PATCH 1/2] fix: include gradle-plugin in publishToMavenLocal and ComposeRepo publishing The gradle-plugin module is included as a composite build via includeBuild() to provide automatic plugin substitution for the examples module. However, root-level tasks and subproject configurations don't propagate to composite builds, causing the plugin to be silently skipped during publishing. - Add root aggregate tasks for publishToMavenLocal and publishAllPublicationsToComposeRepoRepository that explicitly depend on the composite build's corresponding tasks - Configure version and ComposeRepo repository directly in the gradle-plugin build, since the root subprojects {} block doesn't apply to it - Add rootProject.name in the gradle-plugin settings.gradle.kts --- build.gradle.kts | 33 +++++++++++++++++++++++ modules/gradle-plugin/build.gradle.kts | 12 +++++++++ modules/gradle-plugin/settings.gradle.kts | 2 ++ 3 files changed, 47 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index c6e7631..7402cd4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -63,6 +63,39 @@ subprojects { } } +// includeBuild() provides automatic plugin substitution but root tasks +// don't propagate to composite builds. Wire in the gradle-plugin publish. +// We use afterEvaluate to ensure all plugins are applied before we reference tasks. +gradle.projectsEvaluated { + tasks.register("publishToMavenLocal") { + group = "publishing" + description = "Publish all modules (including gradle-plugin) to Maven Local" + + // Depend on subprojects that have maven-publish applied + subprojects.forEach { subproject -> + if (subproject.plugins.hasPlugin("maven-publish")) { + dependsOn(subproject.tasks.named("publishToMavenLocal")) + } + } + // Also publish the gradle-plugin composite build + dependsOn(gradle.includedBuild("gradle-plugin").task(":publishToMavenLocal")) + } + + tasks.register("publishAllPublicationsToComposeRepoRepository") { + group = "publishing" + description = "Publish all modules (including gradle-plugin) to ComposeRepo" + + // Depend on subprojects that have the ComposeRepo task + subprojects.forEach { subproject -> + if (subproject.tasks.findByName("publishAllPublicationsToComposeRepoRepository") != null) { + dependsOn(subproject.tasks.named("publishAllPublicationsToComposeRepoRepository")) + } + } + // Also publish the gradle-plugin composite build + dependsOn(gradle.includedBuild("gradle-plugin").task(":publishAllPublicationsToComposeRepoRepository")) + } +} + inline fun Project.configureIfExists(fn: T.() -> Unit) { extensions.findByType(T::class.java)?.fn() } diff --git a/modules/gradle-plugin/build.gradle.kts b/modules/gradle-plugin/build.gradle.kts index e24b4e8..2adf9e2 100644 --- a/modules/gradle-plugin/build.gradle.kts +++ b/modules/gradle-plugin/build.gradle.kts @@ -24,6 +24,8 @@ dependencies { } group = "org.jetbrains.compose.storytale" +version = findProperty("storytale.deploy.version") + ?: "unspecified" val emptyJavadocJar by tasks.registering(Jar::class) { archiveClassifier.set("javadoc") @@ -39,6 +41,16 @@ publishing { artifact(emptyJavadocJar) } } + repositories { + maven { + name = "ComposeRepo" + setUrl(System.getenv("COMPOSE_REPO_URL")) + credentials { + username = System.getenv("COMPOSE_REPO_USERNAME") + password = System.getenv("COMPOSE_REPO_KEY") + } + } + } } tasks.withType().configureEach { diff --git a/modules/gradle-plugin/settings.gradle.kts b/modules/gradle-plugin/settings.gradle.kts index df14551..939d055 100644 --- a/modules/gradle-plugin/settings.gradle.kts +++ b/modules/gradle-plugin/settings.gradle.kts @@ -1,3 +1,5 @@ +rootProject.name = "gradle-plugin" + dependencyResolutionManagement { repositories { google() From 0c36d363f27e9d5cc5d3b1421ad75c85e8a8a5a4 Mon Sep 17 00:00:00 2001 From: "Oleksandr.Karpovich" Date: Thu, 28 May 2026 12:31:05 +0200 Subject: [PATCH 2/2] fix: read `storytale.deploy.version` from root gradle.properties as fallback Ensure versioning works in composite builds by loading `storytale.deploy.version` from the root `gradle.properties` file if not set locally. --- modules/gradle-plugin/build.gradle.kts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/modules/gradle-plugin/build.gradle.kts b/modules/gradle-plugin/build.gradle.kts index 2adf9e2..9a209ad 100644 --- a/modules/gradle-plugin/build.gradle.kts +++ b/modules/gradle-plugin/build.gradle.kts @@ -1,3 +1,5 @@ +import java.util.Properties +import java.io.File import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile plugins { @@ -24,8 +26,16 @@ dependencies { } group = "org.jetbrains.compose.storytale" + +// Composite builds don't inherit properties from the root project. +// Read from the root's gradle.properties as a fallback. +val rootGradleProperties = Properties().apply { + val rootProps = rootProject.rootDir.toPath().resolve("../../gradle.properties").toFile() + if (rootProps.exists()) load(rootProps.inputStream()) +} version = findProperty("storytale.deploy.version") - ?: "unspecified" + ?: rootGradleProperties.getProperty("storytale.deploy.version") + ?: error("'storytale.deploy.version' was not set") val emptyJavadocJar by tasks.registering(Jar::class) { archiveClassifier.set("javadoc")