Skip to content

Commit

Permalink
build: use absolute path to docker executable
Browse files Browse the repository at this point in the history
At least on Mac with temurin 21 the executable isn't found if no absolute path is used.
  • Loading branch information
slisson committed Feb 19, 2025
1 parent 0c8d851 commit cb50e92
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions model-client/integration-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ kotlin {
}
}

dockerCompose {
dockerExecutable = findExecutableAbsolutePath("docker").also { println("docker: $it") }
}

// The tasks "jsNodeTest" and "jsBrowserTest" are of this type.
tasks.withType(KotlinTest::class).all {
dockerCompose.isRequiredBy(this)
Expand All @@ -55,3 +59,12 @@ tasks.withType(KotlinTest::class).all {
tasks.withType(Test::class).all {
dockerCompose.isRequiredBy(this)
}

fun findExecutableAbsolutePath(name: String): String {
return System.getenv("PATH")
?.split(File.pathSeparatorChar)
?.map { File(it).resolve(name) }
?.firstOrNull { it.isFile && it.exists() }
?.absolutePath
?: name
}

0 comments on commit cb50e92

Please sign in to comment.