mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Added buildFileClasspat().
This commit is contained in:
parent
c06e92b679
commit
25b97dd21f
4 changed files with 22 additions and 0 deletions
|
@ -57,6 +57,11 @@ fun repos(vararg repos : String) {
|
|||
repos.forEach { Kobalt.addRepo(HostConfig(it)) }
|
||||
}
|
||||
|
||||
@Directive
|
||||
fun buildFileClasspath(vararg deps: String) {
|
||||
deps.forEach { Kobalt.addBuildFileClasspath(it) }
|
||||
}
|
||||
|
||||
@Directive
|
||||
fun authRepos(vararg repos : HostConfig) {
|
||||
repos.forEach { Kobalt.addRepo(it) }
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.beust.kobalt.Constants
|
|||
import com.beust.kobalt.HostConfig
|
||||
import com.beust.kobalt.Plugins
|
||||
import com.beust.kobalt.internal.PluginInfo
|
||||
import com.beust.kobalt.maven.DependencyManager
|
||||
import com.google.inject.Guice
|
||||
import com.google.inject.Injector
|
||||
import com.google.inject.Module
|
||||
|
@ -65,6 +66,13 @@ class Kobalt {
|
|||
if (repo.url.endsWith("/")) repo
|
||||
else repo.copy(url = (repo.url + "/")))
|
||||
|
||||
val buildFileClasspath = arrayListOf<IClasspathDependency>()
|
||||
|
||||
fun addBuildFileClasspath(dep: String) {
|
||||
val dependencyManager = Kobalt.INJECTOR.getInstance(DependencyManager::class.java)
|
||||
buildFileClasspath.add(dependencyManager.create(dep))
|
||||
}
|
||||
|
||||
private val KOBALT_PROPERTIES = "kobalt.properties"
|
||||
private val PROPERTY_KOBALT_VERSION = "kobalt.version"
|
||||
private val PROPERTY_KOBALT_VERSION_CHECK_TIMEOUT = "kobalt.version.checkTimeout" // ISO-8601
|
||||
|
|
|
@ -121,9 +121,11 @@ public class BuildFileCompiler @Inject constructor(@Assisted("buildFiles") val b
|
|||
log(2, " Need to recompile ${buildFile.name}")
|
||||
|
||||
buildScriptJarFile.delete()
|
||||
val buildFileClasspath = Kobalt.buildFileClasspath.map { it.jarFile.get() }.map { it.absolutePath }
|
||||
val result = kotlinCompilePrivate {
|
||||
classpath(files.kobaltJar)
|
||||
classpath(pluginUrls.map { it.file })
|
||||
classpath(buildFileClasspath)
|
||||
sourceFiles(listOf(buildFile.realPath.toFile().absolutePath))
|
||||
output = buildScriptJarFile
|
||||
}.compile(context = context)
|
||||
|
|
|
@ -22,6 +22,7 @@ class ParsedBuildFile(val buildFile: BuildFile, val context: KobaltContext, val
|
|||
val dependencyManager: DependencyManager, val files: KFiles) {
|
||||
val pluginList = arrayListOf<String>()
|
||||
val repos = arrayListOf<String>()
|
||||
val buildFileClasspath = arrayListOf<String>()
|
||||
val profileLines = arrayListOf<String>()
|
||||
val pluginUrls = arrayListOf<URL>()
|
||||
val projects = arrayListOf<Project>()
|
||||
|
@ -51,6 +52,11 @@ class ParsedBuildFile(val buildFile: BuildFile, val context: KobaltContext, val
|
|||
index = line.indexOf("repos(")
|
||||
if (index >= 0) {
|
||||
current = repos
|
||||
} else {
|
||||
index = line.indexOf("buildFileClasspath(")
|
||||
if (index >= 0) {
|
||||
current = buildFileClasspath
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -91,6 +97,7 @@ class ParsedBuildFile(val buildFile: BuildFile, val context: KobaltContext, val
|
|||
|
||||
repos.forEach { preBuildScript.add(it) }
|
||||
pluginList.forEach { preBuildScript.add(it) }
|
||||
buildFileClasspath.forEach { preBuildScript.add(it) }
|
||||
}
|
||||
|
||||
private fun initPluginUrls() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue