File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
sbt-dotty/src/dotty/tools/sbtplugin Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -234,6 +234,21 @@ object DottyPlugin extends AutoPlugin {
234234 // bootclasspath, and instead have scala-library and dotty-library on the
235235 // compiler classpath. This means that user code could shadow symbols
236236 // from these jars but we can live with that for now.
237+
238+ // sbt crazy scoping rules mean that when we override `classpathOptions`
239+ // below we also override `classpathOptions in console` which is normally
240+ // set in https://github.com/sbt/sbt/blob/b6f02b9b8cd0abb15e3d8856fd76b570deb1bd61/main/src/main/scala/sbt/Defaults.scala#L503,
241+ // this breaks `sbt console` in Scala 2 projects.
242+ // There seems to be no way to avoid stomping over task-scoped settings,
243+ // so we need to manually set `classpathOptions in console` to something sensible,
244+ // ideally this would be "whatever would be set if this plugin was not enabled",
245+ // but I can't find a way to do this, so we default to whatever is set in ThisBuild.
246+ classpathOptions in console := {
247+ if (isDotty.value)
248+ classpathOptions.value // The Dotty REPL doesn't require anything special on its classpath
249+ else
250+ (classpathOptions in console in ThisBuild ).value
251+ },
237252 classpathOptions := {
238253 val old = classpathOptions.value
239254 if (isDotty.value)
You can’t perform that action at this time.
0 commit comments