Skip to content

Commit

Permalink
Merge pull request #7 from skyluc/issue/merging-missing-bases
Browse files Browse the repository at this point in the history
Stops mergebases from failing if a base is missing
  • Loading branch information
Luc Bourlier committed Mar 20, 2013
2 parents 49f457e + d0b3c0a commit ef6bca7
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
Expand Up @@ -15,7 +15,7 @@ object MergeBasesBuild {
val baseScalaIDEVersions = getScalaIDEVersions(baseRepo)
val nextBaseScalaIDEVersions = getScalaIDEVersions(nextBaseRepo)

MergeBasesBuild(ecosystemConf.id, baseRepo, nextBaseRepo, !nextBaseScalaIDEVersions.forall(baseScalaIDEVersions.contains(_)))
MergeBasesBuild(ecosystemConf.id, baseRepo, nextBaseRepo, nextBaseRepo.isValid && !nextBaseScalaIDEVersions.forall(baseScalaIDEVersions.contains(_)))
}

private def getScalaIDEVersions(repo: P2Repository) = repo.findIU(ScalaIDEFeatureIdOsgi).map(_.version)
Expand Down
Expand Up @@ -70,14 +70,11 @@ object MergeBasesBuildsMavenProjects {
</executions>
<configuration>
<source>
<repository>
<url>{ build.baseRepo.location }</url>
<layout>p2</layout>
</repository>
<repository>
<url>{ build.nextBaseRepo.location }</url>
<layout>p2</layout>
</repository>
{
if (build.baseRepo.isValid)
repoReference(build.baseRepo)
}
{ repoReference(build.nextBaseRepo) }
</source>
<destination>${{project.build.directory}}/base</destination>
</configuration>
Expand All @@ -87,4 +84,10 @@ object MergeBasesBuildsMavenProjects {
</project>
}

private def repoReference(repo: P2Repository) =
<repository>
<url>{ repo.location }</url>
<layout>p2</layout>
</repository>

}
4 changes: 4 additions & 0 deletions src/main/scala/org/scalaide/buildtools/P2Repository.scala
Expand Up @@ -81,6 +81,7 @@ object InstallableUnit {
trait P2Repository {
def uis: Map[String, TreeSet[InstallableUnit]]
def findIU(unitId: String): TreeSet[InstallableUnit]
def isValid: Boolean
def location: String
}

Expand All @@ -89,6 +90,8 @@ case class ValidP2Repository (uis: Map[String, TreeSet[InstallableUnit]], locati
override def findIU(unitId: String): TreeSet[InstallableUnit] =
uis get (unitId) getOrElse (TreeSet.empty[InstallableUnit])

override def isValid = true

override def toString = "P2Repository(%s)".format(location)

override def equals(o: Any): Boolean = {
Expand All @@ -105,6 +108,7 @@ case class ValidP2Repository (uis: Map[String, TreeSet[InstallableUnit]], locati
case class ErrorP2Repository (errorMessage: String, location: String) extends P2Repository {
override def findIU(unitId: String): TreeSet[InstallableUnit] = TreeSet()
override def uis: Map[String, TreeSet[InstallableUnit]] = Map()
override def isValid = false
}

object P2Repository {
Expand Down

0 comments on commit ef6bca7

Please sign in to comment.