We do it a little different here: 
https://github.com/novoda/gradle-android-command-plugin/blob/develop/gradle-android-command-plugin/src/main/groovy/com/novoda/gradle/command/AndroidCommandPluginExtension.groovy#L98