Skip to content

Commit c9b1329

Browse files
retronymadriaanm
authored andcommitted
Avoid unwanted boostrap JARs in the subproject classpaths
I added build configuration to ask SBT to forcible override the Scala version in the subproject to the declared bootstrap version. I did this in response to a warning by SBT the declared `scalaVersion` has been evicted. However, we actually *want* the newer version. To get rid of the warning, we need to exclude all `"org.scala-lang" % "*"` when depending on Scala modules. This cleanly breaks the cycle. Here's a diff of `*/dependencyClasspath` as a result of this patch: https://gist.github.com/retronym/217c76001b1b81798042
1 parent 93e03d4 commit c9b1329

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

build.sbt

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,18 @@
5252

5353
val bootstrapScalaVersion = "2.11.5"
5454

55+
def withoutScalaLang(moduleId: ModuleID): ModuleID = moduleId exclude("org.scala-lang", "*")
56+
5557
// exclusion of the scala-library transitive dependency avoids eviction warnings during `update`.
56-
val scalaParserCombinatorsDep = "org.scala-lang.modules" %% "scala-parser-combinators" % versionNumber("scala-parser-combinators") exclude("org.scala-lang", "scala-library")
57-
val scalaXmlDep = "org.scala-lang.modules" %% "scala-xml" % versionNumber("scala-xml") exclude("org.scala-lang", "scala-library")
58-
val partestDep = "org.scala-lang.modules" %% "scala-partest" % versionNumber("partest") exclude("org.scala-lang", "scala-library")
59-
val partestInterfaceDep = "org.scala-lang.modules" %% "scala-partest-interface" % "0.5.0" exclude("org.scala-lang", "scala-library")
58+
val scalaParserCombinatorsDep = withoutScalaLang("org.scala-lang.modules" %% "scala-parser-combinators" % versionNumber("scala-parser-combinators"))
59+
val scalaXmlDep = withoutScalaLang("org.scala-lang.modules" %% "scala-xml" % versionNumber("scala-xml"))
60+
val partestDep = withoutScalaLang("org.scala-lang.modules" %% "scala-partest" % versionNumber("partest"))
61+
val partestInterfaceDep = withoutScalaLang("org.scala-lang.modules" %% "scala-partest-interface" % "0.5.0")
6062
val junitDep = "junit" % "junit" % "4.11"
6163
val junitIntefaceDep = "com.novocode" % "junit-interface" % "0.11" % "test"
6264
val jlineDep = "jline" % "jline" % versionProps("jline.version")
6365
val antDep = "org.apache.ant" % "ant" % "1.9.4"
64-
val scalacheckDep = "org.scalacheck" %% "scalacheck" % "1.11.4" exclude("org.scala-lang", "scala-library")
66+
val scalacheckDep = withoutScalaLang("org.scalacheck" %% "scalacheck" % "1.11.4")
6567

6668
lazy val commonSettings = clearSourceAndResourceDirectories ++ Seq[Setting[_]](
6769
organization := "org.scala-lang",
@@ -181,10 +183,6 @@ lazy val compiler = configureAsSubproject(project)
181183

182184
lazy val interactive = configureAsSubproject(project)
183185
.settings(disableDocsAndPublishingTasks: _*)
184-
.settings(
185-
scalaVersion := bootstrapScalaVersion,
186-
ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) }
187-
)
188186
.dependsOn(compiler)
189187

190188
lazy val repl = configureAsSubproject(project)
@@ -217,8 +215,6 @@ lazy val partestExtras = configureAsSubproject(Project("partest-extras", file(".
217215
.dependsOn(repl)
218216
.settings(clearSourceAndResourceDirectories: _*)
219217
.settings(
220-
scalaVersion := bootstrapScalaVersion,
221-
ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) },
222218
libraryDependencies += partestDep,
223219
unmanagedSourceDirectories in Compile := List(baseDirectory.value)
224220
)
@@ -228,8 +224,6 @@ lazy val junit = project.in(file("test") / "junit")
228224
.settings(clearSourceAndResourceDirectories: _*)
229225
.settings(commonSettings: _*)
230226
.settings(
231-
scalaVersion := bootstrapScalaVersion,
232-
ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) },
233227
fork in Test := true,
234228
libraryDependencies ++= Seq(junitDep, junitIntefaceDep),
235229
testOptions += Tests.Argument(TestFrameworks.JUnit, "-a", "-v"),
@@ -243,8 +237,6 @@ lazy val partestJavaAgent = (project in file(".") / "src" / "partest-javaagent")
243237
doc := file("!!! NO DOCS !!!"),
244238
publishLocal := {},
245239
publish := {},
246-
scalaVersion := bootstrapScalaVersion,
247-
ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) },
248240
// Setting name to "scala-partest-javaagent" so that the jar file gets that name, which the Runner relies on
249241
name := "scala-partest-javaagent",
250242
// writing jar file to $buildDirectory/pack/lib because that's where it's expected to be found
@@ -263,8 +255,6 @@ lazy val test = project.
263255
settings(commonSettings: _*).
264256
settings(Defaults.itSettings: _*).
265257
settings(
266-
scalaVersion := bootstrapScalaVersion,
267-
ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) },
268258
libraryDependencies ++= Seq(partestDep, scalaXmlDep, partestInterfaceDep, scalacheckDep),
269259
unmanagedBase in Test := baseDirectory.value / "files" / "lib",
270260
unmanagedJars in Test <+= (unmanagedBase) (j => Attributed.blank(j)) map(identity),
@@ -291,8 +281,6 @@ lazy val test = project.
291281
lazy val root = (project in file(".")).
292282
aggregate(library, forkjoin, reflect, compiler, asm, interactive, repl,
293283
scaladoc, scalap, actors, partestExtras, junit).settings(
294-
scalaVersion := bootstrapScalaVersion,
295-
ivyScala := ivyScala.value map { _.copy(overrideScalaVersion = true) },
296284
sources in Compile := Seq.empty,
297285
onLoadMessage := """|*** Welcome to the sbt build definition for Scala! ***
298286
|This build definition has an EXPERIMENTAL status. If you are not

0 commit comments

Comments
 (0)