Skip to content

Commit

Permalink
Merge branch 'buildconfig-parameter' of git://github.com/pluk/maven-a…
Browse files Browse the repository at this point in the history
…ndroid-plugin into pull136
  • Loading branch information
mosabua committed Oct 16, 2012
2 parents b690fc3 + 82f6dac commit e65ce40
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ public class GenerateSourcesMojo extends AbstractAndroidMojo
* default-value="${project.build.directory}/generated-sources/aidl"
*/
protected File genDirectoryAidl;

/**
* Whether to create a release build (default is false / debug build).
* @parameter expression="${android.release}" default-value="false"
*/
protected boolean release;

public void execute() throws MojoExecutionException, MojoFailureException
{
Expand Down Expand Up @@ -512,16 +518,13 @@ private void generateBuildConfig() throws MojoExecutionException
{
getLog().debug( "Generating BuildConfig file" );

// Determine whether or not we are in debug mode.
boolean debug = !Boolean.valueOf( System.getProperty( "android.release", "false" ) );

// Create the BuildConfig for our package.
String packageName = extractPackageNameFromAndroidManifest( androidManifestFile );
if ( StringUtils.isNotBlank( customPackage ) )
{
packageName = customPackage;
}
generateBuildConfigForPackage( packageName, debug );
generateBuildConfigForPackage( packageName, !release );

// Generate the BuildConfig for any apklib dependencies.
for ( Artifact artifact : getAllRelevantDependencyArtifacts() )
Expand All @@ -530,7 +533,7 @@ private void generateBuildConfig() throws MojoExecutionException
{
File apklibManifeset = new File( getLibraryUnpackDirectory( artifact ), "AndroidManifest.xml" );
String apklibPackageName = extractPackageNameFromAndroidManifest( apklibManifeset );
generateBuildConfigForPackage( apklibPackageName, debug );
generateBuildConfigForPackage( apklibPackageName, !release );
}
}
}
Expand Down

0 comments on commit e65ce40

Please sign in to comment.