Skip to content

Commit c9467f2

Browse files
committed
.
1 parent a01ae3e commit c9467f2

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

project/Build.scala

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1200,9 +1200,7 @@ object Build {
12001200
FilesInfo.lastModified, FilesInfo.exists) { _ =>
12011201
s.log.info(s"Downloading and processing shaded sources to $dest...")
12021202

1203-
if (dest.exists) {
1204-
IO.delete(dest)
1205-
}
1203+
if (dest.exists) IO.delete(dest)
12061204
IO.createDirectory(dest)
12071205

12081206
for((org, name, version) <- dependencies) {
@@ -1287,7 +1285,6 @@ object Build {
12871285
"org.jline" % "jline-terminal" % "3.29.0",
12881286
"org.jline" % "jline-terminal-jni" % "3.29.0",
12891287
),
1290-
// Source directories
12911288
Compile / unmanagedSourceDirectories := Seq(baseDirectory.value / "src"),
12921289
// Assembly configuration for shading
12931290
assembly / assemblyJarName := s"scala3-repl-embedded-${version.value}.jar",
@@ -1300,10 +1297,15 @@ object Build {
13001297
assembly / assemblyExcludedJars := {
13011298
(assembly / fullClasspath).value.filter { jar =>
13021299
val name = jar.data.getName
1303-
name.contains("scala-library") || name.contains("scala3-library") || name.contains("jline")
1300+
1301+
name.contains("scala-library") ||
1302+
// Avoid shading JLine because shading it causes problems with
1303+
// its service discovery and JNI-related logic
1304+
// This is the entrypoint to the embedded Scala REPL so don't shade it
1305+
name.contains("jline")
13041306
}
13051307
},
1306-
// Post-process assembly to physically move files into dotty/tools/repl/shaded/ subfolder
1308+
13071309
assembly := {
13081310
val originalJar = assembly.value
13091311
val log = streams.value.log
@@ -1320,22 +1322,14 @@ object Build {
13201322
if (file.isFile) {
13211323
val relativePath = file.relativeTo(tmpDir).get.getPath
13221324

1323-
// Avoid shading JLine because shading it causes problems with
1324-
// its service discovery and JNI-related logic
1325-
val shouldDelete =
1326-
relativePath.startsWith("scala/") &&
1327-
!relativePath.startsWith("scala/tools/") &&
1328-
!relativePath.startsWith("scala/collection/internal/pprint/") ||
1329-
relativePath.startsWith("org/jline/")
1330-
// This is the entrypoint to the embedded Scala REPL so don't shade it
1331-
val shouldKeepInPlace = relativePath.startsWith("scala/tools/repl/")||
1325+
val shouldKeepInPlace =
1326+
relativePath.startsWith("scala/tools/repl/")||
13321327
// These are manually shaded so leave them alone
13331328
relativePath.startsWith("dotty/shaded/") ||
13341329
// This needs to be inside scala/collection so cannot be moved
13351330
relativePath.startsWith("scala/collection/internal/pprint/")
13361331

1337-
if (shouldDelete) IO.delete(file)
1338-
else if (!shouldKeepInPlace) {
1332+
if (!shouldKeepInPlace) {
13391333
val newPath = shadedDir / relativePath
13401334
IO.createDirectory(newPath.getParentFile)
13411335
IO.move(file, newPath)
@@ -1356,7 +1350,6 @@ object Build {
13561350
// Use the shaded assembly jar as our packageBin for publishing
13571351
Compile / packageBin := (Compile / assembly).value,
13581352
publish / skip := false,
1359-
13601353
)
13611354

13621355
// ==============================================================================================

0 commit comments

Comments
 (0)