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

Disallow same project names.

This commit is contained in:
Cedric Beust 2015-11-17 23:16:00 -08:00
parent 858dc8f33e
commit e992d8b935

View file

@ -62,6 +62,17 @@ public class BuildFileCompiler @Inject constructor(@Assisted("buildFiles") val b
return allProjects
}
private fun validateProjects(projects: List<Project>) {
val seen = hashSetOf<String>()
projects.forEach {
if (seen.contains(it.name)) {
throw KobaltException("Duplicate project name: $it")
} else {
seen.add(it.name)
}
}
}
private fun findProjects(context: KobaltContext): List<Project> {
val result = arrayListOf<Project>()
buildFiles.forEach { buildFile ->
@ -255,6 +266,8 @@ public class BuildFileCompiler @Inject constructor(@Assisted("buildFiles") val b
stream?.close()
}
validateProjects(projects)
//
// Now that the build file has run, fetch all the project contributors, grab the projects from them and sort
// them topologically