Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIXED JENKINS-18584] Add support for build-tools so aapt can be loca…
…ted in newer SDKs.
- Loading branch information
Showing
7 changed files
with
67 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
src/main/java/hudson/plugins/android_emulator/sdk/DefaultToolLocator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package hudson.plugins.android_emulator.sdk; | ||
|
||
import java.io.File; | ||
|
||
public class DefaultToolLocator implements ToolLocator { | ||
public String findInSdk(AndroidSdk androidSdk, Tool tool) { | ||
return File.separator + "tools" + File.separator; | ||
} | ||
} |
28 changes: 28 additions & 0 deletions
28
src/main/java/hudson/plugins/android_emulator/sdk/PlatformToolLocator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package hudson.plugins.android_emulator.sdk; | ||
import hudson.plugins.android_emulator.util.Utils; | ||
import hudson.plugins.android_emulator.SdkInstallationException; | ||
import java.io.File; | ||
|
||
public class PlatformToolLocator implements ToolLocator { | ||
private static final String BUILD_TOOLS_PATH = File.separator + "build-tools" + File.separator; | ||
|
||
public String findInSdk(AndroidSdk androidSdk, Tool tool) throws SdkInstallationException { | ||
if (tool == Tool.AAPT) { | ||
File buildToolsDir = new File(androidSdk.getSdkRoot() + BUILD_TOOLS_PATH); | ||
if (buildToolsDir.exists()) { | ||
String[] subDirs = buildToolsDir.list(); | ||
// TODO: Maybe we should be using the newest toolset available? | ||
return getFirstInstalledBuildToolsDir(subDirs); | ||
} | ||
} | ||
return File.separator + "platform-tools" + File.separator; | ||
|
||
} | ||
|
||
private String getFirstInstalledBuildToolsDir(String[] buildToolsDirs) throws SdkInstallationException { | ||
if (buildToolsDirs.length == 0) { | ||
throw new SdkInstallationException("Please install at least one set of build-tools."); | ||
} | ||
return BUILD_TOOLS_PATH + buildToolsDirs[0] + File.separator; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
src/main/java/hudson/plugins/android_emulator/sdk/ToolLocator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package hudson.plugins.android_emulator.sdk; | ||
import hudson.plugins.android_emulator.SdkInstallationException; | ||
|
||
public interface ToolLocator { | ||
String findInSdk(AndroidSdk androidSdk, Tool tool)throws SdkInstallationException ; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters