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

Update to the upcoming hierarchy.

This commit is contained in:
Cedric Beust 2015-12-15 23:16:18 +04:00
parent 5630d32fac
commit e023dabf4e
2 changed files with 11 additions and 6 deletions

View file

@ -36,8 +36,8 @@ class BuildScriptUtil @Inject constructor(val plugins: Plugins, val files: KFile
fun runBuildScriptJarFile(buildScriptJarFile: File, urls: List<URL>,
context: KobaltContext) : List<Project> {
var stream : InputStream? = null
val allUrls = (urls + arrayOf(
buildScriptJarFile.toURI().toURL()) + File(files.kobaltJar).toURI().toURL())
val allUrls = (urls + arrayOf(buildScriptJarFile.toURI().toURL())
+ files.kobaltJar.map {File(it).toURI().toURL() })
.toTypedArray()
val classLoader = URLClassLoader(allUrls)

View file

@ -15,22 +15,27 @@ import kotlin.io.FileSystemException
import kotlin.io.NoSuchFileException
class KFiles {
val kobaltJar : String
/**
* This actually returns a list of strings because in development mode, we are not pointing to a single
* jar file but to a set of /classes directories.
*/
val kobaltJar : List<String>
get() {
val envJar = System.getenv("KOBALT_JAR")
if (envJar != null) {
debug("Using kobalt jar $envJar")
return File(envJar).absolutePath
return listOf(File(envJar).absolutePath)
} else {
val jar = joinDir(distributionsDir, Kobalt.version, "kobalt/wrapper/kobalt-" + Kobalt.version + ".jar")
val jarFile = File(jar)
if (jarFile.exists()) {
return jarFile.absolutePath
return listOf(jarFile.absolutePath)
} else {
// Will only happen when building kobalt itself: the jar file might not be in the dist/ directory
// yet since we're currently building it. Instead, use the classes directly
debug("Couldn't find ${jarFile.absolutePath}, using build/classes/main")
return File(homeDir("kotlin", "kobalt", "build", "classes", "main")).absolutePath
return listOf(File(homeDir("kotlin", "kobalt", "build", "classes", "main")).absolutePath,
File(homeDir("kotlin", "kobalt", "classes", "production", "kobalt-plugin-api")).absolutePath)
}
}
}