Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 9 additions & 16 deletions project/SparkBuild.scala
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ object BuildCommons {
) = Seq(
"core", "graphx", "mllib", "mllib-local", "repl", "network-common", "network-shuffle", "launcher", "unsafe",
"tags", "sketch", "kvstore"
).map(ProjectRef(buildLocation, _)) ++ sqlProjects ++ streamingProjects ++ Seq(connect) ++ Seq(protobuf)
).map(ProjectRef(buildLocation, _)) ++ sqlProjects ++ streamingProjects ++ Seq(connect)

val optionallyEnabledProjects@Seq(kubernetes, mesos, yarn,
sparkGangliaLgpl, streamingKinesisAsl,
Expand Down Expand Up @@ -433,7 +433,7 @@ object SparkBuild extends PomBuild {

enable(SparkConnect.settings)(connect)

/* Connector/proto settings */
/* Protobuf settings */
enable(SparkProtobuf.settings)(protobuf)

// SPARK-14738 - Remove docker tests from main Spark build
Expand Down Expand Up @@ -703,32 +703,24 @@ object SparkConnect {
}

object SparkProtobuf {

import BuildCommons.protoVersion

private val shadePrefix = "org.sparkproject.spark-protobuf"
val shadeJar = taskKey[Unit]("Shade the Jars")

lazy val settings = Seq(
// Setting version for the protobuf compiler. This has to be propagated to every sub-project
// even if the project is not using it.
PB.protocVersion := BuildCommons.protoVersion,

// For some reason the resolution from the imported Maven build does not work for some
// of these dependendencies that we need to shade later on.
libraryDependencies ++= Seq(
"com.google.protobuf" % "protobuf-java" % protoVersion % "protobuf"
),
libraryDependencies += "com.google.protobuf" % "protobuf-java" % protoVersion % "protobuf",

dependencyOverrides ++= Seq(
"com.google.protobuf" % "protobuf-java" % protoVersion
),
dependencyOverrides += "com.google.protobuf" % "protobuf-java" % protoVersion,

(Compile / PB.targets) := Seq(
PB.gens.java -> (Compile / sourceManaged).value,
PB.gens.java -> (Compile / sourceManaged).value,
),

(assembly / test) := false,
(assembly / test) := { },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just for my own education, is this the same: false -> { }?

looks like a bit magic

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, they are same. I believe { } is much more common (googled a bit)


(assembly / logLevel) := Level.Info,

Expand All @@ -744,6 +736,7 @@ object SparkProtobuf {
},
)
}

object Unsafe {
lazy val settings = Seq(
// This option is needed to suppress warnings from sun.misc.Unsafe usage
Expand Down Expand Up @@ -1277,7 +1270,7 @@ object CopyDependencies {
// produce the shaded Jar which happens automatically in the case of Maven.
// Later, when the dependencies are copied, we manually copy the shaded Jar only.
val fid = (LocalProject("connect") / assembly).value
val fidProtobuf = (LocalProject("protobuf")/assembly).value
val fidProtobuf = (LocalProject("protobuf") / assembly).value

(Compile / dependencyClasspath).value.map(_.data)
.filter { jar => jar.isFile() }
Expand All @@ -1292,7 +1285,7 @@ object CopyDependencies {
Files.copy(fid.toPath, destJar.toPath)
} else if (jar.getName.contains("spark-protobuf") &&
!SbtPomKeys.profiles.value.contains("noshade-protobuf")) {
Files.copy(fid.toPath, destJar.toPath)
Files.copy(fidProtobuf.toPath, destJar.toPath)
} else {
Files.copy(jar.toPath(), destJar.toPath())
}
Expand Down