maven-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From krosenv...@apache.org
Subject svn commit: r1674106 - /maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddDependencySetsTask.java
Date Thu, 16 Apr 2015 16:15:49 GMT
Author: krosenvold
Date: Thu Apr 16 16:15:49 2015
New Revision: 1674106

URL: http://svn.apache.org/r1674106
Log:
Simplified code

Modified:
    maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddDependencySetsTask.java

Modified: maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddDependencySetsTask.java
URL: http://svn.apache.org/viewvc/maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddDependencySetsTask.java?rev=1674106&r1=1674105&r2=1674106&view=diff
==============================================================================
--- maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddDependencySetsTask.java
(original)
+++ maven/plugins/trunk/maven-assembly-plugin/src/main/java/org/apache/maven/plugin/assembly/archive/task/AddDependencySetsTask.java
Thu Apr 16 16:15:49 2015
@@ -134,12 +134,7 @@ public class AddDependencySetsTask
 
         final Set<Artifact> dependencyArtifacts = resolveDependencyArtifacts( dependencySet
);
 
-        final UnpackOptions opts = dependencySet.getUnpackOptions();
-        if ( dependencySet.isUnpack() && opts != null && ( opts.isFiltered()
|| opts.getLineEnding() != null ) )
-        {
-            // find out if we can just ditch this empty block
-        }
-        else if ( dependencyArtifacts.size() > 1 )
+        if ( !unpackTransformsContent( dependencySet ) && dependencyArtifacts.size()
> 1 )
         {
             checkMultiArtifactOutputConfig( dependencySet );
         }
@@ -147,7 +142,7 @@ public class AddDependencySetsTask
         logger.debug( "Adding " + dependencyArtifacts.size() + " dependency artifacts." );
 
         InputStreamTransformer fileSetTransformers =
-            dependencySet.isUnpack() && dependencySet.getUnpackOptions() != null
+            isUnpackWithOptions( dependencySet )
                 ? ReaderFormatter.getFileSetTransformers( configSource, dependencySet.getUnpackOptions().isFiltered(),
                                                           dependencySet.getUnpackOptions().getLineEnding()
)
                 : null;
@@ -181,6 +176,21 @@ public class AddDependencySetsTask
         }
     }
 
+    private boolean isUnpackWithOptions( DependencySet dependencySet )
+    {
+        return dependencySet.isUnpack() && dependencySet.getUnpackOptions() != null;
+    }
+
+    private boolean unpackTransformsContent( DependencySet dependencySet )
+    {
+        return isUnpackWithOptions( dependencySet ) && isConentModifyingOption( dependencySet.getUnpackOptions()
);
+    }
+
+    private boolean isConentModifyingOption( UnpackOptions opts )
+    {
+        return ( opts.isFiltered() || opts.getLineEnding() != null );
+    }
+
     private void checkMultiArtifactOutputConfig( final DependencySet dependencySet )
     {
         String dir = dependencySet.getOutputDirectory();
@@ -198,8 +208,9 @@ public class AddDependencySetsTask
         if ( ( dir == null || !dir.contains( "${" ) ) && ( mapping == null || !mapping.contains(
"${" ) ) )
         {
             logger.warn( "NOTE: Your assembly specifies a dependencySet that matches multiple
artifacts, but "
-                + "specifies a concrete output format. THIS MAY RESULT IN ONE OR MORE ARTIFACTS
BEING OBSCURED!\n\n"
-                + "Output directory: '" + dir + "'\nOutput filename mapping: '" + mapping
+ "'" );
+                             + "specifies a concrete output format. THIS MAY RESULT IN ONE
OR MORE ARTIFACTS BEING "
+                             + "OBSCURED!\n\n" + "Output directory: '" + dir + "'\nOutput
filename mapping: '" + mapping
+                             + "'" );
         }
     }
 
@@ -234,7 +245,7 @@ public class AddDependencySetsTask
         task.setUnpack( dependencySet.isUnpack() );
 
         final UnpackOptions opts = dependencySet.getUnpackOptions();
-        if ( dependencySet.isUnpack() && ( opts != null ) )
+        if ( isUnpackWithOptions( dependencySet ) )
         {
             task.setIncludes( opts.getIncludes() );
             task.setExcludes( opts.getExcludes() );



Mime
View raw message