Skip to content

Commit 2e2cb9f

Browse files
committed
simplify build files for pipelines module
1 parent 55ad0ab commit 2e2cb9f

File tree

2 files changed

+16
-75
lines changed

2 files changed

+16
-75
lines changed

project/SparkBuild.scala

Lines changed: 16 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -889,52 +889,31 @@ object SparkConnectClient {
889889
object SparkDeclarativePipelines {
890890
import BuildCommons.protoVersion
891891

892+
import BuildCommons.protoVersion
892893
lazy val settings = Seq(
894+
// Setting version for the protobuf compiler. This has to be propagated to every sub-project
895+
// even if the project is not using it.
896+
PB.protocVersion := BuildCommons.protoVersion,
893897
// For some reason the resolution from the imported Maven build does not work for some
894898
// of these dependendencies that we need to shade later on.
895899
libraryDependencies ++= {
896-
val guavaVersion =
897-
SbtPomKeys.effectivePom.value.getProperties.get(
898-
"connect.guava.version").asInstanceOf[String]
899-
val guavaFailureAccessVersion =
900-
SbtPomKeys.effectivePom.value.getProperties.get(
901-
"guava.failureaccess.version").asInstanceOf[String]
902900
Seq(
903-
"com.google.guava" % "guava" % guavaVersion,
904-
"com.google.guava" % "failureaccess" % guavaFailureAccessVersion,
905901
"com.google.protobuf" % "protobuf-java" % protoVersion % "protobuf"
906902
)
907903
},
908-
909-
(assembly / logLevel) := Level.Info,
910-
911-
// Exclude `scala-library` from assembly.
912-
(assembly / assemblyPackageScala / assembleArtifact) := false,
913-
914-
// SPARK-46733: Include `spark-connect-*.jar`, `unused-*.jar`,`guava-*.jar`,
915-
// `failureaccess-*.jar`, `annotations-*.jar`, `grpc-*.jar`, `protobuf-*.jar`,
916-
// `gson-*.jar`, `error_prone_annotations-*.jar`, `j2objc-annotations-*.jar`,
917-
// `animal-sniffer-annotations-*.jar`, `perfmark-api-*.jar`,
918-
// `proto-google-common-protos-*.jar` in assembly.
919-
// This needs to be consistent with the content of `maven-shade-plugin`.
920-
(assembly / assemblyExcludedJars) := {
921-
val cp = (assembly / fullClasspath).value
922-
val validPrefixes = Set("spark-connect", "unused-", "guava-", "failureaccess-",
923-
"annotations-", "grpc-", "protobuf-", "gson", "error_prone_annotations",
924-
"j2objc-annotations", "animal-sniffer-annotations", "perfmark-api",
925-
"proto-google-common-protos")
926-
cp filterNot { v =>
927-
validPrefixes.exists(v.data.getName.startsWith)
928-
}
929-
},
930-
931-
(assembly / assemblyMergeStrategy) := {
932-
case m if m.toLowerCase(Locale.ROOT).endsWith("manifest.mf") => MergeStrategy.discard
933-
// Drop all proto files that are not needed as artifacts of the build.
934-
case m if m.toLowerCase(Locale.ROOT).endsWith(".proto") => MergeStrategy.discard
935-
case _ => MergeStrategy.first
904+
(Compile / PB.targets) := Seq(
905+
PB.gens.java -> (Compile / sourceManaged).value
906+
)
907+
) ++ {
908+
val sparkProtocExecPath = sys.props.get("spark.protoc.executable.path")
909+
if (sparkProtocExecPath.isDefined) {
910+
Seq(
911+
PB.protocExecutable := file(sparkProtocExecPath.get)
912+
)
913+
} else {
914+
Seq.empty
936915
}
937-
)
916+
}
938917
}
939918

940919
object SparkProtobuf {

sql/pipelines/pom.xml

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -126,44 +126,6 @@
126126
<version>1.7.0</version>
127127
<extensions>true</extensions>
128128
</plugin>
129-
<plugin>
130-
<groupId>org.xolstice.maven.plugins</groupId>
131-
<artifactId>protobuf-maven-plugin</artifactId>
132-
<version>0.6.1</version>
133-
<configuration>
134-
<protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}
135-
</protocArtifact>
136-
<protoSourceRoot>src/main/protobuf</protoSourceRoot>
137-
<pluginId>grpc-java</pluginId>
138-
<pluginArtifact>io.grpc:protoc-gen-grpc-java:${io.grpc.version}:exe:${os.detected.classifier}
139-
</pluginArtifact>
140-
</configuration>
141-
<executions>
142-
<execution>
143-
<phase>generate-sources</phase>
144-
<goals>
145-
<goal>compile</goal>
146-
<goal>compile-custom</goal>
147-
<goal>test-compile</goal>
148-
</goals>
149-
</execution>
150-
</executions>
151-
</plugin>
152-
<plugin>
153-
<!-- see http://davidb.github.com/scala-maven-plugin -->
154-
<groupId>net.alchim31.maven</groupId>
155-
<artifactId>scala-maven-plugin</artifactId>
156-
<version>4.9.2</version>
157-
<executions>
158-
<execution>
159-
<goals>
160-
<goal>compile</goal>
161-
<goal>testCompile</goal>
162-
</goals>
163-
</execution>
164-
</executions>
165-
</plugin>
166-
<!-- os-maven-plugin helps resolve ${os.detected.classifier} automatically -->
167129
</plugins>
168130
</build>
169131
</project>

0 commit comments

Comments
 (0)