Skip to content

Commit

Permalink
Merge branch 'generatingMainDexClassesList' of https://github.com/pso…
Browse files Browse the repository at this point in the history
…robka/android-maven-plugin into multidex

# Conflicts:
#	src/main/java/com/simpligility/maven/plugins/android/phase08preparepackage/DexMojo.java
#	src/test/java/com/simpligility/maven/plugins/android/sample/HelloFlashLightSampleIT.java
  • Loading branch information
MobiDevelop committed Dec 21, 2016
2 parents 74b9325 + be35eed commit b387c1e
Show file tree
Hide file tree
Showing 16 changed files with 579 additions and 124 deletions.
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

0 comments on commit b387c1e

Please sign in to comment.