mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Refactor.
This commit is contained in:
parent
f6927e2304
commit
451ddf3590
1 changed files with 11 additions and 23 deletions
|
@ -111,17 +111,19 @@ public class DependencyManager @Inject constructor(val executors: KobaltExecutor
|
|||
return result
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the compile dependencies for this project, including the contributors.
|
||||
* TODO: very similar to the method below, refactor.
|
||||
*/
|
||||
fun dependencies(project: Project, context: KobaltContext) : List<IClasspathDependency> {
|
||||
private fun dependencies(project: Project, context: KobaltContext, isTest: Boolean)
|
||||
: List<IClasspathDependency> {
|
||||
val result = arrayListOf<IClasspathDependency>()
|
||||
val projects = listOf(ProjectDescription(project, project.projectExtra.dependsOn))
|
||||
result.add(FileDependency(KFiles.makeOutputDir(project).absolutePath))
|
||||
result.add(FileDependency(KFiles.makeOutputTestDir(project).absolutePath))
|
||||
with(project) {
|
||||
arrayListOf(compileDependencies, compileProvidedDependencies).forEach {
|
||||
val deps = arrayListOf(compileDependencies, compileProvidedDependencies)
|
||||
if (isTest) {
|
||||
deps.add(testDependencies)
|
||||
deps.add(testProvidedDependencies)
|
||||
}
|
||||
deps.forEach {
|
||||
result.addAll(calculateDependencies(project, context, projects, it))
|
||||
}
|
||||
}
|
||||
|
@ -129,24 +131,10 @@ public class DependencyManager @Inject constructor(val executors: KobaltExecutor
|
|||
return result2
|
||||
}
|
||||
|
||||
fun dependencies(project: Project, context: KobaltContext) = dependencies(project, context, false)
|
||||
|
||||
/**
|
||||
* @return the test dependencies for this project, including the contributors.
|
||||
*/
|
||||
fun testDependencies(project: Project, context: KobaltContext) : List<IClasspathDependency> {
|
||||
val result = arrayListOf<IClasspathDependency>()
|
||||
val projects = listOf(ProjectDescription(project, project.projectExtra.dependsOn))
|
||||
result.add(FileDependency(KFiles.makeOutputDir(project).absolutePath))
|
||||
result.add(FileDependency(KFiles.makeOutputTestDir(project).absolutePath))
|
||||
with(project) {
|
||||
arrayListOf(compileDependencies, compileProvidedDependencies, testDependencies,
|
||||
testProvidedDependencies).forEach {
|
||||
result.addAll(calculateDependencies(project, context, projects, it))
|
||||
}
|
||||
}
|
||||
val result2 = reorderDependencies(result)
|
||||
return result2
|
||||
}
|
||||
|
||||
|
||||
|
||||
fun testDependencies(project: Project, context: KobaltContext) = dependencies(project, context, true)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue