From daa8ac3d919beab9e2f49e18d1548a6458c8a38b Mon Sep 17 00:00:00 2001 From: Zac Sweers Date: Tue, 29 Oct 2024 13:22:23 -0400 Subject: [PATCH] Don't depend on build sources in mod score if `MODULE_SCORE_INCLUDE_GENERATED` is false (#1065) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Otherwise this would fail to execute because the dir doesn't exist --- CHANGELOG.md | 2 ++ .../src/main/kotlin/foundry/gradle/stats/ModuleStats.kt | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b2effe8d..af00f400c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,8 @@ Changelog **Unreleased** -------------- +* **Fix**: Don't depend on build sources in mod score if `MODULE_SCORE_INCLUDE_GENERATED` is false + 0.21.0 ------ diff --git a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/stats/ModuleStats.kt b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/stats/ModuleStats.kt index b23ad271a..542c44358 100644 --- a/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/stats/ModuleStats.kt +++ b/platforms/gradle/foundry-gradle-plugin/src/main/kotlin/foundry/gradle/stats/ModuleStats.kt @@ -162,8 +162,10 @@ public object ModuleStatsTasks { val generatedSourcesAdded = AtomicBoolean() val addGeneratedSources = { - if (locTask != null && generatedSourcesAdded.compareAndSet(false, true)) { - locTask.configure { + val shouldConfigure = + locTask != null && generatedSourcesAdded.compareAndSet(false, true) && includeGenerated + if (shouldConfigure) { + locTask!!.configure { generatedSrcsDir.setDisallowChanges(project.layout.buildDirectory.dir("generated")) } }