Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scala library exclusion doesn't work with Scala 3 #544

Open
sangamon opened this issue Nov 26, 2024 · 0 comments
Open

Scala library exclusion doesn't work with Scala 3 #544

sangamon opened this issue Nov 26, 2024 · 0 comments

Comments

@sangamon
Copy link

It looks like neither assembleArtifact := false nor _.withIncludeScala(false) have any effect in Scala 3 projects.

To reproduce, I created a Scala 3 project from scratch via sbt new scala/scala3.g8. (Currently, this yields scala3Version = "3.5.2" and sbt.version=1.10.5.) I create a project/plugins.sbt:

addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "2.3.0")

Adding either

assemblyPackageScala / assembleArtifact := false,

or

assembly / assemblyOption ~= {
      _.withIncludeScala(false)
    },

to the project settings, as described in the docs, doesn't seem to have any effect:

$ sbt clean assembly && jar tfv target/scala-3.5.2/sbtass-assembly-0.1.0-SNAPSHOT.jar | grep 'scala/' | head
[info] welcome to sbt 1.10.5 (Eclipse Adoptium Java 21.0.1)
[...]
[info] Built: [...]/target/scala-3.5.2/sbtass-assembly-0.1.0-SNAPSHOT.jar
[...]
     0 Fri Jan 01 00:00:00 CET 2010 scala/
  1227 Fri Jan 01 00:00:00 CET 2010 scala/$times$colon$.class
  1380 Fri Jan 01 00:00:00 CET 2010 scala/$times$colon.class
  1512 Fri Jan 01 00:00:00 CET 2010 scala/$times$colon.tasty
  3679 Fri Jan 01 00:00:00 CET 2010 scala/CanEqual$.class
  [...]

Explicitly filtering files whose path starts with "scala" works, though, so assembly config options seem to be picked up:

assembly / assemblyMergeStrategy := {
  case PathList(ps @ _*) if ps.headOption == Some("scala") => MergeStrategy.discard
  case x =>
    val oldStrategy = (ThisBuild / assemblyMergeStrategy).value
    oldStrategy(x)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant