Maybe I'm missing something obvious but how can I ...
# plugin-development
m
Maybe I'm missing something obvious but how can I change the working directory with Gradle's TestKit? I can see that the working dir is
/home/cchampeau/.../build/tmp/test/work/.gradle-test-kit/test-kit-daemon/8.5/
but I need to set it to the project directory
a
iirc that's set with
GradleRunner.withTestKitDir()
m
that's the directory of test kit itself, equivalent to
-g
, not the working dir
v
You are aware that it is a bug to rely on the working directory, right? Also during normal Gradle runs the working directory can be various places. For example the daemon direcory, the IDE installation directory, often the project directory, probably other places. So any build depending on the working directory is flaky at best.
1
That's probably also the reason there is no way - I know of - to set it for testkit
m
You are aware that it is a bug to rely on the working directory, right?
I was waiting for someone to say this 🙂 Yes, I'm aware, but as always, between the theory and practice... I'm reading my catalog file, which contains a plugin version. That plugin version is shared between a settings plugin and multiple project plugins. But I need to read it in the settings file. In settings.gradle.kts, you can read the file in the
plugins { ... }
block, but the code you can put in there is limited. In particular, it doesn't have access to
layout
or
settingsDirectory
, it barely has access to anything. So the only thing I can do is
Copy code
plugins {
    val pluginVersion = File("gradle/libs.versions.toml")......
    id("...") version pluginVersion