mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 16:28:12 -07:00
[GITHUB-193] Fix multiple class path contributor call.
Fixes https://github.com/cbeust/kobalt/issues/193
This commit is contained in:
parent
1207d152a0
commit
38288be20c
2 changed files with 11 additions and 7 deletions
|
@ -88,7 +88,7 @@ class DependencyManager @Inject constructor(val executors: KobaltExecutors, val
|
||||||
override fun calculateDependencies(project: Project?, context: KobaltContext,
|
override fun calculateDependencies(project: Project?, context: KobaltContext,
|
||||||
dependentProjects: List<ProjectDescription>,
|
dependentProjects: List<ProjectDescription>,
|
||||||
vararg allDependencies: List<IClasspathDependency>): List<IClasspathDependency> {
|
vararg allDependencies: List<IClasspathDependency>): List<IClasspathDependency> {
|
||||||
var result = arrayListOf<IClasspathDependency>()
|
val result = arrayListOf<IClasspathDependency>()
|
||||||
allDependencies.forEach { dependencies ->
|
allDependencies.forEach { dependencies ->
|
||||||
result.addAll(transitiveClosure(dependencies))
|
result.addAll(transitiveClosure(dependencies))
|
||||||
}
|
}
|
||||||
|
@ -189,7 +189,7 @@ class DependencyManager @Inject constructor(val executors: KobaltExecutors, val
|
||||||
|
|
||||||
private fun dependencies(project: Project, context: KobaltContext, isTest: Boolean)
|
private fun dependencies(project: Project, context: KobaltContext, isTest: Boolean)
|
||||||
: List<IClasspathDependency> {
|
: List<IClasspathDependency> {
|
||||||
val result = arrayListOf<IClasspathDependency>()
|
val transitive = hashSetOf<IClasspathDependency>()
|
||||||
val projects = listOf(ProjectDescription(project, project.projectExtra.dependsOn))
|
val projects = listOf(ProjectDescription(project, project.projectExtra.dependsOn))
|
||||||
with(project) {
|
with(project) {
|
||||||
val deps = arrayListOf(compileDependencies, compileProvidedDependencies)
|
val deps = arrayListOf(compileDependencies, compileProvidedDependencies)
|
||||||
|
@ -197,17 +197,17 @@ class DependencyManager @Inject constructor(val executors: KobaltExecutors, val
|
||||||
deps.add(testDependencies)
|
deps.add(testDependencies)
|
||||||
deps.add(testProvidedDependencies)
|
deps.add(testProvidedDependencies)
|
||||||
}
|
}
|
||||||
deps.forEach {
|
deps.filter { it.any() }.forEach {
|
||||||
result.addAll(calculateDependencies(project, context, projects, it))
|
transitive.addAll(calculateDependencies(project, context, projects, it))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure that classes/ and test-classes/ are always at the top of this classpath,
|
// Make sure that classes/ and test-classes/ are always at the top of this classpath,
|
||||||
// so that older versions of that project on the classpath don't shadow them
|
// so that older versions of that project on the classpath don't shadow them
|
||||||
val result2 = listOf(FileDependency(KFiles.makeOutputDir(project).absolutePath),
|
val result = listOf(FileDependency(KFiles.makeOutputDir(project).absolutePath),
|
||||||
FileDependency(KFiles.makeOutputTestDir(project).absolutePath)) +
|
FileDependency(KFiles.makeOutputTestDir(project).absolutePath)) +
|
||||||
reorderDependencies(result)
|
reorderDependencies(transitive)
|
||||||
return result2
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -220,6 +220,10 @@ class AetherDependency(val artifact: Artifact): IClasspathDependency, Comparable
|
||||||
other.artifact.version))
|
other.artifact.version))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun hashCode() = id.hashCode()
|
||||||
|
|
||||||
|
override fun equals(other: Any?) = if (other is AetherDependency) other.id == id else false
|
||||||
|
|
||||||
override fun toString() = id
|
override fun toString() = id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue