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

Refactor.

This commit is contained in:
Cedric Beust 2015-10-30 12:01:49 -07:00
parent 571a46a5ac
commit 66e00fa7d8
2 changed files with 10 additions and 9 deletions

View file

@ -4,6 +4,7 @@ import com.beust.kobalt.api.KobaltContext
import com.beust.kobalt.api.Project
import com.beust.kobalt.maven.DependencyManager
import com.beust.kobalt.maven.IClasspathDependency
import com.beust.kobalt.maven.KobaltException
import com.google.inject.Inject
import java.io.File
@ -19,10 +20,18 @@ class JvmCompiler @Inject constructor(val dependencyManager: DependencyManager)
val allDependencies = arrayListOf<IClasspathDependency>()
allDependencies.addAll(info.dependencies)
allDependencies.addAll(calculateDependencies(project, context, info.dependencies))
JvmCompilerPlugin.validateClasspath(allDependencies.map { it.jarFile.get().absolutePath })
validateClasspath(allDependencies.map { it.jarFile.get().absolutePath })
return action.compile(info.copy(dependencies = allDependencies))
}
private fun validateClasspath(cp: List<String>) {
cp.forEach {
if (! File(it).exists()) {
throw KobaltException("Couldn't find $it")
}
}
}
/**
* @return the classpath for this project, including the IClasspathContributors.
*/

View file

@ -30,14 +30,6 @@ abstract class JvmCompilerPlugin @Inject constructor(
const val SOURCE_SET_MAIN = "main"
const val SOURCE_SET_TEST = "test"
const val DOCS_DIRECTORY = "docs/javadoc"
fun validateClasspath(cp: List<String>) {
cp.forEach {
if (! File(it).exists()) {
throw KobaltException("Couldn't find $it")
}
}
}
}
/**