Skip to content

Commit

Permalink
Don't look for specific emulator binaries.
Browse files Browse the repository at this point in the history
Only look for the main emulator binary when validating an SDK root -
don't look for the emulator64-* binaries (only in r21+) and the -mips
and -x86 binaries (only in r12+).

This resolves JENKINS-15967.
  • Loading branch information
jorgenpt authored and orrc committed Nov 29, 2012
1 parent c6b9d98 commit 04c6fed
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
15 changes: 13 additions & 2 deletions src/main/java/hudson/plugins/android_emulator/sdk/Tool.java
Expand Up @@ -18,6 +18,10 @@ public enum Tool {
EMULATOR64_ARM, EMULATOR64_MIPS, EMULATOR64_X86
};

public static Tool[] REQUIRED = new Tool[] {
AAPT, ADB, ANDROID, EMULATOR, MKSDCARD
};

public final String executable;
public final String windowsExtension;
public final boolean isPlatformTool;
Expand All @@ -43,8 +47,15 @@ public String getExecutable(boolean isUnix) {
return executable + windowsExtension;
}

public static String[] getAllRequiredExecutableVariants() {
return getAllExecutableVariants(REQUIRED);
}

public static String[] getAllExecutableVariants() {
final Tool[] tools = values();
return getAllExecutableVariants(values());
}

private static String[] getAllExecutableVariants(final Tool[] tools) {
String[] executables = new String[tools.length * 2];
for (int i = 0, n = tools.length; i < n; i++) {
executables[i*2] = tools[i].getExecutable(true);
Expand All @@ -57,4 +68,4 @@ public static String[] getAllExecutableVariants() {
public String toString() {
return executable;
}
}
}
4 changes: 2 additions & 2 deletions src/main/java/hudson/plugins/android_emulator/util/Utils.java
Expand Up @@ -246,7 +246,7 @@ public static ValidationResult validateAndroidHome(File sdkRoot, boolean fromWeb

// Search the possible tool directories to ensure the tools exist
int toolsFound = 0;
int expectedToolCount = Tool.values().length;
int expectedToolCount = Tool.REQUIRED.length;
if (!new File(sdkRoot, "platform-tools").exists()) {
// aapt doesn't exist in "tools" until SDK Tools r9
expectedToolCount--;
Expand All @@ -257,7 +257,7 @@ public static ValidationResult validateAndroidHome(File sdkRoot, boolean fromWeb
if (!toolsDir.isDirectory()) {
continue;
}
for (String executable : Tool.getAllExecutableVariants()) {
for (String executable : Tool.getAllRequiredExecutableVariants()) {
File toolPath = new File(toolsDir, executable);
if (toolPath.exists() && toolPath.isFile()) {
toolsFound++;
Expand Down

0 comments on commit 04c6fed

Please sign in to comment.