From c12970561f2eba44b1e5d5748e3ab57a963b0775 Mon Sep 17 00:00:00 2001 From: Ryan Harter Date: Mon, 9 Dec 2024 16:50:59 -0600 Subject: [PATCH] Adds alternative build directory. --- dropshots-gradle-plugin/build.gradle.kts | 10 +++++++++- model/build.gradle.kts | 9 +++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/dropshots-gradle-plugin/build.gradle.kts b/dropshots-gradle-plugin/build.gradle.kts index faf4fd5..5848768 100644 --- a/dropshots-gradle-plugin/build.gradle.kts +++ b/dropshots-gradle-plugin/build.gradle.kts @@ -8,12 +8,20 @@ plugins { alias(libs.plugins.dokka) alias(libs.plugins.binaryCompatibilityValidator) } - +// This module is included in two projects: +// - In the root project where it's released as one of our artifacts +// - In build-logic project where we can use it for the runtime and samples. +// +// We only want to publish when it's being built in the root project. if (rootProject.name == "dropshots-root") { apply(plugin = libs.plugins.mavenPublish.get().pluginId) extensions.configure { configure(GradlePlugin(Dokka("dokkaJavadoc"))) } +} else { + // Move the build directory when included in build-support so as to not poison the real build. + // If we don't the configuration cache is broken and all tasks are considered not up-to-date. + layout.buildDirectory = File(rootDir, "build/dropshots-gradle-plugin") } val generateVersionTask = tasks.register("generateVersion") { diff --git a/model/build.gradle.kts b/model/build.gradle.kts index f172bfe..df67e1c 100644 --- a/model/build.gradle.kts +++ b/model/build.gradle.kts @@ -5,8 +5,17 @@ plugins { alias(libs.plugins.binaryCompatibilityValidator) } +// This module is included in two projects: +// - In the root project where it's released as one of our artifacts +// - In build-logic project where we can use it for the runtime and samples. +// +// We only want to publish when it's being built in the root project. if (rootProject.name == "dropshots-root") { apply(plugin = libs.plugins.mavenPublish.get().pluginId) +} else { + // Move the build directory when included in build-support so as to not poison the real build. + // If we don't the configuration cache is broken and all tasks are considered not up-to-date. + layout.buildDirectory = File(rootDir, "build/model") } kotlin {