Saturday, July 25, 2015

The CodeQA Trick,Android and Gradle

Okay, so I will give the mock-like code to enable codeQA on your buildtypes/buildvariants:


gradle.taskGraph.whenReady {taskgraph ->
if(taskGraph.hasTask(preBuild)){
//than we do codeqa on main sourcesets
}
if(taskGraph.hasTask(preDebugBuild)){
//than do codeqa on debug sourcesets
}
if(taskGrap.hasTask(preReleaseBuild)){
//than do codeqa on release sourcesets
}
}


You put the codeqa task and the checkDependsOn(youttask) in the if bracket. your preNameBuild gets named for the particular build type or build variant. Its a in-elegant hack but it works.