Skip to content

Commit

Permalink
Revert "remove hadoop2 specific handling"
Browse files Browse the repository at this point in the history
This reverts commit cde6568.
  • Loading branch information
johnnyaug committed Aug 15, 2023
1 parent cde6568 commit 5147e33
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions clients/spark/build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def generateCoreProject(buildType: BuildType) =
Project(s"${baseName}-client-${buildType.name}", file(s"core"))
.settings(
sharedSettings,
assembly / assemblyShadeRules := shadeRules,
if (buildType.hadoopFlavour == "hadoop2") hadoop2ShadingSettings
else hadoop3ShadingSettings,
s3UploadSettings,
settingsToCompileIn("core", buildType.hadoopFlavour),
semanticdbEnabled := true, // enable SemanticDB
Expand All @@ -37,7 +38,8 @@ def generateCoreProject(buildType: BuildType) =
Compile / PB.targets := Seq(
scalapb.gen() -> (Compile / sourceManaged).value / "scalapb"
),
libraryDependencies ++= getSharedLibraryDependencies(buildType),
libraryDependencies ++= getSharedLibraryDependencies(buildType)
++ getLibraryDependenciesByHadoopFlavour(buildType.hadoopFlavour),
testFrameworks += new TestFramework("org.scalameter.ScalaMeterFramework"),
Test / logBuffered := false,
// Uncomment to get accurate benchmarks with just "sbt test".
Expand Down Expand Up @@ -94,7 +96,6 @@ def getSharedLibraryDependencies(buildType: BuildType): Seq[ModuleID] = {
"org.apache.hadoop" % "hadoop-aws" % buildType.hadoopVersion % "provided",
"org.apache.hadoop" % "hadoop-common" % buildType.hadoopVersion % "provided",
"org.apache.hadoop" % "hadoop-azure" % buildType.hadoopVersion % "provided",
"com.amazonaws" % "aws-java-sdk-bundle" % "1.12.194" % "provided",
"org.json4s" %% "json4s-native" % "3.6.12",
"org.rogach" %% "scallop" % "4.0.3",
"com.azure" % "azure-core" % "1.10.0",
Expand Down Expand Up @@ -123,6 +124,17 @@ def getSharedLibraryDependencies(buildType: BuildType): Seq[ModuleID] = {
)
}

def getLibraryDependenciesByHadoopFlavour(hadoopFlavour: String): Seq[ModuleID] = {
if (hadoopFlavour == "hadoop2") {
// hadoop-aws provides AWS SDK at version >= 1.7.4. So declare this
// version, but ask to use whatever is provided so we do not
// override what it selects.
Seq("com.amazonaws" % "aws-java-sdk-bundle" % "1.12.194")
} else {
Seq("com.amazonaws" % "aws-java-sdk-bundle" % "1.12.194" % "provided")
}
}

def rename(prefix: String) = ShadeRule.rename(prefix -> "io.lakefs.spark.shade.@0")

// We are using the default sbt assembly merge strategy https://github.com/sbt/sbt-assembly#merge-strategy with a change
Expand All @@ -146,7 +158,7 @@ lazy val sharedAssemblyMergeStrategy =
case _ => MergeStrategy.first
}

lazy val shadeRules = Seq(
lazy val sharedShadeRules = Seq(
rename("org.apache.http.**").inAll,
rename("com.google.protobuf.**").inAll,
rename("com.google.common.**")
Expand All @@ -161,6 +173,12 @@ lazy val shadeRules = Seq(
rename("reactor.util.**").inAll
)

lazy val hadoop2ShadeRules = sharedShadeRules ++ Seq(rename("com.amazonaws.**").inAll)
lazy val hadoop3ShadeRules = sharedShadeRules

lazy val hadoop2ShadingSettings = assembly / assemblyShadeRules := hadoop2ShadeRules
lazy val hadoop3ShadingSettings = assembly / assemblyShadeRules := hadoop3ShadeRules

// Upload assembly jars to S3
lazy val s3UploadSettings = Seq(
s3Upload / mappings := Seq(
Expand Down

0 comments on commit 5147e33

Please sign in to comment.