Merge pull request #267 from alexarchambault/topic/scala-org

Take into account scalaOrganization setting
This commit is contained in:
Alexandre Archambault 2016-05-30 20:42:50 +02:00
commit bde69ecb10
9 changed files with 79 additions and 7 deletions

View File

@ -212,12 +212,15 @@ object Tasks {
// are cached // are cached
private val reportsCache = new mutable.HashMap[ReportCacheKey, UpdateReport] private val reportsCache = new mutable.HashMap[ReportCacheKey, UpdateReport]
private def forcedScalaModules(scalaVersion: String): Map[Module, String] = private def forcedScalaModules(
scalaOrganization: String,
scalaVersion: String
): Map[Module, String] =
Map( Map(
Module("org.scala-lang", "scala-library") -> scalaVersion, Module(scalaOrganization, "scala-library") -> scalaVersion,
Module("org.scala-lang", "scala-compiler") -> scalaVersion, Module(scalaOrganization, "scala-compiler") -> scalaVersion,
Module("org.scala-lang", "scala-reflect") -> scalaVersion, Module(scalaOrganization, "scala-reflect") -> scalaVersion,
Module("org.scala-lang", "scalap") -> scalaVersion Module(scalaOrganization, "scalap") -> scalaVersion
) )
private def projectDescription(project: Project) = private def projectDescription(project: Project) =
@ -270,7 +273,9 @@ object Tasks {
val log = streams.value.log val log = streams.value.log
val sv = scalaVersion.value // is this always defined? (e.g. for Java only projects?) // are these always defined? (e.g. for Java only projects?)
val so = scalaOrganization.value
val sv = scalaVersion.value
val sbv = scalaBinaryVersion.value val sbv = scalaBinaryVersion.value
val userForceVersions = dependencyOverrides.value.map( val userForceVersions = dependencyOverrides.value.map(
@ -348,7 +353,7 @@ object Tasks {
// order matters here // order matters here
userForceVersions ++ userForceVersions ++
sourceRepositoriesForcedDependencies ++ sourceRepositoriesForcedDependencies ++
forcedScalaModules(sv) ++ forcedScalaModules(so, sv) ++
projects.map(_.moduleVersion) projects.map(_.moduleVersion)
) )

View File

@ -0,0 +1,13 @@
scalaOrganization := "org.typelevel"
scalaVersion := "2.11.7"
scalacOptions += "-Xexperimental"
// no effect, as the right version is forced anyway (to scalaVersion.value)
libraryDependencies += "org.typelevel" % "scala-library" % "2.11.12345"
coursierCachePolicies := {
if (sys.props("os.name").startsWith("Windows"))
coursierCachePolicies.value
else
Seq(coursier.CachePolicy.ForceDownload)
}

View File

@ -0,0 +1,11 @@
{
val pluginVersion = sys.props.getOrElse(
"plugin.version",
throw new RuntimeException(
"""|The system property 'plugin.version' is not defined.
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin
)
)
addSbtPlugin("io.get-coursier" % "sbt-coursier" % pluginVersion)
}

View File

@ -0,0 +1,8 @@
import java.io.File
import java.nio.file.Files
object Main extends App {
val n': 2.type = 2
Files.write(new File("output").toPath, "OK".getBytes("UTF-8"))
}

View File

@ -0,0 +1,3 @@
$ delete output
> run
$ exists output

View File

@ -0,0 +1,10 @@
scalaOrganization := "org.typelevel"
scalaVersion := "2.11.7"
scalacOptions += "-Xexperimental"
coursierCachePolicies := {
if (sys.props("os.name").startsWith("Windows"))
coursierCachePolicies.value
else
Seq(coursier.CachePolicy.ForceDownload)
}

View File

@ -0,0 +1,11 @@
{
val pluginVersion = sys.props.getOrElse(
"plugin.version",
throw new RuntimeException(
"""|The system property 'plugin.version' is not defined.
|Specify this property using the scriptedLaunchOpts -D.""".stripMargin
)
)
addSbtPlugin("io.get-coursier" % "sbt-coursier" % pluginVersion)
}

View File

@ -0,0 +1,8 @@
import java.io.File
import java.nio.file.Files
object Main extends App {
val n': 2.type = 2
Files.write(new File("output").toPath, "OK".getBytes("UTF-8"))
}

View File

@ -0,0 +1,3 @@
$ delete output
> run
$ exists output