11import xerial .sbt .Sonatype ._
2+ import sbtassembly .AssemblyPlugin .autoImport ._
23
34lazy val versionNum : String = " 0.5.1"
4- lazy val scala212 = " 2.12.18 "
5- lazy val scala213 = " 2.13.12 "
5+ lazy val scala212 = " 2.12.20 "
6+ lazy val scala213 = " 2.13.16 "
67lazy val supportedScalaVersions = List (scala212, scala213)
78
89lazy val dataflint = project
910 .in(file(" ." ))
1011 .aggregate(
1112 plugin,
13+ pluginspark3,
14+ pluginspark4,
1215 example_3_1_3,
1316 example_3_2_4,
1417 example_3_3_3,
1518 example_3_4_1,
1619 example_3_5_1,
17- example_3_4_1_remote
20+ example_3_4_1_remote,
21+ example_4_0_1
1822 ).settings(
1923 crossScalaVersions := Nil , // Aggregate project version must be Nil, see docs: https://www.scala-sbt.org/1.x/docs/Cross-Build.html
2024 publish / skip := true
2125 )
2226
2327lazy val plugin = (project in file(" plugin" ))
2428 .settings(
25- name := " spark " ,
29+ name := " dataflint-common " ,
2630 organization := " io.dataflint" ,
2731 crossScalaVersions := supportedScalaVersions,
2832 version := (if (git.gitCurrentTags.value.exists(_.startsWith(" v" ))) {
@@ -34,7 +38,76 @@ lazy val plugin = (project in file("plugin"))
3438 libraryDependencies += " org.apache.spark" %% " spark-sql" % " 3.5.1" % " provided" ,
3539 libraryDependencies += " com.amazonaws" % " aws-java-sdk-s3" % " 1.12.470" % " provided" ,
3640 libraryDependencies += " org.apache.iceberg" %% " iceberg-spark-runtime-3.5" % " 1.5.0" % " provided" ,
41+ publishTo := Some (Resolver .file(" local-common" , file(" target/local-repo" ))), // Publish locally only, not to remote repositories
42+ )
43+
44+ lazy val pluginspark3 = (project in file(" pluginspark3" ))
45+ .enablePlugins(AssemblyPlugin )
46+ .settings(
47+ name := " spark" , // Keep the name as "spark" for compatibility with existing versions
48+ organization := " io.dataflint" ,
49+ crossScalaVersions := supportedScalaVersions,
50+ version := (if (git.gitCurrentTags.value.exists(_.startsWith(" v" ))) {
51+ versionNum
52+ } else {
53+ versionNum + " -SNAPSHOT"
54+ }),
55+ libraryDependencies += " org.apache.spark" %% " spark-core" % " 3.5.1" % " provided" ,
56+ libraryDependencies += " org.apache.spark" %% " spark-sql" % " 3.5.1" % " provided" ,
57+ libraryDependencies += " com.amazonaws" % " aws-java-sdk-s3" % " 1.12.470" % " provided" ,
58+ libraryDependencies += " org.apache.iceberg" %% " iceberg-spark-runtime-3.5" % " 1.5.0" % " provided" ,
59+
60+ // Assembly configuration to create fat JAR with common code
61+ assembly / assemblyJarName := s " ${name.value}_ ${scalaBinaryVersion.value}- ${version.value}.jar " ,
62+ assembly / assemblyMergeStrategy := {
63+ case PathList (" META-INF" , " services" , xs @ _* ) => MergeStrategy .concat
64+ case PathList (" META-INF" , xs @ _* ) => MergeStrategy .discard
65+ case " application.conf" => MergeStrategy .concat
66+ case " reference.conf" => MergeStrategy .concat
67+ case _ => MergeStrategy .first
68+ },
69+
70+ // Publish the assembled JAR instead of the regular JAR
71+ Compile / packageBin := assembly.value,
3772 publishTo := sonatypePublishToBundle.value
73+ ).dependsOn(plugin % " compile->compile;test->test" )
74+
75+ lazy val pluginspark4 = (project in file(" pluginspark4" ))
76+ .enablePlugins(AssemblyPlugin )
77+ .settings(
78+ name := " dataflint-spark4" ,
79+ organization := " io.dataflint" ,
80+ scalaVersion := scala213,
81+ crossScalaVersions := List (scala213), // Only Scala 2.13 for Spark 4.x
82+ version := (if (git.gitCurrentTags.value.exists(_.startsWith(" v" ))) {
83+ versionNum
84+ } else {
85+ versionNum + " -SNAPSHOT"
86+ }),
87+ libraryDependencies += " org.apache.spark" %% " spark-core" % " 4.0.1" % " provided" ,
88+ libraryDependencies += " org.apache.spark" %% " spark-sql" % " 4.0.1" % " provided" ,
89+ libraryDependencies += " com.amazonaws" % " aws-java-sdk-s3" % " 1.12.470" % " provided" ,
90+ libraryDependencies += " org.apache.iceberg" %% " iceberg-spark-runtime-3.5" % " 1.5.0" % " provided" ,
91+
92+ // Assembly configuration to create fat JAR with common code
93+ assembly / assemblyJarName := s " ${name.value}_ ${scalaBinaryVersion.value}- ${version.value}.jar " ,
94+ assembly / assemblyMergeStrategy := {
95+ case PathList (" META-INF" , " services" , xs @ _* ) => MergeStrategy .concat
96+ case PathList (" META-INF" , xs @ _* ) => MergeStrategy .discard
97+ case " application.conf" => MergeStrategy .concat
98+ case " reference.conf" => MergeStrategy .concat
99+ case _ => MergeStrategy .first
100+ },
101+
102+ // Publish the assembled JAR instead of the regular JAR
103+ Compile / packageBin := assembly.value,
104+ publishTo := sonatypePublishToBundle.value,
105+
106+ // Include source from plugin directory for self-contained build
107+ Compile / unmanagedSourceDirectories += (plugin / Compile / sourceDirectory).value / " scala" ,
108+
109+ // Include resources from plugin directory for static UI files
110+ Compile / unmanagedResourceDirectories += (plugin / Compile / resourceDirectory).value
38111 )
39112
40113lazy val example_3_1_3 = (project in file(" example_3_1_3" ))
@@ -45,7 +118,7 @@ lazy val example_3_1_3 = (project in file("example_3_1_3"))
45118 libraryDependencies += " org.apache.spark" %% " spark-core" % " 3.1.3" ,
46119 libraryDependencies += " org.apache.spark" %% " spark-sql" % " 3.1.3" ,
47120 publish / skip := true
48- ).dependsOn(plugin )
121+ ).dependsOn(pluginspark3 )
49122
50123lazy val example_3_2_4 = (project in file(" example_3_2_4" ))
51124 .settings(
@@ -56,7 +129,7 @@ lazy val example_3_2_4 = (project in file("example_3_2_4"))
56129 libraryDependencies += " org.apache.spark" %% " spark-sql" % " 3.2.4" ,
57130 libraryDependencies += " com.amazonaws" % " aws-java-sdk-s3" % " 1.12.470" ,
58131 publish / skip := true
59- ).dependsOn(plugin )
132+ ).dependsOn(pluginspark3 )
60133
61134lazy val example_3_3_3 = (project in file(" example_3_3_3" ))
62135 .settings(
@@ -69,7 +142,7 @@ lazy val example_3_3_3 = (project in file("example_3_3_3"))
69142 libraryDependencies += " org.apache.iceberg" %% " iceberg-spark-runtime-3.3" % " 1.5.0" ,
70143 libraryDependencies += " org.scala-lang.modules" %% " scala-collection-compat" % " 2.11.0" ,
71144 publish / skip := true
72- ).dependsOn(plugin )
145+ ).dependsOn(pluginspark3 )
73146
74147lazy val example_3_4_1 = (project in file(" example_3_4_1" ))
75148 .settings(
@@ -81,7 +154,7 @@ lazy val example_3_4_1 = (project in file("example_3_4_1"))
81154 libraryDependencies += " com.amazonaws" % " aws-java-sdk-s3" % " 1.12.470" ,
82155 libraryDependencies += " org.apache.iceberg" %% " iceberg-spark-runtime-3.4" % " 1.5.0" ,
83156 publish / skip := true
84- ).dependsOn(plugin )
157+ ).dependsOn(pluginspark3 )
85158
86159lazy val example_3_5_1 = (project in file(" example_3_5_1" ))
87160 .settings(
@@ -99,7 +172,7 @@ lazy val example_3_5_1 = (project in file("example_3_5_1"))
99172 libraryDependencies += " org.scalatest" %% " scalatest" % " 3.2.17" ,
100173 libraryDependencies += " org.apache.datafusion" % " comet-spark-spark3.5_2.12" % " 0.4.0" ,
101174 publish / skip := true
102- ).dependsOn(plugin )
175+ ).dependsOn(pluginspark3 )
103176
104177lazy val example_3_4_1_remote = (project in file(" example_3_4_1_remote" ))
105178 .settings(
@@ -112,3 +185,14 @@ lazy val example_3_4_1_remote = (project in file("example_3_4_1_remote"))
112185 publish / skip := true
113186 ).dependsOn()
114187
188+ lazy val example_4_0_1 = (project in file(" example_4_0_1" ))
189+ .settings(
190+ name := " DataflintSparkExample401" ,
191+ organization := " io.dataflint" ,
192+ scalaVersion := scala213,
193+ crossScalaVersions := List (scala213), // Only Scala 2.13 for Spark 4.x
194+ // there is no scala 2.12 version so we need to force 2.13 to make it compile
195+ libraryDependencies += " org.apache.spark" % " spark-core_2.13" % " 4.0.1" ,
196+ libraryDependencies += " org.apache.spark" % " spark-sql_2.13" % " 4.0.1" ,
197+ publish / skip := true
198+ ).dependsOn(pluginspark4)
0 commit comments