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

Fix the repo bug.

Repo contributors were not applied early enough, so resources coming from the Android m2repository could not be resolved.
This commit is contained in:
Cedric Beust 2015-12-28 20:56:03 +04:00
parent 5dc1953ea8
commit c16a93e4a2
2 changed files with 21 additions and 15 deletions

View file

@ -16,9 +16,21 @@ public class Kobalt {
var context: KobaltContext? = null var context: KobaltContext? = null
val repos = HashSet<HostConfig>(Constants.DEFAULT_REPOS.map { HostConfig(it) }) /**
* @return the repos from the build files and from the contributors.
*/
val repos : Set<HostConfig>
get() {
val result = HashSet(reposFromBuildFiles)
Kobalt.context?.pluginInfo?.repoContributors?.forEach {
result.addAll(it.reposFor(null))
}
return result
}
fun addRepo(repo: HostConfig) = repos.add( val reposFromBuildFiles = HashSet<HostConfig>(Constants.DEFAULT_REPOS.map { HostConfig(it) })
fun addRepo(repo: HostConfig) = reposFromBuildFiles.add(
if (repo.url.endsWith("/")) repo if (repo.url.endsWith("/")) repo
else repo.copy(url = (repo.url + "/"))) else repo.copy(url = (repo.url + "/")))

View file

@ -65,21 +65,9 @@ private class Main @Inject constructor(
data class RunInfo(val jc: JCommander, val args: Args) data class RunInfo(val jc: JCommander, val args: Args)
private fun addReposFromContributors(project: Project?) =
pluginInfo.repoContributors.forEach {
it.reposFor(project).forEach {
Kobalt.addRepo(it)
}
}
public fun run(jc: JCommander, args: Args, argv: Array<String>): Int { public fun run(jc: JCommander, args: Args, argv: Array<String>): Int {
// github.uploadRelease("kobalt", "0.101", File("/Users/beust/t/a.zip")) // github.uploadRelease("kobalt", "0.101", File("/Users/beust/t/a.zip"))
//
// Add all the repos from repo contributors (at least those that return values without a Project)
//
addReposFromContributors(null)
// //
// Add all the plugins read in kobalt-plugin.xml to the Plugins singleton, so that code // Add all the plugins read in kobalt-plugin.xml to the Plugins singleton, so that code
// in the build file that calls Plugins.findPlugin() can find them (code in the // in the build file that calls Plugins.findPlugin() can find them (code in the
@ -167,7 +155,13 @@ private class Main @Inject constructor(
// //
// Now that we have projects, add all the repos from repo contributors that need a Project // Now that we have projects, add all the repos from repo contributors that need a Project
// //
allProjects.forEach { addReposFromContributors(it) } allProjects.forEach { project ->
pluginInfo.repoContributors.forEach {
it.reposFor(project).forEach {
Kobalt.addRepo(it)
}
}
}
// //
// Run all their dependencies through the IDependencyInterceptors // Run all their dependencies through the IDependencyInterceptors