com.simpligility.maven.plugins.android.standalonemojos.DevicesMojo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of android-maven-plugin Show documentation
Show all versions of android-maven-plugin Show documentation
Maven Plugin for Android Development
The newest version!
package com.simpligility.maven.plugins.android.standalonemojos;
import com.android.ddmlib.IDevice;
import com.simpligility.maven.plugins.android.AbstractAndroidMojo;
import com.simpligility.maven.plugins.android.DeviceCallback;
import com.simpligility.maven.plugins.android.common.DeviceHelper;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Mojo;
/**
* DevicesMojo lists all attached devices and emulators found with the android debug bridge. It uses the same
* naming convention for the emulator as used in other places in the Android Maven Plugin and adds the status
* of the device in the list.
*
* TODO The goal is very simple and could be enhanced for better display, a verbose option to display and to take the
* android.device paramter into account.
*
* @author Manfred Moser - [email protected]
*/
@Mojo( name = "devices", requiresProject = false )
public class DevicesMojo extends AbstractAndroidMojo
{
/**
* Display a list of attached devices.
*
* @throws MojoExecutionException
* @throws MojoFailureException
*/
public void execute() throws MojoExecutionException, MojoFailureException
{
doWithDevices( new DeviceCallback()
{
public void doWithDevice( final IDevice device ) throws MojoExecutionException
{
getLog().info( DeviceHelper.getDescriptiveNameWithStatus( device ) );
}
} );
}
}