Skip to content

Commit

Permalink
add support for sbt 0.13, fixes sbt#35
Browse files Browse the repository at this point in the history
  • Loading branch information
jrudolph committed Jul 22, 2013
1 parent 9d373be commit f7c66f5
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
5 changes: 5 additions & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 8,9 @@ CrossBuilding.scriptedSettings

libraryDependencies = "com.github.mdr" %% "ascii-graphs" % "0.0.3"

libraryDependencies < = scalaVersion { version =>
if (version startsWith "2.1") Seq("org.scala-lang" % "scala-reflect" % version % "provided")
else Nil
}

scalacOptions = Seq("-deprecation", "-unchecked")
39 changes: 39 additions & 0 deletions src/main/scala-sbt-0.13/sbt/SbtDependencyGraphCompat.scala
Original file line number Diff line number Diff line change
@@ -0,0 1,39 @@
package sbt

import net.virtualvoid.sbt.graph.Plugin._
import Keys._
import CrossVersion._

object SbtDependencyGraphCompat {
/**
* This is copied directly from sbt/main/Defaults.java and then changed to update the UpdateConfiguration
* to ignore missing artifacts.
*/
def ignoreMissingUpdateT =
ignoreMissingUpdate <<= Def.task {
val depsUpdated = transitiveUpdate.value.exists(!_.stats.cached)
val isRoot = executionRoots.value contains resolvedScoped.value
val s = streams.value
val scalaProvider = appConfiguration.value.provider.scalaProvider

// Only substitute unmanaged jars for managed jars when the major.minor parts of the versions the same for:
// the resolved Scala version and the scalaHome version: compatible (weakly- no qualifier checked)
// the resolved Scala version and the declared scalaVersion: assume the user intended scalaHome to override anything with scalaVersion
def subUnmanaged(subVersion: String, jars: Seq[File]) = (sv: String) =>
(partialVersion(sv), partialVersion(subVersion), partialVersion(scalaVersion.value)) match {
case (Some(res), Some(sh), _) if res == sh => jars
case (Some(res), _, Some(decl)) if res == decl => jars
case _ => Nil
}
val subScalaJars: String => Seq[File] = Defaults.unmanagedScalaInstanceOnly.value match {
case Some(si) => subUnmanaged(si.version, si.jars)
case None => sv => if(scalaProvider.version == sv) scalaProvider.jars else Nil
}
val transform: UpdateReport => UpdateReport = r => Classpaths.substituteScalaFiles(scalaOrganization.value, r)(subScalaJars)

val show = Reference.display(thisProjectRef.value)
Classpaths.cachedUpdate(s.cacheDirectory, show, ivyModule.value, (updateConfiguration in ignoreMissingUpdate).value, transform, skip = (skip in update).value, force = isRoot, depsUpdated = depsUpdated, log = s.log)
}

def getTerminalWidth: Int = JLine.usingTerminal(_.getWidth)
}

0 comments on commit f7c66f5

Please sign in to comment.