<@U0QBCLV62> any thoughts on the issues I mentione...
# gradle
f
@bamboo any thoughts on the issues I mentioned last night? What I’m basically looking to do is add an exec task to a plugin which is based on the value of an extension, but the command line args are being resolved before the extension value is set
b
You can set the commandLine on
doFirst { ... }
f
sweet, that works
Copy code
@Test
    fun `it sets the image`() {
        project.extensions.getByType(MyExtension::class.java).dockerRepository = "<http://myregistry.com/some/repo|myregistry.com/some/repo>"

        val buildDockerImage = project.tasks.getByName("buildDockerImage") as Exec

        //Run the `doFirst`
        val action = buildDockerImage.actions[0] as Action<Task>
        action.execute(buildDockerImage)
        
        assertThat(buildDockerImage.commandLine)
                .containsExactly("docker", "build", "-t", "<http://myregistry.com/some/repo|myregistry.com/some/repo>", "docker")
    }
testing it is a little bit janky
but it works
m
newer versions of Gradle have the
Provider
and
PropertyState
types, which might help too