Output of tasks --all varies and is confusing me

plugins

(Bill Wright) #1

I was working on eliminating all the ‘<<’ in my gradle code and replacing them with doLast and one of my tests in my gradle plugin broke. It was because of what was expected from the [gradle tasks --all] command. Before the change that command outputted this:

Build tasks
assemble - Assembles the outputs of this project. [jar]
build - Assembles and tests this project. [assemble, check, dockerBuild]

After I made the change, the same command outputs this:

Build tasks
assemble - Assembles the outputs of this project. [jar]
build - Assembles and tests this project. [assemble, check]
    dockerBuild - Build a docker image

Why the change? What’s the difference between these two outputs?

The code used to form this relationship is here:

   project.afterEvaluate {
        dockerTasks = new DockerTasks(getDockerUrl())
        if (project.tasks.findByName('build')) {
            project.tasks.dockerBuild.dependsOn 'assemble'
            project.tasks.build.dependsOn project.tasks.dockerBuild
        }
  }