Skip to content
Browse files

Merge branch 'issue-115-dx.jar'

  • Loading branch information...
2 parents 45e3e1e + 73b4003 commit 6317399ae8e0dc86904f69c669732eeb604f7f47 @hugojosefson hugojosefson committed Mar 5, 2011
View
7 src/main/java/com/jayway/maven/plugins/android/AndroidSdk.java
@@ -134,7 +134,7 @@ private void assertPathIsDirectory(final File path) {
/**
* Returns the complete path for a tool, based on this SDK.
*
- * @param tool which tool, for example <code>adb</code>.
+ * @param tool which tool, for example <code>adb</code> or <code>dx.jar</code>.
* @return the complete path as a <code>String</code>, including the tool's filename.
*/
public String getPathForTool(String tool) {
@@ -143,12 +143,15 @@ public String getPathForTool(String tool) {
sdkPath + "/" + PLATFORM_TOOLS_FOLDER_NAME + "/" + tool,
sdkPath + "/" + PLATFORM_TOOLS_FOLDER_NAME + "/" + tool + ".exe",
sdkPath + "/" + PLATFORM_TOOLS_FOLDER_NAME + "/" + tool + ".bat",
+ sdkPath + "/" + PLATFORM_TOOLS_FOLDER_NAME + "/lib/" + tool,
getPlatform() + "/tools/" + tool,
getPlatform() + "/tools/" + tool + ".exe",
getPlatform() + "/tools/" + tool + ".bat",
+ getPlatform() + "/tools/lib/" + tool,
sdkPath + "/tools/" + tool,
sdkPath + "/tools/" + tool + ".exe",
- sdkPath + "/tools/" + tool + ".bat"
+ sdkPath + "/tools/" + tool + ".bat",
+ sdkPath + "/tools/lib/" + tool
};
for (String possiblePath : possiblePaths) {
View
18 src/main/java/com/jayway/maven/plugins/android/phase08preparepackage/DexMojo.java
@@ -85,6 +85,8 @@ private void runDex(CommandExecutor executor, File outputFile,
File inputFile) throws MojoExecutionException {
File classesOutputDirectory = new File(project.getBuild().getDirectory(), "android-classes");
List<String> commands = new ArrayList<String>();
+ commands.add("-jar");
+ commands.add(getAndroidSdk().getPathForTool("dx.jar"));
if (jvmArguments != null) {
for (String jvmArgument : jvmArguments) {
if (jvmArgument != null) {
@@ -101,14 +103,26 @@ private void runDex(CommandExecutor executor, File outputFile,
if (coreLibrary) {
commands.add("--core-library");
}
- getLog().info(getAndroidSdk().getPathForTool("dx") + " " + commands.toString());
+ final String javaExecutable = getJavaExecutable().getAbsolutePath();
+ getLog().info(javaExecutable + " " + commands.toString());
try {
- executor.executeCommand(getAndroidSdk().getPathForTool("dx"), commands, project.getBasedir(), false);
+ executor.executeCommand(javaExecutable, commands, project.getBasedir(), false);
} catch (ExecutionException e) {
throw new MojoExecutionException("", e);
}
}
+ /**
+ * Figure out the full path to the current java executable.
+ *
+ * @return the full path to the current java executable.
+ */
+ private static File getJavaExecutable() {
+ final String javaHome = System.getProperty("java.home");
+ final String slash = File.separator;
+ return new File(javaHome + slash + "bin" + slash + "java");
+ }
+
protected File createApkSourcesFile() throws MojoExecutionException {
final File apksources = new File(project.getBuild().getDirectory(), project.getBuild().getFinalName() + ".apksources");
FileUtils.deleteQuietly(apksources);

0 comments on commit 6317399

Please sign in to comment.
Something went wrong with that request. Please try again.