Skip to content

Commit fd10da8

Browse files
author
Wesley Hartford
committed
Couple minor fixes to changes for static compile
1 parent a2cff62 commit fd10da8

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/main/groovy/ca/cutterslade/gradle/analyze/ProjectDependencyResolver.groovy

+12-6
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,20 @@ class ProjectDependencyResolver {
4141
throw new IllegalStateException('Dependency analysis plugin must also be applied to the root project', e)
4242
}
4343
this.logger = project.logger
44-
this.require = removeNulls(require)
45-
this.allowedToUse = removeNulls(allowedToUse)
46-
this.allowedToDeclare = removeNulls(allowedToDeclare)
44+
this.require = removeNulls(require) as List
45+
this.allowedToUse = removeNulls(allowedToUse) as List
46+
this.allowedToDeclare = removeNulls(allowedToDeclare) as List
4747
this.classesDirs = classesDirs
4848
}
4949

50-
static <T, C extends Collection<T>> C removeNulls(final C collection) {
51-
(null == collection ? [] : collection - null) as C
50+
static <T> Collection<T> removeNulls(final Collection<T> collection) {
51+
if (null == collection) {
52+
[]
53+
}
54+
else {
55+
collection.removeAll {it == null}
56+
collection
57+
}
5258
}
5359

5460
ProjectDependencyAnalysis analyzeDependencies() {
@@ -90,7 +96,7 @@ class ProjectDependencyResolver {
9096

9197
Set<ResolvedArtifact> allArtifacts = (((require
9298
.collect {it.resolvedConfiguration}
93-
.collect {it.firstLevelModuleDependencies}) as Set<ResolvedDependency>)
99+
.collect {it.firstLevelModuleDependencies}.flatten()) as Set<ResolvedDependency>)
94100
.collect {it.allModuleArtifacts}.flatten()) as Set<ResolvedArtifact>
95101

96102
logger.info "allArtifacts = $allArtifacts"

0 commit comments

Comments
 (0)