Cleanup android build folder, and make it a new tmp folder each time.

This commit is contained in:
jdf
2010-03-08 21:14:23 +00:00
parent b488f2da40
commit 32db8f48ea
2 changed files with 43 additions and 39 deletions
@@ -191,48 +191,51 @@ public class AndroidTool implements Tool, DeviceListener {
if (!build.createProject()) {
return;
}
try {
if (monitor.isCanceled()) {
throw new Cancelled();
}
monitor.setNote("Building...");
if (!build.antBuild("debug")) {
return;
}
if (monitor.isCanceled()) {
throw new Cancelled();
}
monitor.setNote("Building...");
if (!build.antBuild("debug")) {
return;
}
if (monitor.isCanceled()) {
throw new Cancelled();
}
monitor.setNote("Waiting for device to become available...");
final AndroidDevice device = waitForDevice(deviceFuture, monitor);
if (device == null || !device.isAlive()) {
editor.statusError("Device killed or disconnected.");
return;
}
if (monitor.isCanceled()) {
throw new Cancelled();
}
monitor.setNote("Waiting for device to become available...");
final AndroidDevice device = waitForDevice(deviceFuture, monitor);
if (device == null || !device.isAlive()) {
editor.statusError("Device killed or disconnected.");
return;
}
device.addListener(this);
device.addListener(this);
if (monitor.isCanceled()) {
throw new Cancelled();
}
monitor.setNote("Installing sketch on " + device.getId());
if (!device.installApp(build.getPathForAPK("debug"), editor)) {
editor.statusError("Device killed or disconnected.");
return;
}
if (monitor.isCanceled()) {
throw new Cancelled();
}
monitor.setNote("Installing sketch on " + device.getId());
if (!device.installApp(build.getPathForAPK("debug"), editor)) {
editor.statusError("Device killed or disconnected.");
return;
}
if (monitor.isCanceled()) {
throw new Cancelled();
}
monitor.setNote("Starting sketch on " + device.getId());
if (startSketch(device)) {
editor.statusNotice("Sketch launched on the "
+ (device.isEmulator() ? "emulator" : "phone") + ".");
} else {
editor.statusError("Could not start the sketch.");
}
if (monitor.isCanceled()) {
throw new Cancelled();
lastRunDevice = device;
} finally {
build.cleanup();
}
monitor.setNote("Starting sketch on " + device.getId());
if (startSketch(device)) {
editor.statusNotice("Sketch launched on the "
+ (device.isEmulator() ? "emulator" : "phone") + ".");
} else {
editor.statusError("Could not start the sketch.");
}
lastRunDevice = device;
} finally {
monitor.close();
}
@@ -35,7 +35,8 @@ class ProcessHelper {
this.cmd = cmd;
}
public String getCommand() {
@Override
public String toString() {
final StringBuffer buffer = new StringBuffer();
for (int i = 0; i < cmd.length; i++) {
if (i != 0) {
@@ -57,9 +58,9 @@ class ProcessHelper {
final StringWriter errWriter = new StringWriter();
final long startTime = System.currentTimeMillis();
final String prettyCommand = getCommand();
final String prettyCommand = toString();
System.err.println("ProcessHelper: >>>>> " + Thread.currentThread().getId()
+ " " + cmd[0]);
+ " " + prettyCommand);
final Process process = Runtime.getRuntime().exec(cmd);
ProcessRegistry.watch(process);
try {