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

Fix KobaltSettings.

This commit is contained in:
Cedric Beust 2016-04-01 22:41:18 -07:00
parent c6f9c88d2a
commit 453097240b
5 changed files with 9 additions and 20 deletions

View file

@ -36,12 +36,12 @@ class KobaltSettings @Inject constructor(val xmlFile: KobaltSettingsXml) {
/**
* Location of the local repo.
*/
var localRepo = xmlFile.localRepo // var for testing
var localRepo = KFiles.makeDir(xmlFile.localRepo) // var for testing
val defaultRepos = xmlFile.defaultRepos?.repo
companion object {
val SETTINGS_FILE_PATH = homeDir(KFiles.HOME_KOBALT_DIR.absolutePath, "settings.xml")
val SETTINGS_FILE_PATH = KFiles.joinDir(KFiles.HOME_KOBALT_DIR.absolutePath, "settings.xml")
fun readSettingsXml() : KobaltSettings {
val file = File(KobaltSettings.SETTINGS_FILE_PATH)

View file

@ -9,15 +9,8 @@ import java.util.*
import javax.inject.Singleton
@Singleton
open public class LocalRepo @Inject constructor(val kobaltSettings: KobaltSettings) {
init {
val l = File(localRepo)
if (! l.exists()) {
l.mkdirs()
}
}
val localRepo: String
open class LocalRepo @Inject constructor(val kobaltSettings: KobaltSettings) {
val localRepo: File
get() = kobaltSettings.localRepo
fun existsPom(d: LocalDep, v: String) : Boolean {
@ -55,9 +48,7 @@ open public class LocalRepo @Inject constructor(val kobaltSettings: KobaltSettin
return null
}
fun toFullPath(path: String) : String {
return localRepo + File.separatorChar + path
}
fun toFullPath(path: String) = File(localRepo, path).absolutePath
}

View file

@ -33,7 +33,7 @@ import java.util.concurrent.Future
class DependencyResult(val dependency: IClasspathDependency, val repoUrl: String)
class KobaltAether @Inject constructor (val settings: KobaltSettings, val aether: Aether) {
val localRepo: File get() = File(settings.localRepo)
val localRepo: File get() = settings.localRepo
class MaybeArtifact(val result: DependencyResult?, val error: String?)