Skip to content

Commit

Permalink
[FIXED JENKINS-13205] Ensure AVDs starting from snapshot have a clean…
Browse files Browse the repository at this point in the history
… SD card.
  • Loading branch information
orrc committed Mar 25, 2012
1 parent cef80e2 commit 9a32907
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions src/main/java/hudson/plugins/android_emulator/EmulatorConfig.java
Expand Up @@ -372,11 +372,23 @@ public Boolean call() throws AndroidEmulatorException {
if (emulatorExists) {
// AVD exists: check whether there's anything still to be set up
File sdCardFile = new File(getAvdDirectory(homeDir), "sdcard.img");
if (getSdCardSize() != null && !sdCardFile.exists()) {
createSdCard = true;
boolean sdCardRequired = getSdCardSize() != null;

// Check if anything needs to be done for snapshot-enabled builds
if (shouldUseSnapshots() && androidSdk.supportsSnapshots()) {
if (!snapshotsFile.exists()) {
createSnapshot = true;
}

// We should ensure that we start out with a clean SD card for the build
if (sdCardRequired && sdCardFile.exists()) {
sdCardFile.delete();
}
}
if (shouldUseSnapshots() && androidSdk.supportsSnapshots() && !snapshotsFile.exists()) {
createSnapshot = true;

// Flag that we need to generate an SD card, if there isn't one existing
if (sdCardRequired && !sdCardFile.exists()) {
createSdCard = true;
}

// If everything is ready, then return
Expand Down

0 comments on commit 9a32907

Please sign in to comment.