You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by si...@apache.org on 2007/11/18 03:08:37 UTC

svn commit: r596039 - in /maven/sandbox/trunk/plugins/maven-android/maven-adb-plugin/src/main/java/org/apache/maven/plugin/adb: DeviceInstallerMojo.java DevicePullerMojo.java DevicePusherMojo.java EmulatorInstallerMojo.java

Author: sisbell
Date: Sat Nov 17 18:08:37 2007
New Revision: 596039

URL: http://svn.apache.org/viewvc?rev=596039&view=rev
Log:
Added pushing and pulling files/dir to/from device.

Added:
    maven/sandbox/trunk/plugins/maven-android/maven-adb-plugin/src/main/java/org/apache/maven/plugin/adb/DeviceInstallerMojo.java   (with props)
    maven/sandbox/trunk/plugins/maven-android/maven-adb-plugin/src/main/java/org/apache/maven/plugin/adb/DevicePullerMojo.java   (with props)
    maven/sandbox/trunk/plugins/maven-android/maven-adb-plugin/src/main/java/org/apache/maven/plugin/adb/DevicePusherMojo.java   (with props)
Removed:
    maven/sandbox/trunk/plugins/maven-android/maven-adb-plugin/src/main/java/org/apache/maven/plugin/adb/EmulatorInstallerMojo.java

Added: maven/sandbox/trunk/plugins/maven-android/maven-adb-plugin/src/main/java/org/apache/maven/plugin/adb/DeviceInstallerMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-android/maven-adb-plugin/src/main/java/org/apache/maven/plugin/adb/DeviceInstallerMojo.java?rev=596039&view=auto
==============================================================================
--- maven/sandbox/trunk/plugins/maven-android/maven-adb-plugin/src/main/java/org/apache/maven/plugin/adb/DeviceInstallerMojo.java (added)
+++ maven/sandbox/trunk/plugins/maven-android/maven-adb-plugin/src/main/java/org/apache/maven/plugin/adb/DeviceInstallerMojo.java Sat Nov 17 18:08:37 2007
@@ -0,0 +1,63 @@
+package org.apache.maven.plugin.adb;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.android.CommandExecutor;
+import org.apache.maven.android.ExecutionException;
+import org.apache.maven.project.MavenProject;
+
+import java.io.File;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Shane Isbell
+ * @goal install
+ * @phase install
+ * @description
+ */
+public class DeviceInstallerMojo extends AbstractMojo {
+
+    /**
+     * The maven project.
+     *
+     * @parameter expression="${project}"
+     * @required
+     * @readonly
+     */
+    private MavenProject project;
+
+    public void execute() throws MojoExecutionException, MojoFailureException {
+        CommandExecutor executor = CommandExecutor.Factory.createDefaultCommmandExecutor();
+        executor.setLogger(this.getLog());
+        File inputFile = new File("target/" + project.getArtifactId() + "-" + project.getVersion() + ".apk");
+
+        List<String> commands = new ArrayList<String>();
+        commands.add("install");
+        commands.add(inputFile.getAbsolutePath());
+        getLog().info("adb " + commands.toString());
+        try {
+            executor.executeCommand("adb", commands);
+        } catch (ExecutionException e) {
+        }
+    }
+}

Propchange: maven/sandbox/trunk/plugins/maven-android/maven-adb-plugin/src/main/java/org/apache/maven/plugin/adb/DeviceInstallerMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/sandbox/trunk/plugins/maven-android/maven-adb-plugin/src/main/java/org/apache/maven/plugin/adb/DevicePullerMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-android/maven-adb-plugin/src/main/java/org/apache/maven/plugin/adb/DevicePullerMojo.java?rev=596039&view=auto
==============================================================================
--- maven/sandbox/trunk/plugins/maven-android/maven-adb-plugin/src/main/java/org/apache/maven/plugin/adb/DevicePullerMojo.java (added)
+++ maven/sandbox/trunk/plugins/maven-android/maven-adb-plugin/src/main/java/org/apache/maven/plugin/adb/DevicePullerMojo.java Sat Nov 17 18:08:37 2007
@@ -0,0 +1,66 @@
+package org.apache.maven.plugin.adb;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.android.CommandExecutor;
+import org.apache.maven.android.ExecutionException;
+
+import java.io.File;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Shane Isbell
+ * @goal pull
+ * @requiresProject false
+ * @description
+ */
+public class DevicePullerMojo extends AbstractMojo {
+
+    /**
+     * @parameter expression="${source}"
+     * @required
+     */
+    private File sourceFileOrDirectory;
+
+    /**
+     * @parameter expression="${destination}"
+     * @required
+     */
+    private File destinationFileOrDirectory;
+
+    public void execute() throws MojoExecutionException, MojoFailureException {
+        CommandExecutor executor = CommandExecutor.Factory.createDefaultCommmandExecutor();
+        executor.setLogger(this.getLog());
+
+        List<String> commands = new ArrayList<String>();
+        commands.add("pull");
+        commands.add(sourceFileOrDirectory.getAbsolutePath());
+        commands.add(destinationFileOrDirectory.getAbsolutePath());
+
+        getLog().info("adb " + commands.toString());
+        try {
+            executor.executeCommand("adb", commands);
+        } catch (ExecutionException e) {
+        }
+    }
+}

Propchange: maven/sandbox/trunk/plugins/maven-android/maven-adb-plugin/src/main/java/org/apache/maven/plugin/adb/DevicePullerMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: maven/sandbox/trunk/plugins/maven-android/maven-adb-plugin/src/main/java/org/apache/maven/plugin/adb/DevicePusherMojo.java
URL: http://svn.apache.org/viewvc/maven/sandbox/trunk/plugins/maven-android/maven-adb-plugin/src/main/java/org/apache/maven/plugin/adb/DevicePusherMojo.java?rev=596039&view=auto
==============================================================================
--- maven/sandbox/trunk/plugins/maven-android/maven-adb-plugin/src/main/java/org/apache/maven/plugin/adb/DevicePusherMojo.java (added)
+++ maven/sandbox/trunk/plugins/maven-android/maven-adb-plugin/src/main/java/org/apache/maven/plugin/adb/DevicePusherMojo.java Sat Nov 17 18:08:37 2007
@@ -0,0 +1,66 @@
+package org.apache.maven.plugin.adb;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.plugin.AbstractMojo;
+import org.apache.maven.plugin.MojoExecutionException;
+import org.apache.maven.plugin.MojoFailureException;
+import org.apache.maven.android.CommandExecutor;
+import org.apache.maven.android.ExecutionException;
+
+import java.io.File;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * @author Shane Isbell
+ * @goal push
+ * @requiresProject false
+ * @description
+ */
+public class DevicePusherMojo extends AbstractMojo {
+
+    /**
+     * @parameter expression="${source}"
+     * @required
+     */
+    private File sourceFileOrDirectory;
+
+    /**
+     * @parameter expression="${destination}"
+     * @required
+     */
+    private File destinationFileOrDirectory;
+
+    public void execute() throws MojoExecutionException, MojoFailureException {
+        CommandExecutor executor = CommandExecutor.Factory.createDefaultCommmandExecutor();
+        executor.setLogger(this.getLog());
+
+        List<String> commands = new ArrayList<String>();
+        commands.add("push");
+        commands.add(sourceFileOrDirectory.getAbsolutePath());
+        commands.add(destinationFileOrDirectory.getAbsolutePath());
+
+        getLog().info("adb " + commands.toString());
+        try {
+            executor.executeCommand("adb", commands);
+        } catch (ExecutionException e) {
+        }
+    }
+}

Propchange: maven/sandbox/trunk/plugins/maven-android/maven-adb-plugin/src/main/java/org/apache/maven/plugin/adb/DevicePusherMojo.java
------------------------------------------------------------------------------
    svn:eol-style = native