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

--HG--
extra : commitid : I3RSwiXPTu6
extra : rebase_source : 2f7f0fd8be407b362fb24d7ed9b973904da39018
extra : histedit_source : 6098651b86b5cdb2f582699bba714fdf859972e8
This commit is contained in:
vivek 2015-09-12 01:08:18 +03:00
parent e14e6546fa
commit 4538813650

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')) {