mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Fix KobaltSettings.
This commit is contained in:
parent
c6f9c88d2a
commit
453097240b
5 changed files with 9 additions and 20 deletions
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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?)
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@ import com.google.inject.Provider
|
|||
import com.google.inject.Singleton
|
||||
import com.google.inject.TypeLiteral
|
||||
import com.google.inject.assistedinject.FactoryModuleBuilder
|
||||
import java.io.File
|
||||
import java.util.concurrent.ExecutorService
|
||||
|
||||
public open class MainModule(val args: Args, val settings: KobaltSettings) : AbstractModule() {
|
||||
|
@ -52,7 +51,7 @@ public open class MainModule(val args: Args, val settings: KobaltSettings) : Abs
|
|||
bind(KobaltSettings::class.java).toProvider(Provider<KobaltSettings> {
|
||||
settings
|
||||
}).`in`(Singleton::class.java)
|
||||
bind(Aether::class.java).toInstance(Aether(File(settings.localRepo)))
|
||||
bind(Aether::class.java).toInstance(Aether(settings.localRepo))
|
||||
|
||||
// bindListener(Matchers.any(), object: TypeListener {
|
||||
// override fun <I> hear(typeLiteral: TypeLiteral<I>?, typeEncounter: TypeEncounter<I>?) {
|
||||
|
|
|
@ -8,13 +8,12 @@ import com.google.inject.Scopes
|
|||
import java.io.File
|
||||
|
||||
val TEST_KOBALT_SETTINGS = KobaltSettings(KobaltSettingsXml()).apply {
|
||||
localRepo = SystemProperties.homeDir + File.separatorChar + "" +
|
||||
".kobalt-test"
|
||||
localRepo = File(SystemProperties.homeDir + File.separatorChar + ".kobalt-test")
|
||||
}
|
||||
|
||||
class TestLocalRepo: LocalRepo(TEST_KOBALT_SETTINGS)
|
||||
|
||||
public class TestModule : MainModule(Args(), TEST_KOBALT_SETTINGS) {
|
||||
class TestModule : MainModule(Args(), TEST_KOBALT_SETTINGS) {
|
||||
override fun configureTest() {
|
||||
bind(LocalRepo::class.java).to(TestLocalRepo::class.java).`in`(Scopes.SINGLETON)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue