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

Add <kobalt-compiler-version> and -repo to settings.

This commit is contained in:
Cedric Beust 2016-04-10 20:49:38 -07:00
parent 7bea179d69
commit e51664edea
4 changed files with 27 additions and 7 deletions

View file

@ -22,16 +22,25 @@ class Kobalt {
val repos : Set<HostConfig>
get() {
val settingsRepos = Kobalt.context?.settings?.defaultRepos ?: emptyList()
// Repos from <default-repos> in the settings
val result = ArrayList(
(if (settingsRepos.isEmpty()) Constants.DEFAULT_REPOS
else settingsRepos)
.map { HostConfig(it) })
// Repo from <kobalt-compiler-repo> in the settings
Kobalt.context?.settings?.kobaltCompilerRepo?.let {
result.add(HostConfig(it))
}
// Repos from the repo contributors
Kobalt.context?.pluginInfo?.repoContributors?.forEach {
result.addAll(it.reposFor(null))
}
// Repos from the build file
result.addAll(reposFromBuildFiles)
return result.toHashSet()
}

View file

@ -21,6 +21,12 @@ class KobaltSettingsXml {
@XmlElement(name = "default-repos") @JvmField
var defaultRepos: DefaultReposXml? = null
@XmlElement(name = "kobalt-compiler-version") @JvmField
var kobaltCompilerVersion: String = "1.0.0"
@XmlElement(name = "kobalt-compiler-repo") @JvmField
var kobaltCompilerRepo: String? = null
}
class DefaultReposXml {
@ -40,6 +46,9 @@ class KobaltSettings @Inject constructor(val xmlFile: KobaltSettingsXml) {
val defaultRepos = xmlFile.defaultRepos?.repo
var kobaltCompilerVersion = xmlFile.kobaltCompilerVersion
var kobaltCompilerRepo = xmlFile.kobaltCompilerRepo
companion object {
val SETTINGS_FILE_PATH = KFiles.joinDir(KFiles.HOME_KOBALT_DIR.absolutePath, "settings.xml")