diff --git a/src/main/java/com/simpligility/maven/plugins/android/AndroidSdk.java b/src/main/java/com/simpligility/maven/plugins/android/AndroidSdk.java
index 61b33a549..fca0502db 100644
--- a/src/main/java/com/simpligility/maven/plugins/android/AndroidSdk.java
+++ b/src/main/java/com/simpligility/maven/plugins/android/AndroidSdk.java
@@ -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.
@@ -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).
*
@@ -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.
- *
- * NOTE: 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.
*
diff --git a/src/main/java/com/simpligility/maven/plugins/android/CommandExecutor.java b/src/main/java/com/simpligility/maven/plugins/android/CommandExecutor.java
index 0469d2c69..479243cc8 100644
--- a/src/main/java/com/simpligility/maven/plugins/android/CommandExecutor.java
+++ b/src/main/java/com/simpligility/maven/plugins/android/CommandExecutor.java
@@ -349,7 +349,7 @@ public void consumeLine( String line )
{
if ( captureStdOut )
{
- sb.append( line );
+ sb.append( line ).append( '\n' );
}
if ( logger != null )
{
diff --git a/src/main/java/com/simpligility/maven/plugins/android/configuration/Dex.java b/src/main/java/com/simpligility/maven/plugins/android/configuration/Dex.java
index 0808cd6e3..3d41efd75 100644
--- a/src/main/java/com/simpligility/maven/plugins/android/configuration/Dex.java
+++ b/src/main/java/com/simpligility/maven/plugins/android/configuration/Dex.java
@@ -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;
@@ -112,6 +116,11 @@ public Boolean isMinimalMainDex()
return minimalMainDex;
}
+ public Boolean isGenerateMainDexList()
+ {
+ return generateMainDexList;
+ }
+
public String getDexArguments()
{
return dexArguments;
diff --git a/src/main/java/com/simpligility/maven/plugins/android/phase08preparepackage/DexMojo.java b/src/main/java/com/simpligility/maven/plugins/android/phase08preparepackage/DexMojo.java
index fc19c088c..b1fdc18fe 100644
--- a/src/main/java/com/simpligility/maven/plugins/android/phase08preparepackage/DexMojo.java
+++ b/src/main/java/com/simpligility/maven/plugins/android/phase08preparepackage/DexMojo.java
@@ -34,7 +34,6 @@
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;
-import org.apache.maven.shared.utils.Os;
import org.codehaus.plexus.archiver.ArchiverException;
import org.codehaus.plexus.archiver.jar.JarArchiver;
import org.codehaus.plexus.archiver.util.DefaultFileSet;
@@ -57,9 +56,9 @@
* @author hugo.josefson@jayway.com
*/
@Mojo(
- name = "dex",
- defaultPhase = LifecyclePhase.PREPARE_PACKAGE,
- requiresDependencyResolution = ResolutionScope.COMPILE
+ name = "dex",
+ defaultPhase = LifecyclePhase.PREPARE_PACKAGE,
+ requiresDependencyResolution = ResolutionScope.COMPILE
)
public class DexMojo extends AbstractAndroidMojo
{
@@ -81,6 +80,7 @@ public class DexMojo extends AbstractAndroidMojo
* <preDexLibLocation>path to predexed libraries, defaults to target/dexedLibs</preDexLibLocation>
* <incremental>true|false</incremental>
* <multiDex>true|false</multiDex>
+ * <generateMainDexList>true|false</generateMainDexList>
* <mainDexList>path to class list file</mainDexList>
* <minimalMainDex>true|false</minimalMainDex>
* </dex>
@@ -131,8 +131,8 @@ public class DexMojo extends AbstractAndroidMojo
* Path to predexed libraries.
*/
@Parameter(
- property = "android.dex.dexPreDexLibLocation",
- defaultValue = "${project.build.directory}${file.separator}dexedLibs"
+ property = "android.dex.dexPreDexLibLocation",
+ defaultValue = "${project.build.directory}${file.separator}dexedLibs"
)
private String dexPreDexLibLocation;
@@ -166,6 +166,16 @@ public class DexMojo extends AbstractAndroidMojo
@Parameter( property = "android.dex.minimalmaindex", defaultValue = "false" )
private boolean dexMinimalMainDex;
+ /**
+ * Decides whether to generate main dex list.
+ * Supported from build tools version 22.0.0+
+ *
+ * Note: if set to true, dexMinimalMainDex is set to true, and dexMainDexList
+ * is set to generated main dex list.
+ */
+ @Parameter( property = "android.dex.generatemaindexlist", defaultValue = "false" )
+ private boolean dexGenerateMainDexList;
+
/**
* Additional command line parameters passed to dx.
*/
@@ -231,6 +241,7 @@ public class DexMojo extends AbstractAndroidMojo
private boolean parsedMultiDex;
private String parsedMainDexList;
private boolean parsedMinimalMainDex;
+ private boolean parsedGenerateMainDexList;
private String parsedDexArguments;
/**
@@ -240,21 +251,27 @@ public class DexMojo extends AbstractAndroidMojo
@Override
public void execute() throws MojoExecutionException, MojoFailureException
{
-
if ( getJack().isEnabled() )
{
//Dexxing is handled by Jack
return;
}
-
CommandExecutor executor = CommandExecutor.Factory.createDefaultCommmandExecutor();
- executor.setLogger( this.getLog() );
+ executor.setLogger( getLog() );
parseConfiguration();
File outputFile;
if ( parsedMultiDex )
{
outputFile = targetDirectory;
+ if ( parsedGenerateMainDexList )
+ {
+ getAndroidSdk().assertThatBuildToolsVersionIsAtLeast(
+ "22.0.0", "generate main dex list" );
+ File generatedMainDexClassesList = generateMainDexClassesList( executor );
+ parsedMainDexList = generatedMainDexClassesList.getAbsolutePath();
+ parsedMinimalMainDex = true;
+ }
}
else
{
@@ -268,7 +285,7 @@ public void execute() throws MojoExecutionException, MojoFailureException
if ( attachJar )
{
File jarFile = new File( targetDirectory + File.separator
- + finalName + ".jar" );
+ + finalName + ".jar" );
projectHelper.attachArtifact( project, "jar", project.getArtifact().getClassifier(), jarFile );
}
@@ -302,11 +319,11 @@ private Set< File > getDexInputFiles() throws MojoExecutionException
inputs.add( projectOutputDirectory );
getLog().debug( "Adding dex input : " + project.getBuild().getOutputDirectory() );
for ( Artifact artifact : filterArtifacts( getTransitiveDependencyArtifacts(), skipDependencies,
- artifactTypeSet.getIncludes(), artifactTypeSet.getExcludes(), artifactSet.getIncludes(),
- artifactSet.getExcludes() ) )
+ artifactTypeSet.getIncludes(), artifactTypeSet.getExcludes(), artifactSet.getIncludes(),
+ artifactSet.getExcludes() ) )
{
if ( artifact.getType().equals( Const.ArtifactType.NATIVE_SYMBOL_OBJECT )
- || artifact.getType().equals( Const.ArtifactType.NATIVE_IMPLEMENTATION_ARCHIVE ) )
+ || artifact.getType().equals( Const.ArtifactType.NATIVE_IMPLEMENTATION_ARCHIVE ) )
{
// Ignore native dependencies - no need for dexer to see those
}
@@ -440,6 +457,14 @@ private void parseConfiguration()
{
parsedMinimalMainDex = dex.isMinimalMainDex();
}
+ if ( dex.isGenerateMainDexList() == null )
+ {
+ parsedGenerateMainDexList = dexGenerateMainDexList;
+ }
+ else
+ {
+ parsedGenerateMainDexList = dex.isGenerateMainDexList();
+ }
if ( dex.getDexArguments() == null )
{
parsedDexArguments = dexArguments;
@@ -463,6 +488,7 @@ private void parseConfiguration()
parsedMultiDex = dexMultiDex;
parsedMainDexList = dexMainDexList;
parsedMinimalMainDex = dexMinimalMainDex;
+ parsedGenerateMainDexList = dexGenerateMainDexList;
parsedDexArguments = dexArguments;
}
}
@@ -486,20 +512,8 @@ private Set< File > preDex( CommandExecutor executor, Set< File > inputFiles ) t
if ( !predexJar.isFile() || predexJar.lastModified() < inputFile.lastModified() )
{
getLog().info( "Pre-dex ing jar: " + inputFile.getAbsolutePath() );
-
- final String javaExecutable = getJavaExecutable().getAbsolutePath();
- getLog().debug( javaExecutable + " " + commands.toString() );
- try
- {
- executor.setCaptureStdOut( true );
- executor.executeCommand( javaExecutable, commands, project.getBasedir(), false );
- }
- catch ( ExecutionException e )
- {
- throw new MojoExecutionException( "", e );
- }
+ executeJava( commands, executor );
}
-
}
else
{
@@ -519,8 +533,22 @@ private File predexJarPath( File inputFile )
private List< String > dexDefaultCommands() throws MojoExecutionException
{
+ List< String > commands = jarDefaultCommands();
+ commands.add( getAndroidSdk().getDxJarPath() );
+ commands.add( "--dex" );
+ return commands;
+ }
- List< String > commands = new ArrayList< String >();
+ private List jarDefaultCommands()
+ {
+ List< String > commands = javaDefaultCommands();
+ commands.add( "-jar" );
+ return commands;
+ }
+
+ private List javaDefaultCommands()
+ {
+ List< String > commands = new ArrayList< String > ();
if ( parsedJvmArguments != null )
{
for ( String jvmArgument : parsedJvmArguments )
@@ -537,16 +565,11 @@ private List< String > dexDefaultCommands() throws MojoExecutionException
commands.add( jvmArgument );
}
}
- commands.add( "-jar" );
- commands.add( getAndroidSdk().getDxJarPath() );
- commands.add( "--dex" );
-
return commands;
-
}
private void runDex( CommandExecutor executor, File outputFile )
- throws MojoExecutionException
+ throws MojoExecutionException
{
final List< String > commands = dexDefaultCommands();
final Set< File > inputFiles = getDexInputFiles();
@@ -578,13 +601,7 @@ private void runDex( CommandExecutor executor, File outputFile )
if ( parsedMultiDex )
{
commands.add( "--multi-dex" );
- if ( parsedMainDexList == null )
- {
- File generatedMainDexClasses = generateMainDexClassesFile();
- commands.add( "--main-dex-list=" + generatedMainDexClasses );
- parsedMinimalMainDex = true;
- }
- else
+ if ( parsedMainDexList != null )
{
commands.add( "--main-dex-list=" + parsedMainDexList );
}
@@ -595,7 +612,7 @@ private void runDex( CommandExecutor executor, File outputFile )
}
if ( parsedDexArguments != null )
{
- commands.add( parsedDexArguments );
+ commands.add( parsedDexArguments );
}
commands.add( "--output=" + outputFile.getAbsolutePath() );
for ( File inputFile : filteredFiles )
@@ -603,13 +620,19 @@ private void runDex( CommandExecutor executor, File outputFile )
commands.add( inputFile.getAbsolutePath() );
}
+ getLog().info( "Convert classes to Dex : " + outputFile );
+ executeJava( commands, executor );
+ }
+
+ private String executeJava( final List commands, CommandExecutor executor ) throws MojoExecutionException
+ {
final String javaExecutable = getJavaExecutable().getAbsolutePath();
getLog().debug( javaExecutable + " " + commands.toString() );
- getLog().info( "Convert classes to Dex : " + outputFile );
try
{
executor.setCaptureStdOut( true );
executor.executeCommand( javaExecutable, commands, project.getBasedir(), false );
+ return executor.getStandardOut();
}
catch ( ExecutionException e )
{
@@ -629,38 +652,69 @@ private static File getJavaExecutable()
return new File( javaHome + slash + "bin" + slash + "java" );
}
- private File generateMainDexClassesFile() throws MojoExecutionException
+ private File generateMainDexClassesJar( CommandExecutor executor ) throws MojoExecutionException
{
- CommandExecutor executor = CommandExecutor.Factory.createDefaultCommmandExecutor();
- executor.setLogger( getLog() );
- List commands = new ArrayList<>();
- commands.add( "--output" );
+ List< String> commands = jarDefaultCommands();
+ commands.add( getAndroidSdk().getProguardJarPath() );
+ commands.add( "-dontnote" );
+ commands.add( "-dontwarn" );
+ commands.add( "-forceprocessing" );
+ commands.add( "-dontoptimize" );
+ commands.add( "-dontpreverify" );
+ commands.add( "-dontobfuscate" );
+
+ Set< File> inputFiles = getDexInputFiles();
+ for ( File inputFile : inputFiles )
+ {
+ commands.add( "-injars" );
+ commands.add( inputFile.getAbsolutePath() + "(!META-INF/**)" );
+ }
- File mainDexClasses = new File( targetDirectory, "mainDexClasses.txt" );
- commands.add( mainDexClasses.getAbsolutePath() );
+ commands.add( "-libraryjars" );
+ commands.add( getAndroidSdk().getShrinkedAndroidJarPath() );
- Set inputFiles = getDexInputFiles();
+ commands.add( "-include" );
+ commands.add( getAndroidSdk().getMainDexClassesRulesPath() );
+
+ commands.add( "-outjars" );
+ File mainDexClassesJar = new File( targetDirectory, "mainDexClasses.jar" );
+ commands.add( mainDexClassesJar.getAbsolutePath() );
+
+ getLog().info( "Generating main dex classes jar : " + mainDexClassesJar );
+ executeJava( commands, executor );
+
+ return mainDexClassesJar;
+ }
+
+ private File generateMainDexClassesList( CommandExecutor executor ) throws MojoExecutionException
+ {
+ File mainDexClassesJar = generateMainDexClassesJar( executor );
+ List< String> commands = javaDefaultCommands();
+
+ commands.add( "-Djava.ext.dirs=" + getAndroidSdk().getBuildToolsLibDirectoryPath() );
+ commands.add( "com.android.multidex.MainDexListBuilder" );
+ commands.add( mainDexClassesJar.getAbsolutePath() );
+
+ Set< File> inputFiles = getDexInputFiles();
StringBuilder sb = new StringBuilder();
sb.append( StringUtils.join( inputFiles, File.pathSeparatorChar ) );
- if ( Os.isFamily( Os.FAMILY_WINDOWS ) )
- {
- commands.add( StringUtils.wrap( sb.toString(), '"' ) );
- }
- else
- {
- commands.add( sb.toString() );
- }
+ commands.add( sb.toString() );
+
+ File mainDexClassesList = new File( targetDirectory, "mainDexClasses.txt" );
+
+ getLog().info( "Generating main dex classes list : " + mainDexClassesList );
- String executable = getAndroidSdk().getMainDexClasses().getAbsolutePath();
+ String output = executeJava( commands, executor );
try
{
- executor.executeCommand( executable, commands, project.getBasedir(), false );
+ FileUtils.writeStringToFile( mainDexClassesList, output );
}
- catch ( ExecutionException ex )
+ catch ( IOException ex )
{
- throw new MojoExecutionException( "Failed to execute mainDexClasses", ex );
+ throw new MojoExecutionException( "Failed to write command output with main dex classes list to "
+ + mainDexClassesList, ex );
}
- return mainDexClasses;
+ return mainDexClassesList;
}
/**
@@ -670,7 +724,7 @@ private File generateMainDexClassesFile() throws MojoExecutionException
protected File createApkSourcesFile() throws MojoExecutionException
{
final File apksources = new File( targetDirectory, finalName
- + ".apksources" );
+ + ".apksources" );
FileUtils.deleteQuietly( apksources );
try
diff --git a/src/test/java/com/simpligility/maven/plugins/android/sample/HelloFlashLightSampleIT.java b/src/test/java/com/simpligility/maven/plugins/android/sample/HelloFlashLightSampleIT.java
index 66c37713c..b078d3c69 100644
--- a/src/test/java/com/simpligility/maven/plugins/android/sample/HelloFlashLightSampleIT.java
+++ b/src/test/java/com/simpligility/maven/plugins/android/sample/HelloFlashLightSampleIT.java
@@ -15,6 +15,7 @@
*/
package com.simpligility.maven.plugins.android.sample;
+import com.simpligility.maven.plugins.android.PluginInfo;
import io.takari.maven.testing.TestResources;
import io.takari.maven.testing.executor.MavenExecutionResult;
import io.takari.maven.testing.executor.MavenRuntime;
@@ -22,39 +23,38 @@
import io.takari.maven.testing.executor.MavenRuntime.MavenRuntimeBuilder;
import io.takari.maven.testing.executor.junit.MavenJUnitTestRunner;
-import java.io.File;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
-import com.simpligility.maven.plugins.android.PluginInfo;
+import java.io.File;
@RunWith(MavenJUnitTestRunner.class)
@MavenVersions({"3.0.5", "3.3.9"})
public class HelloFlashLightSampleIT {
-
- @Rule
- public final TestResources resources = new TestResources();
-
- public final MavenRuntime mavenRuntime;
-
- public HelloFlashLightSampleIT(MavenRuntimeBuilder builder) throws Exception {
- this.mavenRuntime = builder.build();
- }
-
- @Test
- public void buildDeployAndRun() throws Exception {
- File basedir = resources.getBasedir( "helloflashlight" );
- MavenExecutionResult result = mavenRuntime
- .forProject(basedir)
- .execute( "clean", PluginInfo.getQualifiedGoal( "undeploy" ),
- "install", PluginInfo.getQualifiedGoal( "deploy" ),
- PluginInfo.getQualifiedGoal( "run" ) );
-
- result.assertErrorFreeLog();
- result.assertLogText( "Successfully installed" );
- result.assertLogText( "Attempting to start com.simpligility.android.helloflashlight/com.simpligility.android.helloflashlight.HelloFlashlight" );
- }
-
-}
\ No newline at end of file
+
+ @Rule
+ public final TestResources resources = new TestResources();
+
+ public final MavenRuntime mavenRuntime;
+
+ public HelloFlashLightSampleIT(MavenRuntimeBuilder builder) throws Exception {
+ this.mavenRuntime = builder.build();
+ }
+
+ @Test
+ public void buildDeployAndRun() throws Exception {
+ File basedir = resources.getBasedir( "helloflashlight" );
+ MavenExecutionResult result = mavenRuntime
+ .forProject(basedir)
+ .execute( "clean", PluginInfo.getQualifiedGoal( "undeploy" ),
+ "install", PluginInfo.getQualifiedGoal( "deploy" ),
+ PluginInfo.getQualifiedGoal( "run" ) );
+
+ result.assertErrorFreeLog();
+ result.assertLogText( "Successfully installed" );
+ result.assertLogText( "Attempting to start com.simpligility.android.helloflashlight/com.simpligility.android.helloflashlight.HelloFlashlight" );
+ }
+
+}
diff --git a/src/test/java/com/simpligility/maven/plugins/android/sample/MultiDexSampleIT.java b/src/test/java/com/simpligility/maven/plugins/android/sample/MultiDexSampleIT.java
new file mode 100644
index 000000000..e9cd44d54
--- /dev/null
+++ b/src/test/java/com/simpligility/maven/plugins/android/sample/MultiDexSampleIT.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2014 simpligility technologies inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.simpligility.maven.plugins.android.sample;
+
+import com.simpligility.maven.plugins.android.PluginInfo;
+import io.takari.maven.testing.TestResources;
+import io.takari.maven.testing.executor.MavenExecutionResult;
+import io.takari.maven.testing.executor.MavenRuntime;
+import io.takari.maven.testing.executor.MavenVersions;
+import io.takari.maven.testing.executor.MavenRuntime.MavenRuntimeBuilder;
+import io.takari.maven.testing.executor.junit.MavenJUnitTestRunner;
+
+
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.File;
+
+@RunWith(MavenJUnitTestRunner.class)
+@MavenVersions({"3.0.5", "3.3.9"})
+public class MultiDexSampleIT {
+
+ @Rule
+ public final TestResources resources = new TestResources();
+
+ public final MavenRuntime mavenRuntime;
+
+ public MultiDexSampleIT(MavenRuntimeBuilder builder) throws Exception {
+ this.mavenRuntime = builder.build();
+ }
+
+ @Test
+ public void buildDeployAndRun() throws Exception {
+ File basedir = resources.getBasedir( "multidexsample" );
+ MavenExecutionResult result = mavenRuntime
+ .forProject(basedir)
+ .execute( "clean", PluginInfo.getQualifiedGoal( "undeploy" ),
+ "install", PluginInfo.getQualifiedGoal( "deploy" ),
+ PluginInfo.getQualifiedGoal( "run" ) );
+
+ result.assertErrorFreeLog();
+ result.assertLogText( "Successfully installed" );
+ result.assertLogText( "Attempting to start com.simpligility.android.multidexsample/com.simpligility.android.multidexsample.MultiDexSampleActivity" );
+ }
+
+}
diff --git a/src/test/projects/multidexsample/pom.xml b/src/test/projects/multidexsample/pom.xml
new file mode 100644
index 000000000..815817d41
--- /dev/null
+++ b/src/test/projects/multidexsample/pom.xml
@@ -0,0 +1,166 @@
+
+
+ 4.0.0
+ com.simpligility.android
+ multidexsample
+ 1.0.0
+ apk
+ MultiDexSample
+
+
+
+ 4.3.0
+ UTF-8
+ UTF-8
+
+
+
+
+ org.robolectric
+ android-all
+ 5.0.0_r2-robolectric-1
+ provided
+
+
+
+ com.android.support
+ multidex
+ 1.0.1
+ aar
+
+
+
+ com.squareup
+ otto
+ 1.3.8
+
+
+ com.actionbarsherlock
+ actionbarsherlock
+ 4.4.0
+
+
+ com.j256.ormlite
+ ormlite-android
+ 4.48
+
+
+ org.roboguice
+ roboguice
+ 3.0.1
+
+
+ org.roboguice
+ roboblender
+ 3.0.1
+ provided
+
+
+ com.google.code.findbugs
+ jsr305
+ 1.3.9
+
+
+ com.thoughtworks.xstream
+ xstream
+ 1.4.7
+
+
+ xpp3
+ xpp3_min
+
+
+ xmlpull
+ xmlpull
+
+
+
+
+ com.google.guava
+ guava
+ 18.0
+
+
+ com.google.code.gson
+ gson
+ 2.3.1
+
+
+ org.bouncycastle
+ bcprov-jdk15on
+ 1.52
+
+
+
+ org.apache.commons
+ commons-collections4
+ 4.0
+
+
+ commons-io
+ commons-io
+ 2.4
+
+
+ org.apache.commons
+ commons-lang3
+ 3.4
+
+
+ commons-codec
+ commons-codec
+ 1.10
+
+
+ org.apache.commons
+ commons-compress
+ 1.9
+
+
+ org.apache.commons
+ commons-math3
+ 3.5
+
+
+
+
+
+
+
+ com.simpligility.maven.plugins
+ android-maven-plugin
+ ${it-plugin.version}
+ true
+
+
+
+
+
+ com.simpligility.maven.plugins
+ android-maven-plugin
+
+
+ 19
+
+ true
+ true
+
+
+ -Xms1024m
+ -Xmx2048m
+ -XX:MaxPermSize=1024m
+
+
+
+
+
+
+
+
+
+ local-android-repository
+ file://${env.ANDROID_HOME}/extras/android/m2repository
+
+
+
diff --git a/src/test/projects/multidexsample/src/main/AndroidManifest.xml b/src/test/projects/multidexsample/src/main/AndroidManifest.xml
new file mode 100644
index 000000000..afebd4b16
--- /dev/null
+++ b/src/test/projects/multidexsample/src/main/AndroidManifest.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/test/projects/multidexsample/src/main/java/com/simpligility/android/multidexsample/MultiDexSampleActivity.java b/src/test/projects/multidexsample/src/main/java/com/simpligility/android/multidexsample/MultiDexSampleActivity.java
new file mode 100644
index 000000000..64e7797ad
--- /dev/null
+++ b/src/test/projects/multidexsample/src/main/java/com/simpligility/android/multidexsample/MultiDexSampleActivity.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2015 Piotr Soróbka
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.simpligility.android.multidexsample;
+
+import android.os.Bundle;
+import roboguice.activity.RoboActivity;
+import roboguice.inject.ContentView;
+
+/**
+ *
+ * @author Piotr Soróbka
+ */
+@ContentView(R.layout.main)
+public class MultiDexSampleActivity extends RoboActivity {
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ }
+}
diff --git a/src/test/projects/multidexsample/src/main/java/com/simpligility/android/multidexsample/MultiDexSampleApplication.java b/src/test/projects/multidexsample/src/main/java/com/simpligility/android/multidexsample/MultiDexSampleApplication.java
new file mode 100644
index 000000000..709a30f9c
--- /dev/null
+++ b/src/test/projects/multidexsample/src/main/java/com/simpligility/android/multidexsample/MultiDexSampleApplication.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2015 Piotr Soróbka
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.simpligility.android.multidexsample;
+
+import android.app.Application;
+import android.content.Context;
+import android.support.multidex.MultiDex;
+
+/**
+ *
+ * @author Piotr Soróbka
+ */
+public class MultiDexSampleApplication extends Application {
+
+ @Override
+ protected void attachBaseContext(Context base) {
+ super.attachBaseContext(base);
+ MultiDex.install(this);
+ }
+}
diff --git a/src/test/projects/multidexsample/src/main/res/drawable-hdpi/icon.png b/src/test/projects/multidexsample/src/main/res/drawable-hdpi/icon.png
new file mode 100644
index 000000000..8074c4c57
Binary files /dev/null and b/src/test/projects/multidexsample/src/main/res/drawable-hdpi/icon.png differ
diff --git a/src/test/projects/multidexsample/src/main/res/drawable-ldpi/icon.png b/src/test/projects/multidexsample/src/main/res/drawable-ldpi/icon.png
new file mode 100644
index 000000000..1095584ec
Binary files /dev/null and b/src/test/projects/multidexsample/src/main/res/drawable-ldpi/icon.png differ
diff --git a/src/test/projects/multidexsample/src/main/res/drawable-mdpi/icon.png b/src/test/projects/multidexsample/src/main/res/drawable-mdpi/icon.png
new file mode 100644
index 000000000..a07c69fa5
Binary files /dev/null and b/src/test/projects/multidexsample/src/main/res/drawable-mdpi/icon.png differ
diff --git a/src/test/projects/multidexsample/src/main/res/layout/main.xml b/src/test/projects/multidexsample/src/main/res/layout/main.xml
new file mode 100644
index 000000000..1137995d5
--- /dev/null
+++ b/src/test/projects/multidexsample/src/main/res/layout/main.xml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
diff --git a/src/test/projects/multidexsample/src/main/res/values/strings.xml b/src/test/projects/multidexsample/src/main/res/values/strings.xml
new file mode 100644
index 000000000..bb3d5520b
--- /dev/null
+++ b/src/test/projects/multidexsample/src/main/res/values/strings.xml
@@ -0,0 +1,5 @@
+
+
+ MultiDexSample
+ Hello MultiDex!
+