Skip to content

Commit

Permalink
Apply shaded rules on jars (#724)
Browse files Browse the repository at this point in the history
* Apply shaded rules on jars

Signed-off-by: Louis Chu <[email protected]>

* Add more jars to shaded

Signed-off-by: Louis Chu <[email protected]>

---------

Signed-off-by: Louis Chu <[email protected]>
  • Loading branch information
noCharger authored Oct 2, 2024
1 parent f5db305 commit ab13935
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,33 @@ lazy val compileScalastyle = taskKey[Unit]("compileScalastyle")
// Run as part of test task.
lazy val testScalastyle = taskKey[Unit]("testScalastyle")

// Explanation:
// - ThisBuild / assemblyShadeRules sets the shading rules for the entire build
// - ShadeRule.rename(...) creates a rule to rename multiple package patterns
// - "shaded.@0" means prepend "shaded." to the original package name
// - .inAll applies the rule to all dependencies, not just direct dependencies
val packagesToShade = Seq(
"com.amazonaws.**",
"com.fasterxml.jackson.**",
"com.sun.jna.**",
"com.thoughtworks.paranamer.**",
"javax.annotation.**",
"org.antlr.v4.**",
"org.apache.**",
"org.glassfish.json.**",
"org.joda.time.**",
"org.json4s.**",
"org.reactivestreams.**",
"org.slf4j.**",
"org.yaml.**",
"software.amazon.**"
)

ThisBuild / assemblyShadeRules := Seq(
ShadeRule.rename("com.fasterxml.jackson.**" -> "shaded.com.fasterxml.jackson.@1").inAll)
ShadeRule.rename(
packagesToShade.map(_ -> "shaded.flint.@0"): _*
).inAll
)

lazy val commonSettings = Seq(
javacOptions ++= Seq("-source", "11"),
Expand Down Expand Up @@ -90,7 +115,9 @@ lazy val flintCore = (project in file("flint-core"))
exclude ("com.fasterxml.jackson.core", "jackson-databind"),
"com.amazonaws" % "aws-java-sdk-cloudwatch" % "1.12.593"
exclude("com.fasterxml.jackson.core", "jackson-databind"),
"software.amazon.awssdk" % "auth-crt" % "2.28.10" % "provided",
"software.amazon.awssdk" % "auth-crt" % "2.28.10",
"com.fasterxml.jackson.core" % "jackson-core" % jacksonVersion,
"com.fasterxml.jackson.core" % "jackson-databind" % jacksonVersion,
"org.scalactic" %% "scalactic" % "3.2.15" % "test",
"org.scalatest" %% "scalatest" % "3.2.15" % "test",
"org.scalatest" %% "scalatest-flatspec" % "3.2.15" % "test",
Expand Down

0 comments on commit ab13935

Please sign in to comment.