Scrungepipes
Scrungepipes

Reputation: 37600

How to add a preBuild dependency on a task in an external build script?

In my main grade.build file I have the following:

...
preBuild.dependsOn 'copyConfigFile'

task copyConfigFile(type: Copy) {...}

apply from: 'dirLocation/other.gradle'

import com.android.builder.core.DefaultManifestParser
android {...}

There is a task in other.grade which I tried add as another preBuild dependency but gradle says the task can't be found in project :app.

Upvotes: 0

Views: 1205

Answers (1)

Michael Hobbs
Michael Hobbs

Reputation: 1693

You can use gradle.taskGraph.whenReady, here is an example:

task installDebug
gradle.taskGraph.whenReady {
   installDebug.dependsOn 'projectA:projectB:installDebugExecutable'
}

Upvotes: 1

Related Questions