diff --git a/README.md b/README.md index cdce237ed..ff01a3052 100644 --- a/README.md +++ b/README.md @@ -52,8 +52,9 @@ Lastly, it can be used programmatically via its [API](#api) and has a Scala JS [ 4. [Limitations](#limitations) 5. [FAQ](#faq) 6. [Roadmap](#roadmap) -7. [Contributors](#contributors) -8. [Projects using coursier](#projects-using-coursier) +7. [Development tips](#development-tips) +8. [Contributors](#contributors) +9. [Projects using coursier](#projects-using-coursier) ## Quick start @@ -605,6 +606,17 @@ Set the `COURSIER_NO_TERM` environment variable to `1`. This disables the progress bar message, and prints simple `Downloading URL` / `Downloaded URL` instead. +## Development tips + +#### Working on the plugin module in an IDE + +Set `scalaVersion` to `2.10.6` in `build.sbt`. Then re-open / reload the coursier project. + +#### Running the Scala JS tests + +They require `npm install` to have been run once from the `coursier` directory or a subdirectory of +it. They can then be run with `sbt testsJS/test`. + ## Roadmap The first releases were milestones like `0.1.0-M?`. As a launcher, basic Ivy diff --git a/doc/README.md b/doc/README.md index dc45347da..dac98922e 100644 --- a/doc/README.md +++ b/doc/README.md @@ -52,8 +52,9 @@ Lastly, it can be used programmatically via its [API](#api) and has a Scala JS [ 4. [Limitations](#limitations) 5. [FAQ](#faq) 6. [Roadmap](#roadmap) -7. [Contributors](#contributors) -8. [Projects using coursier](#projects-using-coursier) +7. [Development tips](#development-tips) +8. [Contributors](#contributors) +9. [Projects using coursier](#projects-using-coursier) ## Quick start @@ -629,6 +630,17 @@ Set the `COURSIER_NO_TERM` environment variable to `1`. This disables the progress bar message, and prints simple `Downloading URL` / `Downloaded URL` instead. +## Development tips + +#### Working on the plugin module in an IDE + +Set `scalaVersion` to `2.10.6` in `build.sbt`. Then re-open / reload the coursier project. + +#### Running the Scala JS tests + +They require `npm install` to have been run once from the `coursier` directory or a subdirectory of +it. They can then be run with `sbt testsJS/test`. + ## Roadmap The first releases were milestones like `0.1.0-M?`. As a launcher, basic Ivy diff --git a/plugin/src/main/scala-2.10/coursier/Tasks.scala b/plugin/src/main/scala-2.10/coursier/Tasks.scala index 96582b6fd..b88058e75 100644 --- a/plugin/src/main/scala-2.10/coursier/Tasks.scala +++ b/plugin/src/main/scala-2.10/coursier/Tasks.scala @@ -154,6 +154,14 @@ object Tasks { private val resolutionsCache = new mutable.HashMap[CacheKey, UpdateReport] + private def forcedScalaModules(scalaVersion: String): Map[Module, String] = + Map( + Module("org.scala-lang", "scala-library") -> scalaVersion, + Module("org.scala-lang", "scala-compiler") -> scalaVersion, + Module("org.scala-lang", "scala-reflect") -> scalaVersion, + Module("org.scala-lang", "scalap") -> scalaVersion + ) + def updateTask(withClassifiers: Boolean, sbtClassifiers: Boolean = false) = Def.task { // SBT logging should be better than that most of the time... @@ -209,6 +217,8 @@ object Tasks { val cachePolicy = coursierCachePolicy.value val cacheDir = coursierCache.value + val sv = scalaVersion.value // is this always defined? (e.g. for Java only projects?) + val resolvers = if (sbtClassifiers) coursierSbtResolvers.value @@ -221,7 +231,7 @@ object Tasks { val startRes = Resolution( currentProject.dependencies.map { case (_, dep) => dep }.toSet, filter = Some(dep => !dep.optional), - forceVersions = projects.map(_.moduleVersion).toMap + forceVersions = forcedScalaModules(sv) ++ projects.map(_.moduleVersion) ) // required for publish to be fine, later on diff --git a/tests/js/src/test/scala/coursier/test/compatibility/package.scala b/tests/js/src/test/scala/coursier/test/compatibility/package.scala index fb2d0da9c..c9c7d11fa 100644 --- a/tests/js/src/test/scala/coursier/test/compatibility/package.scala +++ b/tests/js/src/test/scala/coursier/test/compatibility/package.scala @@ -15,7 +15,7 @@ package object compatibility { fs.readFile("tests/shared/src/test/resources/" + path, "utf-8", { (err: js.Dynamic, data: js.Dynamic) => - if (err == null) p.success(data.asInstanceOf[String]) + if (js.isUndefined(err) || err == null) p.success(data.asInstanceOf[String]) else p.failure(new Exception(err.toString)) () }: js.Function2[js.Dynamic, js.Dynamic, Unit])