Merge pull request #172 from alexarchambault/topic/plugin-force-scala-artifact-version

Force versions of the usual org.scala-lang modules, from the SBT plugin
This commit is contained in:
Alexandre Archambault 2016-02-25 00:40:59 +01:00
commit a8c8c83645
4 changed files with 40 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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])