Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
first really simple implementatation of a devices mojo
- Loading branch information
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/main/java/com/jayway/maven/plugins/android/standalonemojos/DevicesMojo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package com.jayway.maven.plugins.android.standalonemojos; | ||
|
||
import com.android.ddmlib.IDevice; | ||
import com.jayway.maven.plugins.android.AbstractAndroidMojo; | ||
import com.jayway.maven.plugins.android.DeviceCallback; | ||
import com.jayway.maven.plugins.android.common.DeviceHelper; | ||
import org.apache.maven.plugin.MojoExecutionException; | ||
import org.apache.maven.plugin.MojoFailureException; | ||
|
||
/** | ||
* DevicesMojo lists all attached devices and emulators found with the android debug bridge. | ||
* | ||
* @author Manfred Moser <manfred@simpligility.com> | ||
* @goal devices | ||
* @requiresProject false | ||
*/ | ||
public class DevicesMojo extends AbstractAndroidMojo { | ||
/** | ||
* Display a list of attached devices. | ||
* | ||
* @throws org.apache.maven.plugin.MojoExecutionException | ||
* @throws org.apache.maven.plugin.MojoFailureException | ||
*/ | ||
public void execute() throws MojoExecutionException, MojoFailureException { | ||
doWithDevices( | ||
new DeviceCallback() { | ||
public void doWithDevice(final IDevice device) throws MojoExecutionException { | ||
getLog().info(DeviceHelper.getDescriptiveNameWithStatus(device)); | ||
} | ||
} | ||
); | ||
} | ||
|
||
} |