diff --git a/.travis.yml b/.travis.yml index 2f6ffe43f..f3e6666e8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,6 +12,9 @@ script: # - bash <(curl -s https://codecov.io/bash) matrix: include: + - env: TRAVIS_SCALA_VERSION=2.12.0-RC2 PUBLISH=1 + os: linux + jdk: oraclejdk8 - env: TRAVIS_SCALA_VERSION=2.11.8 PUBLISH=1 os: linux jdk: oraclejdk8 diff --git a/build.sbt b/build.sbt index 7df37f01a..da900e188 100644 --- a/build.sbt +++ b/build.sbt @@ -47,21 +47,21 @@ lazy val noPublishSettings = Seq( publishArtifact := false ) -def noPublishForScalaVersionSettings(sbv: String) = Seq( +def noPublishForScalaVersionSettings(sbv: String*) = Seq( publish := { - if (scalaBinaryVersion.value == sbv) + if (sbv.contains(scalaBinaryVersion.value)) () else publish.value }, publishLocal := { - if (scalaBinaryVersion.value == sbv) + if (sbv.contains(scalaBinaryVersion.value)) () else publishLocal.value }, publishArtifact := { - if (scalaBinaryVersion.value == sbv) + if (sbv.contains(scalaBinaryVersion.value)) false else publishArtifact.value @@ -74,26 +74,40 @@ lazy val scalaVersionAgnosticCommonSettings = Seq( "Scalaz Bintray Repo" at "http://dl.bintray.com/scalaz/releases", Resolver.sonatypeRepo("releases") ), - scalacOptions += "-target:jvm-1.7", - javacOptions ++= Seq( - "-source", "1.7", - "-target", "1.7" - ), + scalacOptions ++= { + scalaBinaryVersion.value match { + case "2.10" | "2.11" => + Seq("-target:jvm-1.7") + case _ => + Seq() + } + }, + javacOptions ++= { + scalaBinaryVersion.value match { + case "2.10" | "2.11" => + Seq( + "-source", "1.7", + "-target", "1.7" + ) + case _ => + Seq() + } + }, javacOptions in Keys.doc := Seq() ) ++ releaseSettings lazy val commonSettings = scalaVersionAgnosticCommonSettings ++ Seq( scalaVersion := "2.11.8", - crossScalaVersions := Seq("2.11.8", "2.10.6"), + crossScalaVersions := Seq("2.12.0-RC2", "2.11.8", "2.10.6"), libraryDependencies ++= { if (scalaBinaryVersion.value == "2.10") - Seq(compilerPlugin("org.scalamacros" % "paradise" % "2.0.1" cross CrossVersion.full)) + Seq(compilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full)) else Seq() } ) -val scalazVersion = "7.2.5" +val scalazVersion = "7.2.6" lazy val core = crossProject .settings(commonSettings: _*) @@ -102,30 +116,16 @@ lazy val core = crossProject name := "coursier", libraryDependencies ++= Seq( "org.scalaz" %%% "scalaz-core" % scalazVersion, - "com.lihaoyi" %%% "fastparse" % "0.3.7" + "com.lihaoyi" %%% "fastparse" % "0.4.2" ), - resourceGenerators.in(Compile) += { - (target, version).map { (dir, ver) => - import sys.process._ - - val f = dir / "coursier.properties" - dir.mkdirs() - - val p = new java.util.Properties - - p.setProperty("version", ver) - p.setProperty("commit-hash", Seq("git", "rev-parse", "HEAD").!!.trim) - - val w = new FileOutputStream(f) - p.store(w, "Coursier properties") - w.close() - - println(s"Wrote $f") - - Seq(f) - }.taskValue + mimaPreviousArtifacts := { + scalaBinaryVersion.value match { + case "2.10" | "2.11" => + Set("com.github.alexarchambault" %% moduleName.value % binaryCompatibilityVersion) + case _ => + Set() + } }, - mimaPreviousArtifacts := Set("com.github.alexarchambault" %% moduleName.value % binaryCompatibilityVersion), mimaBinaryIssueFilters ++= { import com.typesafe.tools.mima.core._ @@ -205,12 +205,32 @@ lazy val core = crossProject else Seq( "org.scala-lang.modules" %% "scala-xml" % "1.0.5" ) - } + }, + resourceGenerators.in(Compile) += { + (target, version).map { (dir, ver) => + import sys.process._ + + val f = dir / "coursier.properties" + dir.mkdirs() + + val p = new java.util.Properties + + p.setProperty("version", ver) + p.setProperty("commit-hash", Seq("git", "rev-parse", "HEAD").!!.trim) + + val w = new FileOutputStream(f) + p.store(w, "Coursier properties") + w.close() + + println(s"Wrote $f") + + Seq(f) + }.taskValue + } ) .jsSettings( libraryDependencies ++= Seq( - "org.scala-js" %%% "scalajs-dom" % "0.9.1", - "be.doeraene" %%% "scalajs-jquery" % "0.9.0" + "org.scala-js" %%% "scalajs-dom" % "0.9.1" ) ) @@ -234,17 +254,21 @@ lazy val tests = crossProject .settings(Defaults.itSettings: _*) .settings( name := "coursier-tests", - libraryDependencies ++= Seq( - "org.scala-lang.modules" %% "scala-async" % "0.9.5" % "provided", - "com.lihaoyi" %%% "utest" % "0.4.3" % "test" - ), + libraryDependencies += { + val asyncVersion = + if (scalaBinaryVersion.value == "2.10") + "0.9.5" + else + "0.9.6-RC6" + + "org.scala-lang.modules" %% "scala-async" % asyncVersion % "provided" + }, + libraryDependencies += "com.lihaoyi" %%% "utest" % "0.4.4" % "test", unmanagedResourceDirectories in Test += (baseDirectory in LocalRootProject).value / "tests" / "shared" / "src" / "test" / "resources", testFrameworks += new TestFramework("utest.runner.Framework") ) .jsSettings( - jsEnv := NodeJSEnv().value, - scalaJSStage in Global := FastOptStage, - scalaJSUseRhino in Global := false + scalaJSStage in Global := FastOptStage ) lazy val testsJvm = tests.jvm.dependsOn(cache % "test") @@ -257,7 +281,14 @@ lazy val cache = project .settings( name := "coursier-cache", libraryDependencies += "org.scalaz" %% "scalaz-concurrent" % scalazVersion, - mimaPreviousArtifacts := Set("com.github.alexarchambault" %% moduleName.value % binaryCompatibilityVersion), + mimaPreviousArtifacts := { + scalaBinaryVersion.value match { + case "2.10" | "2.11" => + Set("com.github.alexarchambault" %% moduleName.value % binaryCompatibilityVersion) + case _ => + Set() + } + }, mimaBinaryIssueFilters ++= { import com.typesafe.tools.mima.core._ @@ -334,16 +365,16 @@ lazy val bootstrap = project lazy val cli = project .dependsOn(coreJvm, cache) .settings(commonSettings) - .settings(noPublishForScalaVersionSettings("2.10")) + .settings(noPublishForScalaVersionSettings("2.10", "2.12")) .settings(packAutoSettings) .settings(proguardSettings) .settings( name := "coursier-cli", libraryDependencies ++= { - if (scalaBinaryVersion.value == "2.10") - Seq() - else + if (scalaBinaryVersion.value == "2.11") Seq("com.github.alexarchambault" %% "case-app" % "1.1.2") + else + Seq() }, resourceGenerators in Compile += packageBin.in(bootstrap).in(Compile).map { jar => Seq(jar) @@ -357,16 +388,17 @@ lazy val cli = project javaOptions in (Proguard, ProguardKeys.proguard) := Seq("-Xmx3172M"), artifactPath in Proguard := (ProguardKeys.proguardDirectory in Proguard).value / "coursier-standalone.jar", artifacts ++= { - if (scalaBinaryVersion.value == "2.10") - Nil - else Seq( - Artifact( - moduleName.value, - "jar", - "jar", - "standalone" + if (scalaBinaryVersion.value == "2.11") + Seq( + Artifact( + moduleName.value, + "jar", + "jar", + "standalone" + ) ) - ) + else + Nil }, packagedArtifacts <++= { ( @@ -376,9 +408,7 @@ lazy val cli = project packageBin.in(bootstrap) in Compile ).map { (mod, sbv, files, bootstrapJar) => - if (sbv == "2.10") - Map.empty[Artifact, File] - else { + if (sbv == "2.11") { import java.util.zip.{ ZipEntry, ZipOutputStream, ZipInputStream } import java.io.{ ByteArrayOutputStream, FileInputStream, FileOutputStream, File, InputStream, IOException } @@ -455,7 +485,8 @@ lazy val cli = project "standalone" ) -> f ) - } + } else + Map.empty[Artifact, File] } } ) @@ -467,18 +498,21 @@ lazy val web = project .settings(noPublishSettings) .settings( libraryDependencies ++= { - if (scalaBinaryVersion.value == "2.10") - Seq() + if (scalaBinaryVersion.value == "2.11") + Seq( + "be.doeraene" %%% "scalajs-jquery" % "0.9.0", + "com.github.japgolly.scalajs-react" %%% "core" % "0.9.0" + ) else - Seq("com.github.japgolly.scalajs-react" %%% "core" % "0.9.0") + Seq() }, sourceDirectory := { val dir = sourceDirectory.value - if (scalaBinaryVersion.value == "2.10") - dir / "dummy" - else + if (scalaBinaryVersion.value == "2.11") dir + else + dir / "dummy" }, test in Test := (), testOnly in Test := (), @@ -505,7 +539,7 @@ lazy val doc = project lazy val plugin = project .dependsOn(coreJvm, cache) .settings(scalaVersionAgnosticCommonSettings) - .settings(noPublishForScalaVersionSettings("2.11")) + .settings(noPublishForScalaVersionSettings("2.11", "2.12")) .settings( name := "sbt-coursier", sbtPlugin := (scalaBinaryVersion.value == "2.10"), @@ -533,14 +567,20 @@ val http4sVersion = "0.8.6" lazy val `http-server` = project .settings(commonSettings) .settings(packAutoSettings) + .settings(noPublishForScalaVersionSettings("2.10", "2.12")) .settings( name := "http-server-java7", - libraryDependencies ++= Seq( - "org.http4s" %% "http4s-blazeserver" % http4sVersion, - "org.http4s" %% "http4s-dsl" % http4sVersion, - "org.slf4j" % "slf4j-nop" % "1.7.21", - "com.github.alexarchambault" %% "case-app" % "1.1.2" - ) + libraryDependencies ++= { + if (scalaBinaryVersion.value == "2.11") + Seq( + "org.http4s" %% "http4s-blazeserver" % http4sVersion, + "org.http4s" %% "http4s-dsl" % http4sVersion, + "org.slf4j" % "slf4j-nop" % "1.7.21", + "com.github.alexarchambault" %% "case-app" % "1.1.2" + ) + else + Seq() + } ) lazy val okhttp = project diff --git a/core/shared/src/main/scala/coursier/ivy/IvyXml.scala b/core/shared/src/main/scala/coursier/ivy/IvyXml.scala index 3654688bf..464d3a5ab 100644 --- a/core/shared/src/main/scala/coursier/ivy/IvyXml.scala +++ b/core/shared/src/main/scala/coursier/ivy/IvyXml.scala @@ -107,26 +107,27 @@ object IvyXml { .find(_.label == "info") .toRightDisjunction("Info not found") - (module, version) <- info(infoNode) + modVer <- info(infoNode) + } yield { - dependenciesNodeOpt = node.children + val (module, version) = modVer + + val dependenciesNodeOpt = node.children .find(_.label == "dependencies") - dependencies0 = dependenciesNodeOpt.map(dependencies).getOrElse(Nil) + val dependencies0 = dependenciesNodeOpt.map(dependencies).getOrElse(Nil) - configurationsNodeOpt = node.children + val configurationsNodeOpt = node.children .find(_.label == "configurations") - configurationsOpt = configurationsNodeOpt.map(configurations) + val configurationsOpt = configurationsNodeOpt.map(configurations) - configurations0 = configurationsOpt.getOrElse(Seq("default" -> Seq.empty[String])) + val configurations0 = configurationsOpt.getOrElse(Seq("default" -> Seq.empty[String])) - publicationsNodeOpt = node.children + val publicationsNodeOpt = node.children .find(_.label == "publications") - publicationsOpt = publicationsNodeOpt.map(publications) - - } yield { + val publicationsOpt = publicationsNodeOpt.map(publications) val description = infoNode.children .find(_.label == "description") diff --git a/http-server/src/main/scala/coursier/HttpServer.scala b/http-server/src/main/scala-2.11/coursier/HttpServer.scala similarity index 100% rename from http-server/src/main/scala/coursier/HttpServer.scala rename to http-server/src/main/scala-2.11/coursier/HttpServer.scala diff --git a/project/plugins.sbt b/project/plugins.sbt index b5d5bb769..213b7b1a9 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,9 +1,9 @@ addSbtPlugin("org.xerial.sbt" % "sbt-pack" % "0.8.0") -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.11") +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.13") addSbtPlugin("com.jsuereth" % "sbt-pgp" % "1.0.0") -addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.1.0") -addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.4.2") +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.4.0") +addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.4.5") addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-M14") addSbtPlugin("com.typesafe.sbt" % "sbt-proguard" % "0.2.2") -addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.9") +addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.11") libraryDependencies += "org.scala-sbt" % "scripted-plugin" % sbtVersion.value diff --git a/tests/shared/src/test/resources/resolutions/io.get-coursier/coursier_2.11/1.0.0-SNAPSHOT b/tests/shared/src/test/resources/resolutions/io.get-coursier/coursier_2.11/1.0.0-SNAPSHOT index ff45bfc0d..3382a209b 100644 --- a/tests/shared/src/test/resources/resolutions/io.get-coursier/coursier_2.11/1.0.0-SNAPSHOT +++ b/tests/shared/src/test/resources/resolutions/io.get-coursier/coursier_2.11/1.0.0-SNAPSHOT @@ -1,8 +1,8 @@ -com.lihaoyi:fastparse-utils_2.11:0.3.7:default -com.lihaoyi:fastparse_2.11:0.3.7:default -com.lihaoyi:sourcecode_2.11:0.1.1:default +com.lihaoyi:fastparse-utils_2.11:0.4.2:default +com.lihaoyi:fastparse_2.11:0.4.2:default +com.lihaoyi:sourcecode_2.11:0.1.3:default io.get-coursier:coursier_2.11:1.0.0-SNAPSHOT:compile org.jsoup:jsoup:1.9.2:default org.scala-lang:scala-library:2.11.8:default org.scala-lang.modules:scala-xml_2.11:1.0.5:default -org.scalaz:scalaz-core_2.11:7.2.5:default +org.scalaz:scalaz-core_2.11:7.2.6:default diff --git a/tests/shared/src/test/scala/coursier/test/CentralTests.scala b/tests/shared/src/test/scala/coursier/test/CentralTests.scala index d9a5022f2..61ad892ff 100644 --- a/tests/shared/src/test/scala/coursier/test/CentralTests.scala +++ b/tests/shared/src/test/scala/coursier/test/CentralTests.scala @@ -92,7 +92,7 @@ object CentralTests extends TestSuite { } for (((e, r), idx) <- expected.zip(result).zipWithIndex if e != r) - println(s"Line $idx:\n expected: $e\n got: $r") + println(s"Line ${idx + 1}:\n expected: $e\n got: $r") assert(result == expected) }