Skip to content

Commit

Permalink
The 'right' way to disable build tasks that should not be there
Browse files Browse the repository at this point in the history
  • Loading branch information
deusaquilus committed Sep 11, 2024
1 parent 5f0455f commit 367d184
Showing 1 changed file with 21 additions and 14 deletions.
35 changes: 21 additions & 14 deletions build-logic/src/main/kotlin/nativebuild.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,28 @@ repositories {
//tasks.named("mingwX64Test") { enabled = HostManager.hostIsMingw }
//tasks.named("linkDebugTestMingwX64") { enabled = HostManager.hostIsMingw }

tasks.all {
if (name.contains("linuxX64Test")) {
enabled = HostManager.hostIsLinux
}
if (name.contains("linkDebugTestLinuxX64")) {
enabled = HostManager.hostIsLinux
}
if (name.contains("mingwX64Test")) {
enabled = HostManager.hostIsMingw
}
if (name.contains("linkDebugTestMingwX64")) {
enabled = HostManager.hostIsMingw
}
}

// -- Not supposed to do it this way because it breaks the task-configuration avoidance
// tasks.all {
// if (name.contains("linuxX64Test")) {
// enabled = HostManager.hostIsLinux
// }
// if (name.contains("linkDebugTestLinuxX64")) {
// enabled = HostManager.hostIsLinux
// }
// if (name.contains("mingwX64Test")) {
// enabled = HostManager.hostIsMingw
// }
// if (name.contains("linkDebugTestMingwX64")) {
// enabled = HostManager.hostIsMingw
// }
// }

// Supposed to do it like this
tasks.named { it == "linuxX64Test" }.configureEach { enabled = HostManager.hostIsLinux }
tasks.named { it == "linkDebugTestLinuxX64" }.configureEach { enabled = HostManager.hostIsLinux }
tasks.named { it == "mingwX64Test" }.configureEach { enabled = HostManager.hostIsMingw }
tasks.named { it == "linkDebugTestMingwX64" }.configureEach { enabled = HostManager.hostIsMingw }


kotlin {
Expand Down

0 comments on commit 367d184

Please sign in to comment.