Skip to content

Commit cc61ffa

Browse files
committed
chore: drop shadding of repl dependencies
1 parent c05242b commit cc61ffa

File tree

4 files changed

+10
-147
lines changed

4 files changed

+10
-147
lines changed

project/Build.scala

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -727,8 +727,6 @@ object Build {
727727
("io.get-coursier" %% "coursier" % "2.0.16" % Test).cross(CrossVersion.for3Use2_13),
728728
),
729729

730-
(Compile / sourceGenerators) += ShadedSourceGenerator.task.taskValue,
731-
732730
// For convenience, change the baseDirectory when running the compiler
733731
Compile / forkOptions := (Compile / forkOptions).value.withWorkingDirectory((ThisBuild / baseDirectory).value),
734732
Compile / run / forkOptions := (Compile / run / forkOptions).value.withWorkingDirectory((ThisBuild / baseDirectory).value),
@@ -1799,6 +1797,12 @@ object Build {
17991797
Test / publishArtifact := false,
18001798
publish / skip := false,
18011799
libraryDependencies ++= Seq(
1800+
"org.jline" % "jline-reader" % "3.29.0",
1801+
"org.jline" % "jline-terminal" % "3.29.0",
1802+
"org.jline" % "jline-terminal-jni" % "3.29.0",
1803+
"com.lihaoyi" %% "pprint" % "0.9.3",
1804+
"com.lihaoyi" %% "fansi" % "0.5.1",
1805+
"com.lihaoyi" %% "sourcecode" % "0.4.4",
18021806
"com.github.sbt" % "junit-interface" % "0.13.3" % Test,
18031807
),
18041808
// Configure to use the non-bootstrapped compiler
@@ -2416,9 +2420,6 @@ object Build {
24162420
"com.github.sbt" % "junit-interface" % "0.13.3" % Test,
24172421
"org.scala-lang.modules" % "scala-asm" % "9.8.0-scala-1",
24182422
Dependencies.compilerInterface,
2419-
"org.jline" % "jline-reader" % "3.29.0",
2420-
"org.jline" % "jline-terminal" % "3.29.0",
2421-
"org.jline" % "jline-terminal-jni" % "3.29.0",
24222423
("io.get-coursier" %% "coursier" % "2.0.16" % Test).cross(CrossVersion.for3Use2_13),
24232424
),
24242425
// NOTE: The only difference here is that we drop `-Werror` and semanticDB for now
@@ -2462,7 +2463,6 @@ object Build {
24622463

24632464
Seq(file)
24642465
}.taskValue,
2465-
(Compile / sourceGenerators) += ShadedSourceGenerator.task.taskValue,
24662466
// sbt adds all the projects to scala-tool config which breaks building the scalaInstance
24672467
// as a workaround, I build it manually by only adding the compiler
24682468
managedScalaInstance := false,
@@ -2589,9 +2589,6 @@ object Build {
25892589
libraryDependencies ++= Seq(
25902590
"org.scala-lang.modules" % "scala-asm" % "9.8.0-scala-1",
25912591
Dependencies.compilerInterface,
2592-
"org.jline" % "jline-reader" % "3.29.0",
2593-
"org.jline" % "jline-terminal" % "3.29.0",
2594-
"org.jline" % "jline-terminal-jni" % "3.29.0",
25952592
"com.github.sbt" % "junit-interface" % "0.13.3" % Test,
25962593
("io.get-coursier" %% "coursier" % "2.0.16" % Test).cross(CrossVersion.for3Use2_13),
25972594
),
@@ -2704,7 +2701,6 @@ object Build {
27042701
sjsSources
27052702
} (Set(scalaJSIRSourcesJar)).toSeq
27062703
}.taskValue,
2707-
(Compile / sourceGenerators) += ShadedSourceGenerator.task.taskValue,
27082704
Compile / run / forkOptions := (Compile / run / forkOptions).value
27092705
.withWorkingDirectory((ThisBuild / baseDirectory).value),
27102706
// Configuration of the test suite

project/ShadedSourceGenerator.scala

Lines changed: 0 additions & 110 deletions
This file was deleted.

repl/src/dotty/tools/repl/Rendering.scala

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -27,32 +27,9 @@ private[repl] class Rendering(parentClassLoader: Option[ClassLoader] = None):
2727
var myClassLoader: AbstractFileClassLoader = uninitialized
2828

2929
private def pprintRender(value: Any, width: Int, height: Int, initialOffset: Int)(using Context): String = {
30-
def fallback() =
31-
dotty.shaded.pprint.PPrinter.BlackWhite
32-
.apply(value, width = width, height = height, initialOffset = initialOffset)
33-
.plainText
34-
try
35-
val cl = classLoader()
36-
val pprintCls = Class.forName("dotty.shaded.pprint.PPrinter$BlackWhite$", false, cl)
37-
val fansiStrCls = Class.forName("dotty.shaded.fansi.Str", false, cl)
38-
val BlackWhite = pprintCls.getField("MODULE$").get(null)
39-
val BlackWhite_apply = pprintCls.getMethod("apply",
40-
classOf[Any], // value
41-
classOf[Int], // width
42-
classOf[Int], // height
43-
classOf[Int], // indentation
44-
classOf[Int], // initialOffset
45-
classOf[Boolean], // escape Unicode
46-
classOf[Boolean], // show field names
47-
)
48-
val FansiStr_plainText = fansiStrCls.getMethod("plainText")
49-
val fansiStr = BlackWhite_apply.invoke(
50-
BlackWhite, value, width, height, 2, initialOffset, false, true
51-
)
52-
FansiStr_plainText.invoke(fansiStr).asInstanceOf[String]
53-
catch
54-
case _: ClassNotFoundException => fallback()
55-
case _: NoSuchMethodException => fallback()
30+
pprint.PPrinter.BlackWhite
31+
.apply(value, width = width, height = height, initialOffset = initialOffset)
32+
.plainText
5633
}
5734

5835

repl/src/dotty/tools/repl/ReplDriver.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,4 +682,4 @@ class ReplDriver(settings: Array[String],
682682

683683
end ReplDriver
684684
object ReplDriver:
685-
def pprintImport = "import dotty.shaded.pprint.pprintln\n"
685+
def pprintImport = "import pprint.pprintln\n"

0 commit comments

Comments
 (0)