Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 <reified T> Project.configureIfExists(fn: T.() -> Unit) {
extensions.findByType(T::class.java)?.fn()
}
22 changes: 22 additions & 0 deletions modules/gradle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import java.util.Properties
import java.io.File
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile

plugins {
Expand Down Expand Up @@ -25,6 +27,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")
?: rootGradleProperties.getProperty("storytale.deploy.version")
?: error("'storytale.deploy.version' was not set")

val emptyJavadocJar by tasks.registering(Jar::class) {
archiveClassifier.set("javadoc")
}
Expand All @@ -39,6 +51,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<KotlinJvmCompile>().configureEach {
Expand Down
2 changes: 2 additions & 0 deletions modules/gradle-plugin/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
rootProject.name = "gradle-plugin"

dependencyResolutionManagement {
repositories {
google()
Expand Down
Loading