@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
bamboo
08/24/2017, 6:14 PM
You can set the commandLine on
doFirst { ... }
f
fitzoh
08/24/2017, 6:46 PM
sweet, that works
fitzoh
08/24/2017, 6:47 PM
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")
}