diff --git a/build.sbt b/build.sbt index 5e74aa15e..5000fd925 100644 --- a/build.sbt +++ b/build.sbt @@ -1,7 +1,16 @@ seq(lsSettings :_*) -CrossBuilding.crossSbtVersions := Seq("0.11.1", "0.11.2", "0.11.3", "0.12") +crossBuildingSettings + +CrossBuilding.crossSbtVersions := Seq("0.11.1", "0.11.2", "0.11.3", "0.12", "0.13") CrossBuilding.scriptedSettings -libraryDependencies += "com.github.mdr" %% "ascii-graphs" % "0.0.2" +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") diff --git a/project/plugins.sbt b/project/plugins.sbt index 80dd7f871..fe876fa09 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -4,4 +4,4 @@ addSbtPlugin("me.lessis" % "ls-sbt" % "0.1.2") resolvers += "Coda Hale's Repo" at "http://repo.codahale.com" -addSbtPlugin("net.virtual-void" % "sbt-cross-building" % "0.7.0") +addSbtPlugin("net.virtual-void" % "sbt-cross-building" % "0.8.0-RC1") diff --git a/src/main/scala-sbt-0.11/sbt/SbtDependencyGraphCompat.scala b/src/main/scala-sbt-0.11/sbt/SbtDependencyGraphCompat.scala index 6a4bc3535..e6ff9bb49 100644 --- a/src/main/scala-sbt-0.11/sbt/SbtDependencyGraphCompat.scala +++ b/src/main/scala-sbt-0.11/sbt/SbtDependencyGraphCompat.scala @@ -9,11 +9,10 @@ object SbtDependencyGraphCompat { * to ignore missing artifacts. */ def ignoreMissingUpdateT = - ignoreMissingUpdate <<= (ivyModule, thisProjectRef, updateConfiguration, cacheDirectory, scalaInstance, transitiveUpdate, streams) map { (module, ref, config, cacheDirectory, si, reports, s) => + ignoreMissingUpdate <<= (ivyModule, thisProjectRef, updateConfiguration in ignoreMissingUpdate, cacheDirectory, scalaInstance, transitiveUpdate, streams) map { (module, ref, config, cacheDirectory, si, reports, s) => val depsUpdated = reports.exists(!_.stats.cached) - val missingOkConfig = new UpdateConfiguration(config.retrieve, true, config.logging) - Classpaths.cachedUpdate(cacheDirectory / "update", Project.display(ref), module, missingOkConfig, Some(si), depsUpdated, s.log) + Classpaths.cachedUpdate(cacheDirectory / "update", Project.display(ref), module, config, Some(si), depsUpdated, s.log) } import complete.DefaultParsers._ diff --git a/src/main/scala-sbt-0.12/sbt/SbtDependencyGraphCompat.scala b/src/main/scala-sbt-0.12/sbt/SbtDependencyGraphCompat.scala index 72826e3f5..56df72740 100644 --- a/src/main/scala-sbt-0.12/sbt/SbtDependencyGraphCompat.scala +++ b/src/main/scala-sbt-0.12/sbt/SbtDependencyGraphCompat.scala @@ -9,13 +9,12 @@ object SbtDependencyGraphCompat { * to ignore missing artifacts. */ def ignoreMissingUpdateT = - ignoreMissingUpdate <<= (ivyModule, thisProjectRef, updateConfiguration, cacheDirectory, scalaInstance, transitiveUpdate, executionRoots, resolvedScoped, skip in update, streams) map { + ignoreMissingUpdate <<= (ivyModule, thisProjectRef, updateConfiguration in ignoreMissingUpdate, cacheDirectory, scalaInstance, transitiveUpdate, executionRoots, resolvedScoped, skip in update, streams) map { (module, ref, config, cacheDirectory, si, reports, roots, resolved, skip, s) => val depsUpdated = reports.exists(!_.stats.cached) val isRoot = roots contains resolved - val missingOkConfig = new UpdateConfiguration(config.retrieve, true, config.logging) - Classpaths.cachedUpdate(cacheDirectory / "update", Project.display(ref), module, missingOkConfig, Some(si), skip = skip, force = isRoot, depsUpdated = depsUpdated, log = s.log) + Classpaths.cachedUpdate(cacheDirectory / "update", Project.display(ref), module, config, Some(si), skip = skip, force = isRoot, depsUpdated = depsUpdated, log = s.log) } tag(Tags.Update, Tags.Network) def getTerminalWidth: Int = JLine.usingTerminal(_.getTerminalWidth) diff --git a/src/main/scala-sbt-0.13/sbt/SbtDependencyGraphCompat.scala b/src/main/scala-sbt-0.13/sbt/SbtDependencyGraphCompat.scala new file mode 100644 index 000000000..a75305639 --- /dev/null +++ b/src/main/scala-sbt-0.13/sbt/SbtDependencyGraphCompat.scala @@ -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) +} diff --git a/src/main/scala/net/virtualvoid/sbt/graph/Plugin.scala b/src/main/scala/net/virtualvoid/sbt/graph/Plugin.scala index 4ca5fd38a..24f6cca6a 100755 --- a/src/main/scala/net/virtualvoid/sbt/graph/Plugin.scala +++ b/src/main/scala/net/virtualvoid/sbt/graph/Plugin.scala @@ -79,6 +79,7 @@ object Plugin extends sbt.Plugin { (c: String) => file("%s/cache/%s-%s-%s.xml" format (home, projectID.organization, crossName(ivyModule), c)) } }, + updateConfiguration in ignoreMissingUpdate <<= updateConfiguration(config => new UpdateConfiguration(config.retrieve, true, config.logging)), SbtDependencyGraphCompat.ignoreMissingUpdateT, filterScalaLibrary in Global := true ) ++ Seq(Compile, Test, Runtime, Provided, Optional).flatMap(ivyReportForConfig) diff --git a/src/sbt-test/sbt-dependency-graph/intervalRangedVersions/build.sbt b/src/sbt-test/sbt-dependency-graph/intervalRangedVersions/build.sbt index 19030bcf6..0ef12f58a 100644 --- a/src/sbt-test/sbt-dependency-graph/intervalRangedVersions/build.sbt +++ b/src/sbt-test/sbt-dependency-graph/intervalRangedVersions/build.sbt @@ -2,7 +2,7 @@ import net.virtualvoid.sbt.graph.Plugin._ graphSettings -scalaVersion := "2.9.2" +scalaVersion := "2.9.1" libraryDependencies ++= Seq( "com.codahale" % "jerkson_2.9.1" % "0.5.0" @@ -13,9 +13,9 @@ TaskKey[Unit]("check") <<= (ivyReport in Test, asciiTree in Test) map { (report, val expectedGraph = """default:default-dbc48d_2.9.2:0.1-SNAPSHOT [S] | +-com.codahale:jerkson_2.9.1:0.5.0 [S] - | +-org.codehaus.jackson:jackson-core-asl:1.9.12 - | +-org.codehaus.jackson:jackson-mapper-asl:1.9.12 - | +-org.codehaus.jackson:jackson-core-asl:1.9.12 + | +-org.codehaus.jackson:jackson-core-asl:1.9.13 + | +-org.codehaus.jackson:jackson-mapper-asl:1.9.13 + | +-org.codehaus.jackson:jackson-core-asl:1.9.13 | """.stripMargin IO.writeLines(file("/tmp/blib"), sanitize(graph).split("\n")) IO.writeLines(file("/tmp/blub"), sanitize(expectedGraph).split("\n")) diff --git a/src/sbt-test/sbt-dependency-graph/testDotFileGeneration/project/Build.scala b/src/sbt-test/sbt-dependency-graph/testDotFileGeneration/project/Build.scala index 2becd0917..a4a1622ba 100644 --- a/src/sbt-test/sbt-dependency-graph/testDotFileGeneration/project/Build.scala +++ b/src/sbt-test/sbt-dependency-graph/testDotFileGeneration/project/Build.scala @@ -10,20 +10,20 @@ object Build extends sbt.Build { seq(scalaVersion := "2.9.2") lazy val justATransiviteDependencyEndpointProject = - Project("just-a-transitive-dependency-endpoint", file(".")) + Project("just-a-transitive-dependency-endpoint", file("a")) .settings(defaultSettings: _*) lazy val justATransitiveDependencyProject = - Project("just-a-transitive-dependency", file(".")) + Project("just-a-transitive-dependency", file("b")) .settings(defaultSettings: _*) .dependsOn(justATransiviteDependencyEndpointProject) lazy val justADependencyProject = - Project("just-a-dependency", file(".")) + Project("just-a-dependency", file("c")) .settings(defaultSettings: _*) lazy val test_project = - Project("test-dot-file-generation", file(".")) + Project("test-dot-file-generation", file("d")) .settings(graphSettings: _*) .settings(defaultSettings: _*) .settings(