Skip to content

Commit

Permalink
Apply shaded rules
Browse files Browse the repository at this point in the history
  • Loading branch information
noCharger committed Nov 8, 2024
1 parent 2ac46da commit 635ba4b
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
* SPDX-License-Identifier: Apache-2.0
*/
import Dependencies._
import sbtassembly.AssemblyPlugin.autoImport.ShadeRule

lazy val scala212 = "2.12.14"
lazy val sparkVersion = "3.5.1"
// Spark jackson version. Spark jackson-module-scala strictly check the jackson-databind version should compatible
// Spark jackson version. Spark jackson-module-scala strictly check the jackson-databind version hould compatbile
// https://github.com/FasterXML/jackson-module-scala/blob/2.18/src/main/scala/com/fasterxml/jackson/module/scala/JacksonModule.scala#L59
lazy val jacksonVersion = "2.15.2"

Expand Down Expand Up @@ -43,7 +44,35 @@ 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.cloudwatch.**",
"com.fasterxml.jackson.core.**",
"com.fasterxml.jackson.dataformat.**",
"com.fasterxml.jackson.databind.**",
"com.sun.jna.**",
"com.thoughtworks.paranamer.**",
"javax.annotation.**",
"org.apache.commons.codec.**",
"org.apache.commons.logging.**",
"org.apache.hc.**",
"org.apache.http.**",
"org.glassfish.json.**",
"org.joda.time.**",
"org.reactivestreams.**",
"org.yaml.**",
"software.amazon.**"
)

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

lazy val commonSettings = Seq(
javacOptions ++= Seq("-source", "11"),
Expand Down Expand Up @@ -89,6 +118,9 @@ lazy val flintCore = (project in file("flint-core"))
"com.amazonaws" % "aws-java-sdk-cloudwatch" % "1.12.593"
exclude("com.fasterxml.jackson.core", "jackson-databind"),
"software.amazon.awssdk" % "auth-crt" % "2.28.10",
"com.fasterxml.jackson.core" % "jackson-core" % jacksonVersion,
"com.fasterxml.jackson.core" % "jackson-databind" % jacksonVersion,
"org.projectlombok" % "lombok" % "1.18.30" % "provided",
"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 635ba4b

Please sign in to comment.