Skip to content

Commit d0cee8b

Browse files
Merge pull request simpligility#779 from lyubomyr-shaydariv/unpack.unpackOutputDirectory
Added unpackOutputDirectory and includeNonClassFiles to the unpack goal
2 parents 981aab0 + 5c8513c commit d0cee8b

File tree

1 file changed

+16
-2
lines changed
  • src/main/java/com/simpligility/maven/plugins/android/standalonemojos

1 file changed

+16
-2
lines changed

src/main/java/com/simpligility/maven/plugins/android/standalonemojos/UnpackMojo.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ public class UnpackMojo extends AbstractAndroidMojo
7474
@ConfigPojo( prefix = "unpack" )
7575
private Unpack unpack;
7676

77+
@Parameter( defaultValue = "${project.build.directory}/android-classes", readonly = true )
78+
private File unpackOutputDirectory;
79+
80+
@Parameter( defaultValue = "false", readonly = true )
81+
private boolean includeNonClassFiles;
82+
7783
public void execute() throws MojoExecutionException, MojoFailureException
7884
{
7985

@@ -89,7 +95,7 @@ public void execute() throws MojoExecutionException, MojoFailureException
8995

9096
private File unpackClasses() throws MojoExecutionException
9197
{
92-
File outputDirectory = new File( targetDirectory, "android-classes" );
98+
File outputDirectory = unpackOutputDirectory;
9399
if ( lazyLibraryUnpack && outputDirectory.exists() )
94100
{
95101
getLog().info( "skip library unpacking due to lazyLibraryUnpack policy" );
@@ -141,7 +147,10 @@ public boolean include( JarEntry jarEntry )
141147

142148
try
143149
{
144-
FileUtils.copyDirectory( projectOutputDirectory, outputDirectory );
150+
if ( !projectOutputDirectory.equals( outputDirectory ) )
151+
{
152+
FileUtils.copyDirectory( projectOutputDirectory, outputDirectory );
153+
}
145154
}
146155
catch ( IOException e )
147156
{
@@ -160,6 +169,11 @@ boolean isIncluded( JarEntry jarEntry )
160169
return true;
161170
}
162171

172+
if ( includeNonClassFiles && !entName.startsWith( "META-INF/" ) )
173+
{
174+
return true;
175+
}
176+
163177
return this.unpackMetaInf != null && this.unpackMetaInf.isIncluded( entName );
164178
}
165179

0 commit comments

Comments
 (0)