@@ -134,20 +134,15 @@ void addDependencySet( final DependencySet dependencySet, final Archiver archive
134
134
135
135
final Set <Artifact > dependencyArtifacts = resolveDependencyArtifacts ( dependencySet );
136
136
137
- final UnpackOptions opts = dependencySet .getUnpackOptions ();
138
- if ( dependencySet .isUnpack () && opts != null && ( opts .isFiltered () || opts .getLineEnding () != null ) )
139
- {
140
- // find out if we can just ditch this empty block
141
- }
142
- else if ( dependencyArtifacts .size () > 1 )
137
+ if ( !unpackTransformsContent ( dependencySet ) && dependencyArtifacts .size () > 1 )
143
138
{
144
139
checkMultiArtifactOutputConfig ( dependencySet );
145
140
}
146
141
147
142
logger .debug ( "Adding " + dependencyArtifacts .size () + " dependency artifacts." );
148
143
149
144
InputStreamTransformer fileSetTransformers =
150
- dependencySet . isUnpack () && dependencySet . getUnpackOptions () != null
145
+ isUnpackWithOptions ( dependencySet )
151
146
? ReaderFormatter .getFileSetTransformers ( configSource , dependencySet .getUnpackOptions ().isFiltered (),
152
147
dependencySet .getUnpackOptions ().getLineEnding () )
153
148
: null ;
@@ -181,6 +176,21 @@ else if ( dependencyArtifacts.size() > 1 )
181
176
}
182
177
}
183
178
179
+ private boolean isUnpackWithOptions ( DependencySet dependencySet )
180
+ {
181
+ return dependencySet .isUnpack () && dependencySet .getUnpackOptions () != null ;
182
+ }
183
+
184
+ private boolean unpackTransformsContent ( DependencySet dependencySet )
185
+ {
186
+ return isUnpackWithOptions ( dependencySet ) && isConentModifyingOption ( dependencySet .getUnpackOptions () );
187
+ }
188
+
189
+ private boolean isConentModifyingOption ( UnpackOptions opts )
190
+ {
191
+ return ( opts .isFiltered () || opts .getLineEnding () != null );
192
+ }
193
+
184
194
private void checkMultiArtifactOutputConfig ( final DependencySet dependencySet )
185
195
{
186
196
String dir = dependencySet .getOutputDirectory ();
@@ -198,8 +208,9 @@ private void checkMultiArtifactOutputConfig( final DependencySet dependencySet )
198
208
if ( ( dir == null || !dir .contains ( "${" ) ) && ( mapping == null || !mapping .contains ( "${" ) ) )
199
209
{
200
210
logger .warn ( "NOTE: Your assembly specifies a dependencySet that matches multiple artifacts, but "
201
- + "specifies a concrete output format. THIS MAY RESULT IN ONE OR MORE ARTIFACTS BEING OBSCURED!\n \n "
202
- + "Output directory: '" + dir + "'\n Output filename mapping: '" + mapping + "'" );
211
+ + "specifies a concrete output format. THIS MAY RESULT IN ONE OR MORE ARTIFACTS BEING "
212
+ + "OBSCURED!\n \n " + "Output directory: '" + dir + "'\n Output filename mapping: '" + mapping
213
+ + "'" );
203
214
}
204
215
}
205
216
@@ -234,7 +245,7 @@ private void addNormalArtifact( final DependencySet dependencySet, final Artifac
234
245
task .setUnpack ( dependencySet .isUnpack () );
235
246
236
247
final UnpackOptions opts = dependencySet .getUnpackOptions ();
237
- if ( dependencySet . isUnpack () && ( opts != null ) )
248
+ if ( isUnpackWithOptions ( dependencySet ) )
238
249
{
239
250
task .setIncludes ( opts .getIncludes () );
240
251
task .setExcludes ( opts .getExcludes () );
0 commit comments