Skip to content

Commit

Permalink
Use TaskCollection.named overload taking Spec (#1)
Browse files Browse the repository at this point in the history
Use the new TaskCollection.named method taking a Spec for depending on
tasks that might not exist.

See https://docs.gradle.org/8.6/release-notes.html#lazy-name-based-filtering-of-tasks
  • Loading branch information
lukellmann authored Mar 4, 2024
1 parent e6a8e4b commit 3742b7a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
1 change: 1 addition & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionSha256Sum=9631d53cf3e74bfa726893aee1f8994fee4e060c401335946dba2156f440f24c
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
networkTimeout=10000
validateDistributionUrl=true
Expand Down
5 changes: 1 addition & 4 deletions src/main/kotlin/MultiplatformHelpers.kt
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,7 @@ fun Project.applyMultiplatformHelpers() {
}

fun Task.dependOnSafe(name: String) {
val task = project.tasks.findByName(name)
if (task != null) {
dependsOn(task)
}
dependsOn(project.tasks.named { it == name })
}

context(Project)
Expand Down

0 comments on commit 3742b7a

Please sign in to comment.