Android module: create emulator in tmp folder, catch exceptions during stopping emulator

This commit is contained in:
Natalia.Ukhorskaya
2012-07-05 13:09:14 +04:00
parent b1d231d0e0
commit e50abd67c5
3 changed files with 17 additions and 1 deletions
@@ -203,7 +203,13 @@ public class CodegenTestsOnAndroidRunner {
return antRunner.runTestsOnEmulator(); return antRunner.runTestsOnEmulator();
} }
finally { finally {
emulator.stopEmulator(); try {
emulator.stopEmulator();
}
catch (Throwable t) {
System.err.println("Exception during stopping emulator:");
t.printStackTrace();
}
} }
} }
@@ -16,6 +16,8 @@
package org.jetbrains.jet.compiler; package org.jetbrains.jet.compiler;
import java.io.File;
/** /**
* @author Natalia.Ukhorskaya * @author Natalia.Ukhorskaya
*/ */
@@ -34,6 +36,12 @@ public class PathManager {
return getAndroidSdkRoot() + "/platforms"; return getAndroidSdkRoot() + "/platforms";
} }
public String getAndroidEmulatorRoot() {
String androidEmulatorRoot = tmpFolder + "/emulator";
new File(androidEmulatorRoot).mkdirs();
return androidEmulatorRoot;
}
public String getPlatformToolsFolderInAndroidSdk() { public String getPlatformToolsFolderInAndroidSdk() {
return getAndroidSdkRoot() + "/platform-tools"; return getAndroidSdkRoot() + "/platform-tools";
} }
@@ -43,6 +43,8 @@ public class Emulator {
commandLine.addParameter("--force"); commandLine.addParameter("--force");
commandLine.addParameter("-n"); commandLine.addParameter("-n");
commandLine.addParameter("my_avd"); commandLine.addParameter("my_avd");
commandLine.addParameter("-p");
commandLine.addParameter(pathManager.getAndroidEmulatorRoot());
commandLine.addParameter("-t"); commandLine.addParameter("-t");
commandLine.addParameter("1"); commandLine.addParameter("1");
return commandLine; return commandLine;