I am new to gradle and need some help.
I need to insert a task that will do some my own work into a pre-existing build, the Android Studio build. I want my task to be executed before an existing task in the build for example, the compileDebugJavaWithJavac task.
My thought is to modify the dependencies of the tasks to do this:
- get the dependsOn of the compileDebugJavaWithJavac and save it to variable
- set the dependsOn of myTask to the variable
- set the dependsOn of the compileDebugJavaWithJavac to myTask
Is this the right way to do it in gradle?
I tried to add the below to the build file, but I get compileDebugJavaWithJavac is unknown property. However, the compileDebugJavaWithJavac can be resolved if I use it in myTask. Do I need to do something before using the compileDebugJavaWithJavac?
def origDepdencies = tasks.compileDebugJavaWithJavac.getDependsOn();
def origDepdencies = compileDebugJavaWithJavac.getDependsOn();
Thank you in advanced.