Skip to content

Commit

Permalink
version 0.0.8s
Browse files Browse the repository at this point in the history
removed unused code.
cleaned up sources
set default console logging to INFO
prepared adb instances for Windows/Linux/Mac OSX
updated libraries versions
updated mvn config to generate OS bundles with adb packed
updated Java version to 1.8
updated README with additional info about OS bundles
  • Loading branch information
xSAVIKx committed Dec 24, 2016
1 parent eb9d176 commit 8b8589b
Show file tree
Hide file tree
Showing 52 changed files with 481 additions and 714 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ To use JNLP, please follow this article: [How can I configure the Exception Site

## Building and running from source

This project requires at least Java 7 and Maven 3.2.5.
This project requires at least Java 8 and Maven 3.2.5.

After cloning the project, run `mvn package`.
After cloning the project, run `mvn install`.

The resulting artifacts will be created in the `target` subdirectory.

Expand All @@ -52,6 +52,11 @@ the current version.

For example, `java -jar target/androidscreencast-0.0.7s-executable.jar`.

Additionally OS-packages would be created with ADB executables bundled:
* `androidscreencast-VERSION-windows.zip`
* `androidscreencast-VERSION-linux.tar.gz`
* `androidscreencast-VERSION-macosx.tar.gz`

# Requirements

Currently AndroidScreencast works directly with `adb input` program through `ddmlib` and abuse functionality of:
Expand All @@ -63,7 +68,7 @@ Regarding this point, to use AndroidScreencast you need Smartphone running on An

So, right now AndroidScreencast support all Android versions equal or greater than Android 4.1.1.

Also, to run AndroidScreencast you will need adb installed (or you can use bundled in [androidscreencast.7z][latest_release] adb).
Also, to run AndroidScreencast you will need *adb* installed (or you can use bundled in OS bundles adb).

[Android_4_1_1_Input]: http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.1.1_r1/com/android/commands/input/Input.java#Input

Expand Down
Binary file added adb/linux/adb
Binary file not shown.
Binary file added adb/linux/fastboot
Binary file not shown.
Binary file added adb/macosx/adb
Binary file not shown.
Binary file added adb/macosx/fastboot
Binary file not shown.
Binary file added adb/windows/AdbWinApi.dll
Binary file not shown.
Binary file added adb/windows/AdbWinUsbApi.dll
Binary file not shown.
Binary file added adb/windows/adb.exe
Binary file not shown.
Binary file added adb/windows/fastboot.exe
Binary file not shown.
2 changes: 1 addition & 1 deletion app.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
adb.path=adb.exe
adb.path=adb/windows/adb.exe
default.window.width=1024
default.window.height=768
Binary file removed lib/AdbWinApi.dll
Binary file not shown.
Binary file removed lib/AdbWinUsbApi.dll
Binary file not shown.
Binary file removed lib/adb.exe
Binary file not shown.
Binary file removed lib/fastboot.exe
Binary file not shown.
71 changes: 47 additions & 24 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,69 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.github.xsavikx</groupId>
<artifactId>androidscreencast</artifactId>
<version>0.0.7s</version>
<version>0.0.8s</version>
<name>Android Screencast</name>
<properties>
<spring-version>4.2.6.RELEASE</spring-version>
<ddmlib-version>25.1.0</ddmlib-version>
<log4j-version>1.2.17</log4j-version>
<main-class>com.github.xsavikx.androidscreencast.Main</main-class>
<jdk-version>1.7</jdk-version>
<spring.version>4.3.1.RELEASE</spring.version>
<ddmlib.version>25.2.0</ddmlib.version>
<log4j.version>1.2.17</log4j.version>
<main.class>com.github.xsavikx.androidscreencast.Main</main.class>
<jdk.version>1.8</jdk.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<adb.folder>${project.basedir}/adb</adb.folder>
<adb.folder.linux>${adb.folder}/linux</adb.folder.linux>
<adb.folder.windows>${adb.folder}/windows</adb.folder.windows>
<adb.folder.macosx>${adb.folder}/macosx</adb.folder.macosx>
</properties>
<dependencies>
<dependency>
<groupId>com.android.tools.ddms</groupId>
<artifactId>ddmlib</artifactId>
<version>${ddmlib-version}</version>
<version>${ddmlib.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j-version}</version>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring-version}</version>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring-version}</version>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring-version}</version>
<version>${spring.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<version>3.6.0</version>
<configuration>
<source>${jdk-version}</source>
<target>${jdk-version}</target>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifest>
<mainClass>${main.class}</mainClass>
</manifest>
</archive>
</configuration>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
Expand All @@ -67,25 +82,33 @@
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>${main-class}</mainClass>
<mainClass>${main.class}</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<archive>
<manifest>
<mainClass>${main-class}</mainClass>
</manifest>
</archive>
<descriptors>
<descriptor>src/assembly/windows.xml</descriptor>
<descriptor>src/assembly/linux.xml</descriptor>
<descriptor>src/assembly/macosx.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>verify</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Expand Down
30 changes: 30 additions & 0 deletions src/assembly/linux.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<assembly xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>linux</id>
<formats>
<format>tar.gz</format>
</formats>
<fileSets>
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory/>
<includes>
<include>README*</include>
<include>LICENSE*</include>
<include>NOTICE*</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory/>
<includes>
<include>androidscreencast*executable.jar</include>
</includes>
</fileSet>
<fileSet>
<directory>${adb.folder.linux}</directory>
<outputDirectory/>
</fileSet>
</fileSets>
</assembly>
30 changes: 30 additions & 0 deletions src/assembly/macosx.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<assembly xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>macosx</id>
<formats>
<format>tar.gz</format>
</formats>
<fileSets>
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory/>
<includes>
<include>README*</include>
<include>LICENSE*</include>
<include>NOTICE*</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory/>
<includes>
<include>androidscreencast*executable.jar</include>
</includes>
</fileSet>
<fileSet>
<directory>${adb.folder.macosx}</directory>
<outputDirectory/>
</fileSet>
</fileSets>
</assembly>
30 changes: 30 additions & 0 deletions src/assembly/windows.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<assembly xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://maven.apache.org/ASSEMBLY/2.0.0"
xsi:schemaLocation="http://maven.apache.org/ASSEMBLY/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
<id>windows</id>
<formats>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<directory>${project.basedir}</directory>
<outputDirectory/>
<includes>
<include>README*</include>
<include>LICENSE*</include>
<include>NOTICE*</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.build.directory}</directory>
<outputDirectory/>
<includes>
<include>androidscreencast*executable.jar</include>
</includes>
</fileSet>
<fileSet>
<directory>${adb.folder.windows}</directory>
<outputDirectory/>
</fileSet>
</fileSets>
</assembly>
14 changes: 8 additions & 6 deletions src/main/java/com/github/xsavikx/androidscreencast/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ public class Main {

public static void main(String args[]) {
LOGGER.debug("main(String[] args=" + Arrays.toString(args) + ") - start");
Application application = ApplicationContextProvider.getApplicationContext()
.getBean(AndroidScreencastApplication.class);
application.init();
application.start();

LOGGER.debug("main(String[] args=" + Arrays.toString(args) + ") - end");
Application application;
try {
application = ApplicationContextProvider.getBean(AndroidScreencastApplication.class);
application.init();
application.start();
} finally {
LOGGER.debug("main(String[] args=" + Arrays.toString(args) + ") - end");
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.android.ddmlib.SyncService.ISyncProgressMonitor;
import com.github.xsavikx.androidscreencast.api.file.FileInfo;
import com.github.xsavikx.androidscreencast.api.injector.OutputStreamShellOutputReceiver;
import com.github.xsavikx.androidscreencast.exception.ExecuteCommandException;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
Expand All @@ -18,13 +19,9 @@
@Component
public class AndroidDeviceImpl implements AndroidDevice {
private static final Logger logger = Logger.getLogger(AndroidDeviceImpl.class);
@Autowired(required = false)
private IDevice device;

public AndroidDeviceImpl() {

}
private final IDevice device;

@Autowired(required = false)
public AndroidDeviceImpl(IDevice device) {
this.device = device;
}
Expand All @@ -46,7 +43,7 @@ public String executeCommand(String cmd) {
} catch (Exception ex) {
logger.error("executeCommand(String)", ex);

throw new RuntimeException(ex);
throw new ExecuteCommandException(cmd);
}
}

Expand All @@ -64,15 +61,12 @@ public List<FileInfo> list(String path) {
String[] data = entry.split(" ");
if (data.length < 4)
continue;
/*
* for(int j=0; j<data.length; j++) { System.out.println(j+" = " +data[j]); }
*/
String attribs = data[0];
boolean directory = attribs.startsWith("d");
String attributes = data[0];
boolean directory = attributes.startsWith("d");
String name = data[data.length - 1];

FileInfo fi = new FileInfo();
fi.attribs = attribs;
fi.attribs = attributes;
fi.directory = directory;
fi.name = name;
fi.path = path;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ public TapCommand(int x, int y) {

@Override
protected String getCommandPart() {
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("tap ").append(x).append(' ').append(y);
return stringBuilder.toString();
return "tap " + x + ' ' + y;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@
public class ShellCommandExecutor implements CommandExecutor {
private static final Logger LOGGER = Logger.getLogger(ShellCommandExecutor.class);
private static final int MAX_TIME_TO_WAIT_RESPONSE = 5;
private final IDevice device;

@Autowired
private IDevice device;
public ShellCommandExecutor(IDevice device) {
this.device = device;
}

@Override
public void execute(Command command) {
Expand Down
Loading

0 comments on commit 8b8589b

Please sign in to comment.