mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Refactor.
This commit is contained in:
parent
571a46a5ac
commit
66e00fa7d8
2 changed files with 10 additions and 9 deletions
|
@ -4,6 +4,7 @@ import com.beust.kobalt.api.KobaltContext
|
||||||
import com.beust.kobalt.api.Project
|
import com.beust.kobalt.api.Project
|
||||||
import com.beust.kobalt.maven.DependencyManager
|
import com.beust.kobalt.maven.DependencyManager
|
||||||
import com.beust.kobalt.maven.IClasspathDependency
|
import com.beust.kobalt.maven.IClasspathDependency
|
||||||
|
import com.beust.kobalt.maven.KobaltException
|
||||||
import com.google.inject.Inject
|
import com.google.inject.Inject
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
|
@ -19,10 +20,18 @@ class JvmCompiler @Inject constructor(val dependencyManager: DependencyManager)
|
||||||
val allDependencies = arrayListOf<IClasspathDependency>()
|
val allDependencies = arrayListOf<IClasspathDependency>()
|
||||||
allDependencies.addAll(info.dependencies)
|
allDependencies.addAll(info.dependencies)
|
||||||
allDependencies.addAll(calculateDependencies(project, context, 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))
|
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.
|
* @return the classpath for this project, including the IClasspathContributors.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -30,14 +30,6 @@ abstract class JvmCompilerPlugin @Inject constructor(
|
||||||
const val SOURCE_SET_MAIN = "main"
|
const val SOURCE_SET_MAIN = "main"
|
||||||
const val SOURCE_SET_TEST = "test"
|
const val SOURCE_SET_TEST = "test"
|
||||||
const val DOCS_DIRECTORY = "docs/javadoc"
|
const val DOCS_DIRECTORY = "docs/javadoc"
|
||||||
|
|
||||||
fun validateClasspath(cp: List<String>) {
|
|
||||||
cp.forEach {
|
|
||||||
if (! File(it).exists()) {
|
|
||||||
throw KobaltException("Couldn't find $it")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue