Skip to content

Instantly share code, notes, and snippets.

@Ghedeon
Created January 25, 2015 13:12
Show Gist options
  • Save Ghedeon/affdc95aeafafe6684cd to your computer and use it in GitHub Desktop.
Save Ghedeon/affdc95aeafafe6684cd to your computer and use it in GitHub Desktop.
import com.android.builder.testing.ConnectedDeviceProvider
def DEVICES_PROPERTY = "devices"
ConnectedDeviceProvider.metaClass.getProperty = { String name ->
def metaProperty = delegate.metaClass.getMetaProperty(name)
def property = metaProperty.getProperty(delegate)
if (name.equals(DEVICES_PROPERTY) && project.hasProperty(DEVICES_PROPERTY)) {
def devicesSerials = project.getProperties().get(DEVICES_PROPERTY).split(/,/)
def devices = property.findAll {devicesSerials.contains(it.serialNumber)}
property = devices
}
property
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment