Skip to content

Commit a4a940e

Browse files
Stop shading stuff in sbt-bloop plugins (#1754)
They mainly depend on bloop-config and jsoniter-scala, which should be stable enough.
1 parent c1fd321 commit a4a940e

File tree

14 files changed

+28
-205
lines changed

14 files changed

+28
-205
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
"gradleBloop211/compile" \
4343
"gradleBloop212/compile" \
4444
"gradleBloop212/test" \
45-
"sbtBloop10Shaded/publishLocal" \
45+
"sbtBloop10/publishLocal" \
4646
"sbtBloop10/scripted"
4747
shell: bash
4848
bridges:

benchmark-bridge

build.sbt

Lines changed: 2 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -583,121 +583,13 @@ def isJdiJar(file: File): Boolean = {
583583
else file.getAbsolutePath.contains(SbtJdiTools.JavaTools.getAbsolutePath.toString)
584584
}
585585

586-
def shadeSbtSettingsForModule(
587-
moduleId: String,
588-
module: Reference
589-
) = {
590-
List(
591-
(Compile / packageBin) := {
592-
Def.taskDyn {
593-
val baseJar = (module / Compile / Keys.packageBin).value
594-
val unshadedJarDependencies =
595-
(module / Compile / internalDependencyAsJars).value.map(_.data)
596-
shadingPackageBin(baseJar, unshadedJarDependencies)
597-
}.value
598-
},
599-
shadeOwnNamespaces := Set("bloop"),
600-
shadeIgnoredNamespaces := Set("com.google.gson", "scala"),
601-
toShadeJars := {
602-
val eclipseJarsUnsignedDir = (Keys.crossTarget.value / "eclipse-jars-unsigned").toPath
603-
java.nio.file.Files.createDirectories(eclipseJarsUnsignedDir)
604-
605-
val dependencyJars = (module / Runtime / dependencyClasspath).value.map(_.data)
606-
dependencyJars.flatMap { path =>
607-
val ppath = path.toString
608-
val isEclipseJar = ppath.contains("eclipse")
609-
val shouldShadeJar = !(
610-
ppath.contains("scala-compiler") ||
611-
ppath.contains("scala-library") ||
612-
ppath.contains("scala-reflect") ||
613-
ppath.contains("scala-xml") ||
614-
ppath.contains("macro-compat") ||
615-
ppath.contains("scalamacros") ||
616-
ppath.contains("jsr") ||
617-
ppath.contains("bcprov-jdk15on") ||
618-
ppath.contains("bcpkix-jdk15on") ||
619-
ppath.contains("jna") ||
620-
ppath.contains("jna-platform") ||
621-
isJdiJar(path)
622-
) && path.exists && !path.isDirectory
623-
624-
if (!shouldShadeJar) Nil
625-
else if (!isEclipseJar) List(path)
626-
else {
627-
val targetJar = eclipseJarsUnsignedDir.resolve(path.getName)
628-
build.Shading.deleteSignedJarMetadata(path.toPath, targetJar)
629-
List(targetJar.toFile)
630-
}
631-
}
632-
},
633-
shadeNamespaces := Set(
634-
"machinist",
635-
"shapeless",
636-
"cats",
637-
"jawn",
638-
"org.typelevel.jawn",
639-
"io.circe",
640-
"com.github.plokhotnyuk.jsoniter_scala",
641-
"snailgun",
642-
"org.zeroturnaround",
643-
"io.github.soc",
644-
"org.slf4j",
645-
"scopt",
646-
"macrocompat",
647-
"coursierapi",
648-
"shapeless",
649-
"argonaut",
650-
"org.checkerframework",
651-
"com.google.guava",
652-
"com.google.common",
653-
"com.google.j2objc",
654-
"com.google.thirdparty",
655-
"com.google.errorprone",
656-
"org.codehaus",
657-
"ch.epfl.scala.bsp4j",
658-
"org.eclipse",
659-
"io.github.alexarchambault.windowsansi",
660-
"org.fusesource.hawtjni",
661-
"org.fusesource.jansi",
662-
"concurrentrefhashmap"
663-
)
664-
)
665-
}
666-
667-
def defineShadedSbtPlugin(
668-
projectName: String,
669-
sbtVersion: String,
670-
sbtBloop: Reference
671-
) = {
672-
sbt
673-
.Project(projectName, integrations / "sbt-bloop" / "target" / s"sbt-bloop-shaded-$sbtVersion")
674-
.enablePlugins(BloopShadingPlugin)
675-
.disablePlugins(ScriptedPlugin)
676-
.disablePlugins(SbtJdiTools)
677-
.settings(sbtPluginSettings("sbt-bloop", sbtVersion))
678-
.settings(shadedModuleSettings)
679-
.settings(shadeSbtSettingsForModule("sbt-bloop-core", sbtBloop))
680-
.settings(
681-
(run / fork) := true,
682-
(Test / fork) := true,
683-
(Compile / bloopGenerate) := None,
684-
(Test / bloopGenerate) := None,
685-
target := (file("integrations") / "sbt-bloop-shaded" / "target" / sbtVersion).getAbsoluteFile
686-
)
687-
}
688-
689586
lazy val sbtBloop10: Project = project
690587
.dependsOn(jsonConfig212.jvm)
691588
.enablePlugins(ScriptedPlugin)
692589
.disablePlugins(ScalafixPlugin)
693590
.in(integrations / "sbt-bloop")
694591
.settings(BuildDefaults.scriptedSettings)
695-
.settings(sbtPluginSettings("sbt-bloop-core", Sbt1Version))
696-
697-
lazy val sbtBloop10Shaded: Project =
698-
defineShadedSbtPlugin("sbtBloop10Shaded", Sbt1Version, sbtBloop10).settings(
699-
scalaVersion := (sbtBloop10 / scalaVersion).value
700-
)
592+
.settings(sbtPluginSettings("sbt-bloop", Sbt1Version))
701593

702594
lazy val sbtBloop013 = project
703595
.dependsOn(jsonConfig210.jvm)
@@ -706,14 +598,9 @@ lazy val sbtBloop013 = project
706598
.disablePlugins(ScalafixPlugin)
707599
.in(integrations / "sbt-bloop")
708600
.settings(scalaVersion := Scala210Version)
709-
.settings(sbtPluginSettings("sbt-bloop-core", Sbt013Version))
601+
.settings(sbtPluginSettings("sbt-bloop", Sbt013Version))
710602
.settings(resolvers += Resolver.typesafeIvyRepo("releases"))
711603

712-
lazy val sbtBloop013Shaded =
713-
defineShadedSbtPlugin("sbtBloop013Shaded", Sbt013Version, sbtBloop013).settings(
714-
scalaVersion := (sbtBloop013 / scalaVersion).value
715-
)
716-
717604
lazy val mavenBloop = project
718605
.in(integrations / "maven-bloop")
719606
.disablePlugins(ScriptedPlugin)
@@ -940,8 +827,6 @@ val allProjectsToRelease = Seq[ProjectReference](
940827
jsonConfig213.jvm,
941828
sbtBloop013,
942829
sbtBloop10,
943-
sbtBloop013Shaded,
944-
sbtBloop10Shaded,
945830
mavenBloop,
946831
gradleBloop211,
947832
gradleBloop212,

frontend/src/test/resources/compiler-plugin-allowlist/project/plugins.sbt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ addSbtPlugin("org.wartremover" % "sbt-wartremover" % "2.3.7")
44
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.9.1")
55
addSbtPlugin("com.softwaremill.clippy" % "plugin-sbt" % "0.5.3")
66

7-
addSbtPlugin("ch.epfl.scala" % "sbt-bloop-build-shaded" % "1.0.0-SNAPSHOT")
7+
addSbtPlugin("ch.epfl.scala" % "sbt-bloop-build" % "1.0.0-SNAPSHOT")
88
updateOptions := updateOptions.value.withLatestSnapshots(false)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.0.0")
22
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.3")
33

4-
addSbtPlugin("ch.epfl.scala" % "sbt-bloop-build-shaded" % "1.0.0-SNAPSHOT")
4+
addSbtPlugin("ch.epfl.scala" % "sbt-bloop-build" % "1.0.0-SNAPSHOT")
55
updateOptions := updateOptions.value.withLatestSnapshots(false)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.1")
22
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.26")
33

4-
addSbtPlugin("ch.epfl.scala" % "sbt-bloop-build-shaded" % "1.0.0-SNAPSHOT")
4+
addSbtPlugin("ch.epfl.scala" % "sbt-bloop-build" % "1.0.0-SNAPSHOT")
55
updateOptions := updateOptions.value.withLatestSnapshots(false)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.1")
22
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.0.1")
33

4-
addSbtPlugin("ch.epfl.scala" % "sbt-bloop-build-shaded" % "1.0.0-SNAPSHOT")
4+
addSbtPlugin("ch.epfl.scala" % "sbt-bloop-build" % "1.0.0-SNAPSHOT")
55
updateOptions := updateOptions.value.withLatestSnapshots(false)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.0.0")
22
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.3.1")
33

4-
addSbtPlugin("ch.epfl.scala" % "sbt-bloop-build-shaded" % "1.0.0-SNAPSHOT")
4+
addSbtPlugin("ch.epfl.scala" % "sbt-bloop-build" % "1.0.0-SNAPSHOT")
55
updateOptions := updateOptions.value.withLatestSnapshots(false)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
addSbtPlugin("ch.epfl.scala" % "sbt-bloop-build-shaded" % "1.0.0-SNAPSHOT")
1+
addSbtPlugin("ch.epfl.scala" % "sbt-bloop-build" % "1.0.0-SNAPSHOT")
22
updateOptions := updateOptions.value.withLatestSnapshots(false)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
addSbtPlugin("ch.epfl.scala" % "sbt-bloop-build-shaded" % "1.0.0-SNAPSHOT")
1+
addSbtPlugin("ch.epfl.scala" % "sbt-bloop-build" % "1.0.0-SNAPSHOT")
22
updateOptions := updateOptions.value.withLatestSnapshots(false)

0 commit comments

Comments
 (0)