mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27: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,
|
||||
dependentProjects: List<ProjectDescription>,
|
||||
vararg allDependencies: List<IClasspathDependency>): List<IClasspathDependency> {
|
||||
var result = arrayListOf<IClasspathDependency>()
|
||||
val result = arrayListOf<IClasspathDependency>()
|
||||
allDependencies.forEach { 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)
|
||||
: List<IClasspathDependency> {
|
||||
val result = arrayListOf<IClasspathDependency>()
|
||||
val transitive = hashSetOf<IClasspathDependency>()
|
||||
val projects = listOf(ProjectDescription(project, project.projectExtra.dependsOn))
|
||||
with(project) {
|
||||
val deps = arrayListOf(compileDependencies, compileProvidedDependencies)
|
||||
|
@ -197,17 +197,17 @@ class DependencyManager @Inject constructor(val executors: KobaltExecutors, val
|
|||
deps.add(testDependencies)
|
||||
deps.add(testProvidedDependencies)
|
||||
}
|
||||
deps.forEach {
|
||||
result.addAll(calculateDependencies(project, context, projects, it))
|
||||
deps.filter { it.any() }.forEach {
|
||||
transitive.addAll(calculateDependencies(project, context, projects, it))
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
val result2 = listOf(FileDependency(KFiles.makeOutputDir(project).absolutePath),
|
||||
val result = listOf(FileDependency(KFiles.makeOutputDir(project).absolutePath),
|
||||
FileDependency(KFiles.makeOutputTestDir(project).absolutePath)) +
|
||||
reorderDependencies(result)
|
||||
return result2
|
||||
reorderDependencies(transitive)
|
||||
return result
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -220,6 +220,10 @@ class AetherDependency(val artifact: Artifact): IClasspathDependency, Comparable
|
|||
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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue