mirror of
https://github.com/ethauvin/kobalt.git
synced 2025-04-26 08:27:12 -07:00
Disallow same project names.
This commit is contained in:
parent
858dc8f33e
commit
e992d8b935
1 changed files with 13 additions and 0 deletions
|
@ -62,6 +62,17 @@ public class BuildFileCompiler @Inject constructor(@Assisted("buildFiles") val b
|
||||||
return allProjects
|
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> {
|
private fun findProjects(context: KobaltContext): List<Project> {
|
||||||
val result = arrayListOf<Project>()
|
val result = arrayListOf<Project>()
|
||||||
buildFiles.forEach { buildFile ->
|
buildFiles.forEach { buildFile ->
|
||||||
|
@ -255,6 +266,8 @@ public class BuildFileCompiler @Inject constructor(@Assisted("buildFiles") val b
|
||||||
stream?.close()
|
stream?.close()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
validateProjects(projects)
|
||||||
|
|
||||||
//
|
//
|
||||||
// Now that the build file has run, fetch all the project contributors, grab the projects from them and sort
|
// Now that the build file has run, fetch all the project contributors, grab the projects from them and sort
|
||||||
// them topologically
|
// them topologically
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue