sbt-assembly icon indicating copy to clipboard operation
sbt-assembly copied to clipboard

"Keep" rules seem to be processed before renaming, not after

Open szeiger opened this issue 10 years ago • 0 comments

According to the JarJar documentation, "keep" rules are processed after renaming. When I try this in the Scala build via sbt-assembly, the opposite seems to be the case. Using

assemblyShadeRules in assembly := Seq(
  ShadeRule.rename("org.fusesource.**" -> "scala.tools.fusesource_embedded.@1").inAll,
  ShadeRule.rename("jline.**" -> "scala.tools.jline_embedded.@1").inAll,
  ShadeRule.rename("scala.tools.nsc.interpreter.jline.**" -> "scala.tools.nsc.interpreter.jline_embedded.@1").inAll,
  ShadeRule.keep("scala.tools.**").inAll
)

keeps only those classes which were already in scala.tools before processing. I have to add "keep" patterns for the original package names to prevent them from being removed:

assemblyShadeRules in assembly := Seq(
  ShadeRule.rename("org.fusesource.**" -> "scala.tools.fusesource_embedded.@1").inAll,
  ShadeRule.rename("jline.**" -> "scala.tools.jline_embedded.@1").inAll,
  ShadeRule.rename("scala.tools.nsc.interpreter.jline.**" -> "scala.tools.nsc.interpreter.jline_embedded.@1").inAll,
  ShadeRule.keep("scala.tools.**").inAll,
  ShadeRule.keep("org.fusesource.**").inAll,
  ShadeRule.keep("jline.**").inAll
)

szeiger avatar Oct 29 '15 10:10 szeiger