Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multidex #753

Merged
merged 3 commits into from
Mar 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
import org.codehaus.plexus.interpolation.os.Os;

/**
* Represents an Android SDK.
Expand Down Expand Up @@ -185,7 +184,76 @@ public String getDxJarPath()
{
return getPathForBuildTool( BuildToolInfo.PathId.DX_JAR );
}

/**
* Get the path for proguard.jar
* @return
*/
public String getProguardJarPath()
{
File directory = new File( getToolsPath(), "proguard" + File.separator + "lib" + File.separator );
File proguardJar = new File( directory, "proguard.jar" );
if ( proguardJar.exists() )
{
return proguardJar.getAbsolutePath();
}
throw new InvalidSdkException( "Cannot find " + proguardJar );
}

/**
* Get the path for shrinkedAndroid.jar
* @return
*/
public String getShrinkedAndroidJarPath()
{
File shrinkedAndroidJar = new File( getBuildToolsLibDirectoryPath(), "shrinkedAndroid.jar" );
if ( shrinkedAndroidJar.exists() )
{
return shrinkedAndroidJar.getAbsolutePath();
}
throw new InvalidSdkException( "Cannot find " + shrinkedAndroidJar );
}

/**
* Get the path for build-tools lib directory
* @return
*/
public String getBuildToolsLibDirectoryPath()
{
File buildToolsLib = new File( getBuildToolInfo().getLocation(), "lib" );
if ( buildToolsLib.exists() )
{
return buildToolsLib.getAbsolutePath();
}
throw new InvalidSdkException( "Cannot find " + buildToolsLib );
}

/**
* Get the path for mainDexClasses.rules
* @return
*/
public String getMainDexClassesRulesPath()
{
File mainDexClassesRules = new File( getBuildToolInfo().getLocation(),
"mainDexClasses.rules" );
if ( mainDexClassesRules.exists() )
{
return mainDexClassesRules.getAbsolutePath();
}
throw new InvalidSdkException( "Cannot find " + mainDexClassesRules );
}

public void assertThatBuildToolsVersionIsAtLeast( String version, String feature )
throws InvalidSdkException, NumberFormatException
{
if ( getBuildToolInfo().getRevision().
compareTo( FullRevision.parseRevision( version ) ) < 0 )
{
throw new InvalidSdkException( "Version of build tools must be at least "
+ version + " for " + feature + " to work" );
}
}

/**
* Get the android debug tool path (adb).
*
Expand Down Expand Up @@ -328,31 +396,6 @@ public String getPathForFrameworkAidl()
return androidTarget.getPath( IAndroidTarget.ANDROID_AIDL );
}

/**
* Returns the mainDexClasses script file, based on this SDK and OS.
* Assumes that the script is in build-tools\VERSION\ directory.
*
* <b>NOTE</b>: This file is found in version 21.1.1+ of build-tools.
*
* @return mainDexClasses file
* @throws MojoExecutionException when the file is not found
*/
public File getMainDexClasses() throws MojoExecutionException
{
final File location = getBuildToolInfo().getLocation();
String mainDexClassesScript = "mainDexClasses";
if ( Os.isFamily( Os.FAMILY_WINDOWS ) )
{
mainDexClassesScript += ".bat";
}
File mainDexClasses = new File( location, mainDexClassesScript );
if ( !mainDexClasses.exists() )
{
throw new MojoExecutionException( "No " + mainDexClassesScript + " found in " + location );
}
return mainDexClasses;
}

/**
* Resolves the android.jar from this SDK.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ public void consumeLine( String line )
{
if ( captureStdOut )
{
sb.append( line );
sb.append( line ).append( '\n' );
}
if ( logger != null )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ public class Dex
* Mirror of {@link com.simpligility.maven.plugins.android.phase08preparepackage.DexMojo#minimalMainDex}
*/
private Boolean minimalMainDex;
/**
* Mirror of {@link com.simpligility.maven.plugins.android.phase08preparepackage.DexMojo#generateMainDexList}
*/
private Boolean generateMainDexList;

private String dexArguments;

Expand Down Expand Up @@ -112,6 +116,11 @@ public Boolean isMinimalMainDex()
return minimalMainDex;
}

public Boolean isGenerateMainDexList()
{
return generateMainDexList;
}

public String getDexArguments()
{
return dexArguments;
Expand Down
Loading