mustRunAfter not working as expected

My goal is to specify our CI build in our build.gradle file so we get the benefits of version control for our build. As such, I am attempting to recreate our CI build with a single Gradle task. That task, buildDevelop, depends on four other tasks, as you can see below. Those tasks don’t necessarily have inter-dependencies, so I am using mustRunAfter to specify ordering. Furthermore, this is an Android project, so some of the tasks are created in the configuration phase (so I’m specifying the ordering in the afterEvaluate closure).

Despite clearly specifying the ordering, when I look at the task graph, connectedDebugAndroidTest insists on occurring before testDebugUnitTest. Any ideas why?

task buildDevelop {
    dependsOn 'uninstallAll', 'clean', 'testDebugUnitTest', 'connectedDebugAndroidTest'
}
afterEvaluate {
    // These tasks are created in the configuration phase, so I have to specify this ordering inside this block
    clean.mustRunAfter uninstallAll
    testDebugUnitTest.mustRunAfter clean
    connectedDebugAndroidTest.mustRunAfter testDebugUnitTest
}

Bump. @etiennestuder, sorry to disturb. Any thoughts?

Hi Tony

Someone from the Gradle Core team will be better suited to answer your question.

Etienne