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

Add optional filter for transitive closure.

This commit is contained in:
Cedric Beust 2017-02-09 10:44:59 -08:00
parent 11980ca940
commit 47f7072d9c
2 changed files with 17 additions and 13 deletions

View file

@ -67,20 +67,21 @@ class RemoteDependencyData @Inject constructor(val executors: KobaltExecutors, v
children = node.children.map { toDependencyData2(scope, it) })
}
val OPTIONAL_FILTER = { dep: IClasspathDependency -> ! dep.optional }
fun compileDependenciesGraph(project: Project, name: String): List<DependencyData> {
val depLambda = IClasspathDependency::directDependencies
val result =
(DynamicGraph.Companion.transitiveClosureGraph(pluginDependencies, depLambda) +
DynamicGraph.Companion.transitiveClosureGraph(project.compileDependencies, depLambda) +
DynamicGraph.Companion.transitiveClosureGraph(project.compileProvidedDependencies, depLambda))
(DynamicGraph.Companion.transitiveClosureGraph(pluginDependencies, depLambda, OPTIONAL_FILTER) +
DynamicGraph.Companion.transitiveClosureGraph(project.compileDependencies, depLambda,
OPTIONAL_FILTER) +
DynamicGraph.Companion.transitiveClosureGraph(project.compileProvidedDependencies, depLambda,
OPTIONAL_FILTER))
.map { toDependencyData2("compile", it)}
fun mapOfLatestVersions(l: List<DependencyData>) : Map<String, String> {
fun p(l: List<DependencyData>, latestVersions: HashMap<String, String>) {
fun p(l: List<DependencyData>, latestVersions: java.util.HashMap<String, String>) {
l.forEach {
if (it.id.contains("squareup:okio")) {
println("DONOTCOMMIT")
}
val mid = MavenId.create(it.id)
val shortId = mid.artifactId + ":" + mid.artifactId
val currentLatest = latestVersions[shortId]
@ -114,7 +115,7 @@ class RemoteDependencyData @Inject constructor(val executors: KobaltExecutors, v
fun testDependenciesGraph(project: Project, name: String): List<DependencyData> {
val depLambda = { dep : IClasspathDependency -> dep.directDependencies() }
return DynamicGraph.Companion.transitiveClosureGraph(project.testDependencies, depLambda)
return DynamicGraph.Companion.transitiveClosureGraph(project.testDependencies, depLambda, OPTIONAL_FILTER)
.map { toDependencyData2("testCompile", it)}
}