-
Notifications
You must be signed in to change notification settings - Fork 0
Bugfix/missing sources #123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,37 +20,54 @@ import Dependencies._ | |
| import JacocoSetup._ | ||
| import com.github.sbt.jacoco.JacocoKeys.{jacocoExcludes, jacocoReportSettings} | ||
|
|
||
| import sbt._ | ||
| import sbt.Keys._ | ||
| import sbt.VirtualAxis._ | ||
| import sbt.internal.ProjectMatrix | ||
| import sbtprojectmatrix.ProjectMatrixKeys._ | ||
| import Dependencies._ | ||
|
|
||
| case class SparkVersionAxis(sparkVersion: String) extends sbt.VirtualAxis.WeakAxis { | ||
| val sparkVersionMinor: String = sparkVersion.split("\\.", 3).take(2).mkString(".") | ||
| override val directorySuffix = s"-spark${sparkVersionMinor}" | ||
| override val idSuffix: String = directorySuffix.replaceAll("""\W+""", "_") | ||
|
|
||
| // we have separate directory for Spark 2.4 (potentially other 2.x in the future) | ||
| // and a common one for all Spark 3.x versions | ||
| override val directorySuffix: String = if (sparkVersion.startsWith("2")) s"-spark${sparkVersionMinor}" else "-spark3" | ||
|
|
||
| // must be unique for all Spark 3.x versions in the matrix | ||
| override val idSuffix: String = | ||
|
||
| if (sparkVersion.startsWith("2")) directorySuffix.replaceAll("""\W+""", "_") | ||
| else s"-spark${sparkVersion.replaceAll("""\W+""", "_")}" | ||
| } | ||
|
|
||
|
|
||
| object SparkVersionAxis { | ||
| private def camelCaseToLowerDashCase(origName: String): String = { | ||
| origName | ||
| .replaceAll("([A-Z])", "-$1") | ||
| .toLowerCase() | ||
| } | ||
|
|
||
| implicit class ProjectExtension(val projectMatrix: ProjectMatrix) extends AnyVal { | ||
| implicit class ProjectExtension(val p: ProjectMatrix) extends AnyVal { | ||
|
|
||
| def sparkRow(sparkAxis: SparkVersionAxis, scalaVersions: Seq[String], settings: Def.SettingsDefinition*): ProjectMatrix = { | ||
| val sparkVersion = sparkAxis.sparkVersion | ||
| scalaVersions.foldLeft(projectMatrix)((currentProjectMatrix, scalaVersion) => | ||
| currentProjectMatrix.customRow( | ||
| scalaVersions = Seq(scalaVersion), | ||
| axisValues = Seq(sparkAxis, VirtualAxis.jvm), | ||
| _.settings( | ||
| moduleName := camelCaseToLowerDashCase( | ||
| name.value.replaceAll("(Spark2|Spark3)$", "") + sparkAxis.directorySuffix | ||
| ), | ||
| libraryDependencies ++= sparkCommonsDependencies(sparkAxis.sparkVersion), | ||
| jacocoReportSettings := jacocoSettings(sparkVersion, scalaVersion), | ||
| jacocoExcludes := jacocoProjectExcludes(sparkVersion, scalaVersion) | ||
| ).settings(settings: _*) | ||
| ) | ||
| p.customRow( | ||
| scalaVersions = scalaVersions, | ||
| axisValues = Seq(sparkAxis, VirtualAxis.jvm), | ||
| _.settings( | ||
| // must be defined to avoid conflicting target paths for individual spark versions' builds | ||
| target := (ThisBuild / baseDirectory).value / "target" / s"${camelCaseToLowerDashCase(name.value)}${sparkAxis.sparkVersion}-jvm-${scalaVersion.value.replaceAll("""\W+""", "_")}", | ||
| moduleName := { | ||
| val baseName = camelCaseToLowerDashCase(name.value) | ||
| if (sparkAxis.sparkVersion.startsWith("2")) | ||
| baseName + sparkAxis.directorySuffix | ||
| else | ||
| baseName + s"-spark${sparkAxis.sparkVersionMinor}" | ||
| }, | ||
| libraryDependencies ++= sparkCommonsDependencies(sparkAxis.sparkVersion) | ||
| ).settings(settings: _*) | ||
| ) | ||
| } | ||
|
|
||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is duplicity, it's already here above