Bug 1182193 - Part 4: Disable unit test for regular gradle build tasks r=nalexander

This commit is contained in:
vivek 2015-09-12 01:08:18 +03:00
parent 4d1fd0b359
commit a4ebe821fd

View File

@ -59,6 +59,16 @@ task generateCodeAndResources(type:Exec) {
}
}
// Skip unit test for all build variants, unless if it was specifically requested by user.
// The enabled property for the unit test tasks is reset based on the command line task names just before the task execution.
// I bet there is a easier/cleaner way to do this, but this gets the job done for now.
gradle.taskGraph.beforeTask {
Task task ->
if (task.name.startsWith('test') && task.name.endsWith('UnitTest')) {
task.enabled = gradle.startParameter.taskNames.contains('test')
}
}
afterEvaluate {
subprojects {
if (!hasProperty('android')) {