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

Added buildFileClasspat().

This commit is contained in:
Cedric Beust 2016-06-24 04:14:08 -08:00
parent c06e92b679
commit 25b97dd21f
4 changed files with 22 additions and 0 deletions

View file

@ -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)

View file

@ -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() {