Don't force scala version if autoScalaLibrary is false

This commit is contained in:
Alexandre Archambault 2018-10-29 11:30:34 +01:00
parent ce6c7a2c64
commit 594eb47bc5
4 changed files with 35 additions and 1 deletions

View File

@ -814,6 +814,8 @@ object Tasks {
val (currentProject, fallbackDependencies, configGraphs) = currentProjectTask.value
val autoScalaLib = autoScalaLibrary.value
val resolvers = resolversTask.value
// TODO Warn about possible duplicated modules from source repositories?
@ -909,7 +911,7 @@ object Tasks {
forceVersions =
// order matters here
userForceVersions ++
(if (configs("compile") || configs("scala-tool")) forcedScalaModules(so, sv) else Map()) ++
(if (autoScalaLib && (configs("compile") || configs("scala-tool"))) forcedScalaModules(so, sv) else Map()) ++
interProjectDependencies.map(_.moduleVersion),
projectCache = parentProjectCache,
mapDependencies = if (typelevel && (configs("compile") || configs("scala-tool"))) typelevelOrgSwap else None

View File

@ -0,0 +1,20 @@
autoScalaLibrary := false
libraryDependencies += "com.chuusai" % "shapeless_2.12" % "2.3.2"
val checkScalaLibrary = TaskKey[Unit]("checkScalaLibrary")
checkScalaLibrary := {
val scalaLibsJars = managedClasspath
.in(Compile)
.value
.map(_.data.getName)
.filter(_.startsWith("scala-library"))
.sorted
val expectedScalaLibsJars = Seq(
"scala-library-2.12.0.jar"
)
assert(
scalaLibsJars == expectedScalaLibsJars,
s"$scalaLibsJars != $expectedScalaLibsJars"
)
}

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