From 06d0e4fac31fc4d7bc2b239fd7a37c148ec59a77 Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Wed, 24 Feb 2016 20:22:27 +0100 Subject: [PATCH 1/3] A bit more reliable Scala JS file reading in tests Was sometimes getting undefined error locally --- .../js/src/test/scala/coursier/test/compatibility/package.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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]) From 03f6359cf76be5b850f0162f3491687680d933e9 Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Wed, 24 Feb 2016 20:22:28 +0100 Subject: [PATCH 2/3] Add development tips section in README --- README.md | 16 ++++++++++++++-- doc/README.md | 16 ++++++++++++++-- 2 files changed, 28 insertions(+), 4 deletions(-) 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 From 10400ec8c556ead5e888afabe244ab3057bad79a Mon Sep 17 00:00:00 2001 From: Alexandre Archambault Date: Wed, 24 Feb 2016 20:22:29 +0100 Subject: [PATCH 3/3] Force versions of the usual org.scala-lang modules --- plugin/src/main/scala-2.10/coursier/Tasks.scala | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) 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