1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt.git synced 2025-04-26 08:27:12 -07:00

Fix excluded dependencies.

This commit is contained in:
Cedric Beust 2017-02-18 08:05:17 -08:00
parent 58d5101e11
commit 10967067f7

View file

@ -66,15 +66,21 @@ class RemoteDependencyData @Inject constructor(val executors: KobaltExecutors, v
children = node.children.map { toDependencyData2(scope, it) }) children = node.children.map { toDependencyData2(scope, it) })
} }
val OPTIONAL_FILTER = { dep: IClasspathDependency -> ! dep.optional } fun dependencyFilter(excluded: List<IClasspathDependency>) = { dep: IClasspathDependency ->
if (excluded.contains(dep)) {
log(2, " Excluding $dep")
}
! excluded.contains(dep) && ! dep.optional
}
fun compileDependenciesGraph(project: Project, name: String): List<DependencyData> { fun compileDependenciesGraph(project: Project, name: String): List<DependencyData> {
val depLambda = IClasspathDependency::directDependencies val depLambda = IClasspathDependency::directDependencies
val result = val resultDep =
(DynamicGraph.Companion.transitiveClosureGraph(project.compileDependencies, depLambda, (DynamicGraph.Companion.transitiveClosureGraph(project.compileDependencies, depLambda,
OPTIONAL_FILTER) + dependencyFilter(project.excludedDependencies)) +
DynamicGraph.Companion.transitiveClosureGraph(project.compileProvidedDependencies, depLambda, DynamicGraph.Companion.transitiveClosureGraph(project.compileProvidedDependencies, depLambda,
OPTIONAL_FILTER)) dependencyFilter(project.excludedDependencies)))
val result = resultDep
.map { toDependencyData2("compile", it)} .map { toDependencyData2("compile", it)}
fun mapOfLatestVersions(l: List<DependencyData>) : Map<String, String> { fun mapOfLatestVersions(l: List<DependencyData>) : Map<String, String> {
@ -116,8 +122,9 @@ class RemoteDependencyData @Inject constructor(val executors: KobaltExecutors, v
fun testDependenciesGraph(project: Project, name: String): List<DependencyData> { fun testDependenciesGraph(project: Project, name: String): List<DependencyData> {
val depLambda = IClasspathDependency::directDependencies val depLambda = IClasspathDependency::directDependencies
return DynamicGraph.Companion.transitiveClosureGraph(project.testDependencies, depLambda, OPTIONAL_FILTER) return DynamicGraph.Companion.transitiveClosureGraph(project.testDependencies, depLambda,
.map { toDependencyData2("testCompile", it)} dependencyFilter(project.excludedDependencies))
.map { toDependencyData2("testCompile", it)}
} }
val allTasks = hashSetOf<TaskData>() val allTasks = hashSetOf<TaskData>()