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

Add custom exclude filter to ProGuardMojo #497

Merged
merged 1 commit into from
Nov 4, 2014
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 @@ -27,6 +27,7 @@ public class Proguard
private String[] jvmArguments;
private Boolean filterMavenDescriptor;
private Boolean filterManifest;
private String customFilter;
private Boolean includeJdkLibs;
private String[] options;
private Boolean attachMap;
Expand Down Expand Up @@ -65,6 +66,11 @@ public Boolean isFilterMavenDescriptor()
{
return filterMavenDescriptor;
}

public String getCustomFilter()
{
return customFilter;
}

public Boolean isFilterManifest()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public class ProguardMojo extends AbstractAndroidMojo
* <proguardJarPath>someAbsolutePathToProguardJar</proguardJarPath>
* <filterMavenDescriptor>true|false</filterMavenDescriptor>
* <filterManifest>true|false</filterManifest>
* <customFilter>filter1,filter2</customFilter>
* <jvmArguments>
* <jvmArgument>-Xms256m</jvmArgument>
* <jvmArgument>-Xmx512m</jvmArgument>
Expand Down Expand Up @@ -192,6 +193,17 @@ public class ProguardMojo extends AbstractAndroidMojo

@PullParameter( defaultValue = "true" )
private Boolean parsedFilterManifest;

/**
* You can specify a custom filter which will be used to filter out unnecessary files from ProGuard input.
*
* @see http://proguard.sourceforge.net/manual/usage.html#filefilters
*/
@Parameter( property = "android.proguard.customfilter" )
private String proguardCustomFilter;

@PullParameter
private String parsedCustomFilter;

/**
* If set to true JDK jars will be included as library jars and corresponding filters
Expand Down Expand Up @@ -534,6 +546,10 @@ private List< ProGuardInput > getProgramInputFiles()
{
globalInJarExcludes.addAll( MAVEN_DESCRIPTOR );
}
if ( parsedCustomFilter != null )
{
globalInJarExcludes.addAll( Arrays.asList( parsedCustomFilter.split( "," ) ) );
}

// we first add the application's own class files
inJars.add( createProguardInput( projectOutputDirectory.getAbsolutePath() ) );
Expand Down