2020-06-17 00:43:55 +03:00
|
|
|
/*
|
|
|
|
* Copyright (2020) The Hyperspace Project Authors.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2021-04-28 09:14:52 +03:00
|
|
|
import Dependencies._
|
|
|
|
import Path.relativeTo
|
2020-08-05 21:33:02 +03:00
|
|
|
|
2020-06-17 00:43:55 +03:00
|
|
|
lazy val scala212 = "2.12.8"
|
|
|
|
lazy val scala211 = "2.11.12"
|
|
|
|
|
2021-06-08 05:32:31 +03:00
|
|
|
ThisBuild / scalaVersion := scala212
|
2020-06-17 00:43:55 +03:00
|
|
|
|
2021-04-28 09:14:52 +03:00
|
|
|
ThisBuild / scalacOptions ++= Seq("-target:jvm-1.8")
|
2020-06-17 00:43:55 +03:00
|
|
|
|
2021-04-28 09:14:52 +03:00
|
|
|
ThisBuild / javaOptions += "-Xmx1024m"
|
2020-06-17 00:43:55 +03:00
|
|
|
|
2021-04-28 09:14:52 +03:00
|
|
|
// The root project is a virtual project aggregating the other projects.
|
|
|
|
// It cannot compile, as necessary utility code is only in those projects.
|
2021-02-23 09:04:50 +03:00
|
|
|
lazy val root = (project in file("."))
|
2021-05-07 23:15:38 +03:00
|
|
|
.aggregate(spark2_4, spark3_0, spark3_1)
|
2021-04-28 09:14:52 +03:00
|
|
|
.settings(
|
|
|
|
compile / skip := true,
|
|
|
|
publish / skip := true,
|
|
|
|
Keys.`package` := { new File("") }, // skip package
|
|
|
|
Keys.`packageBin` := { new File("") } // skip packageBin
|
|
|
|
)
|
|
|
|
|
|
|
|
lazy val spark2_4 = (project in file("spark2.4"))
|
2021-02-23 09:04:50 +03:00
|
|
|
.enablePlugins(BuildInfoPlugin)
|
|
|
|
.settings(
|
2021-04-28 09:14:52 +03:00
|
|
|
commonSettings,
|
|
|
|
sparkVersion := Version(2, 4, 2),
|
|
|
|
crossScalaVersions := List(scala212, scala211),
|
|
|
|
inConfig(Compile)(addSparkVersionSpecificSourceDirectories),
|
|
|
|
inConfig(Test)(addSparkVersionSpecificSourceDirectories))
|
|
|
|
|
|
|
|
lazy val spark3_0 = (project in file("spark3.0"))
|
|
|
|
.enablePlugins(BuildInfoPlugin)
|
|
|
|
.settings(
|
|
|
|
commonSettings,
|
|
|
|
sparkVersion := Version(3, 0, 1),
|
|
|
|
crossScalaVersions := List(scala212), // Spark 3 doesn't support Scala 2.11
|
2021-05-07 23:15:38 +03:00
|
|
|
inConfig(Compile)(addSparkVersionSpecificSourceDirectories),
|
|
|
|
inConfig(Test)(addSparkVersionSpecificSourceDirectories))
|
|
|
|
|
|
|
|
lazy val spark3_1 = (project in file("spark3.1"))
|
|
|
|
.enablePlugins(BuildInfoPlugin)
|
|
|
|
.settings(
|
|
|
|
commonSettings,
|
|
|
|
sparkVersion := Version(3, 1, 1),
|
|
|
|
crossScalaVersions := List(scala212), // Spark 3 doesn't support Scala 2.11
|
2021-04-28 09:14:52 +03:00
|
|
|
inConfig(Compile)(addSparkVersionSpecificSourceDirectories),
|
|
|
|
inConfig(Test)(addSparkVersionSpecificSourceDirectories))
|
|
|
|
|
|
|
|
lazy val sparkVersion = settingKey[Version]("sparkVersion")
|
|
|
|
|
|
|
|
// In addition to the usual scala/ and scala-<version>/ source directories,
|
|
|
|
// add the following source directories for different Spark versions:
|
|
|
|
// * scala-spark<spark major version>
|
|
|
|
// * scala-spark<spark major version>.<spark minor version>
|
|
|
|
// * scala-<scala version>-spark<spark major version>
|
|
|
|
// * scala-<scala version>-spark<spark major version>.<spark minor version>
|
|
|
|
lazy val addSparkVersionSpecificSourceDirectories = unmanagedSourceDirectories ++= Seq(
|
|
|
|
sourceDirectory.value / s"scala-spark${sparkVersion.value.major}",
|
|
|
|
sourceDirectory.value / s"scala-spark${sparkVersion.value.short}",
|
|
|
|
sourceDirectory.value / s"scala-${scalaBinaryVersion.value}-spark${sparkVersion.value.major}",
|
|
|
|
sourceDirectory.value / s"scala-${scalaBinaryVersion.value}-spark${sparkVersion.value.short}")
|
|
|
|
|
|
|
|
lazy val commonSettings = Seq(
|
|
|
|
// The following creates target/scala-2.*/src_managed/main/sbt-buildinfo/BuildInfo.scala.
|
|
|
|
buildInfoKeys := Seq[BuildInfoKey](
|
|
|
|
version,
|
|
|
|
sparkVersion,
|
|
|
|
"sparkShortVersion" -> sparkVersion.value.short),
|
|
|
|
buildInfoPackage := "com.microsoft.hyperspace",
|
|
|
|
|
|
|
|
name := "hyperspace-core",
|
2021-06-01 21:21:12 +03:00
|
|
|
moduleName := name.value + s"-spark${sparkVersion.value.short}",
|
2021-04-28 09:14:52 +03:00
|
|
|
libraryDependencies ++= deps(sparkVersion.value),
|
|
|
|
|
|
|
|
// Scalastyle
|
|
|
|
scalastyleConfig := (ThisBuild / scalastyleConfig).value,
|
|
|
|
compileScalastyle := (Compile / scalastyle).toTask("").value,
|
|
|
|
Compile / compile := ((Compile / compile) dependsOn compileScalastyle).value,
|
|
|
|
testScalastyle := (Test / scalastyle).toTask("").value,
|
|
|
|
Test / test := ((Test / test) dependsOn testScalastyle).value,
|
|
|
|
|
|
|
|
// Package Python files
|
|
|
|
(Compile / packageBin / mappings) := (Compile / packageBin / mappings).value ++ listPythonFiles.value,
|
|
|
|
listPythonFiles := {
|
|
|
|
val pythonBase = (ThisBuild / baseDirectory).value / "python"
|
|
|
|
pythonBase ** "*.py" pair relativeTo(pythonBase)
|
|
|
|
})
|
|
|
|
|
|
|
|
lazy val listPythonFiles = taskKey[Seq[(File, String)]]("listPythonFiles")
|
2021-02-23 09:04:50 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* ScalaStyle configurations
|
|
|
|
*/
|
2021-04-28 09:14:52 +03:00
|
|
|
ThisBuild / scalastyleConfig := baseDirectory.value / "scalastyle-config.xml"
|
2020-06-20 01:58:18 +03:00
|
|
|
|
|
|
|
// Run as part of compile task.
|
|
|
|
lazy val compileScalastyle = taskKey[Unit]("compileScalastyle")
|
|
|
|
|
|
|
|
// Run as part of test task.
|
|
|
|
lazy val testScalastyle = taskKey[Unit]("testScalastyle")
|
2020-08-05 21:33:02 +03:00
|
|
|
|
2021-02-23 09:04:50 +03:00
|
|
|
/**
|
|
|
|
* Test configurations
|
|
|
|
*/
|
2020-06-17 00:43:55 +03:00
|
|
|
// Tests cannot be run in parallel since mutiple Spark contexts cannot run in the same JVM.
|
2021-04-28 09:14:52 +03:00
|
|
|
ThisBuild / Test / parallelExecution := false
|
2020-06-17 00:43:55 +03:00
|
|
|
|
2021-04-28 09:14:52 +03:00
|
|
|
ThisBuild / Test / fork := true
|
2020-06-17 00:43:55 +03:00
|
|
|
|
2021-04-28 09:14:52 +03:00
|
|
|
ThisBuild / Test / javaOptions += "-Xmx1024m"
|
2020-06-17 00:43:55 +03:00
|
|
|
|
2021-09-01 02:28:01 +03:00
|
|
|
// Needed to test both non-codegen and codegen parts of expressions
|
|
|
|
ThisBuild / Test / envVars += "SPARK_TESTING" -> "1"
|
|
|
|
|
2021-08-10 02:44:10 +03:00
|
|
|
ThisBuild / coverageExcludedPackages := "com\\.fasterxml.*;com\\.microsoft\\.hyperspace\\.shim"
|
|
|
|
|
2021-02-23 09:04:50 +03:00
|
|
|
/**
|
|
|
|
* Release configurations
|
|
|
|
*/
|
2021-04-28 09:14:52 +03:00
|
|
|
ThisBuild / organization := "com.microsoft.hyperspace"
|
|
|
|
ThisBuild / organizationName := "Microsoft"
|
|
|
|
ThisBuild / organizationHomepage := Some(url("http://www.microsoft.com/"))
|
2020-06-19 07:54:26 +03:00
|
|
|
|
2021-04-28 09:14:52 +03:00
|
|
|
ThisBuild / releaseCrossBuild := true
|
2020-06-19 07:54:26 +03:00
|
|
|
|
2021-04-28 09:14:52 +03:00
|
|
|
ThisBuild / scmInfo := Some(
|
2020-06-19 07:54:26 +03:00
|
|
|
ScmInfo(
|
|
|
|
url("https://github.com/microsoft/hyperspace"),
|
2021-02-23 09:04:50 +03:00
|
|
|
"scm:git@github.com:microsoft/hyperspace.git"))
|
2020-06-19 07:54:26 +03:00
|
|
|
|
2021-04-28 09:14:52 +03:00
|
|
|
ThisBuild / developers := List(
|
2020-06-19 07:54:26 +03:00
|
|
|
Developer(
|
2021-02-23 09:04:50 +03:00
|
|
|
id = "rapoth",
|
|
|
|
name = "Rahul Potharaju",
|
2020-06-19 07:54:26 +03:00
|
|
|
email = "",
|
2021-02-23 09:04:50 +03:00
|
|
|
url = url("https://github.com/rapoth")),
|
2020-06-19 07:54:26 +03:00
|
|
|
Developer(
|
2021-02-23 09:04:50 +03:00
|
|
|
id = "imback82",
|
|
|
|
name = "Terry Kim",
|
2020-06-19 07:54:26 +03:00
|
|
|
email = "",
|
2021-02-23 09:04:50 +03:00
|
|
|
url = url("https://github.com/imback82")),
|
2020-06-19 07:54:26 +03:00
|
|
|
Developer(
|
2021-02-23 09:04:50 +03:00
|
|
|
id = "apoorvedave1",
|
|
|
|
name = "Apoorve Dave",
|
2020-06-19 07:54:26 +03:00
|
|
|
email = "",
|
2021-02-23 09:04:50 +03:00
|
|
|
url = url("https://github.com/apoorvedave1")),
|
2020-06-19 07:54:26 +03:00
|
|
|
Developer(
|
2021-02-23 09:04:50 +03:00
|
|
|
id = "AFFogarty",
|
|
|
|
name = "Andrew Fogarty",
|
2020-06-19 07:54:26 +03:00
|
|
|
email = "",
|
2021-02-23 09:04:50 +03:00
|
|
|
url = url("https://github.com/AFFogarty")),
|
2020-06-19 07:54:26 +03:00
|
|
|
Developer(
|
2021-02-23 09:04:50 +03:00
|
|
|
id = "laserljy",
|
|
|
|
name = "Jiying Li",
|
2020-06-19 07:54:26 +03:00
|
|
|
email = "",
|
2021-02-23 09:04:50 +03:00
|
|
|
url = url("https://github.com/laserljy")),
|
2020-06-19 07:54:26 +03:00
|
|
|
Developer(
|
2021-02-23 09:04:50 +03:00
|
|
|
id = "sezruby",
|
|
|
|
name = "Eunjin Song",
|
2020-06-19 07:54:26 +03:00
|
|
|
email = "",
|
2021-02-23 09:04:50 +03:00
|
|
|
url = url("https://github.com/sezruby")),
|
2020-08-06 03:07:36 +03:00
|
|
|
Developer(
|
2021-02-23 09:04:50 +03:00
|
|
|
id = "thugsatbay",
|
|
|
|
name = "Gurleen Singh",
|
2020-08-06 03:07:36 +03:00
|
|
|
email = "",
|
2021-06-01 19:42:13 +03:00
|
|
|
url = url("https://github.com/thugsatbay")),
|
|
|
|
Developer(
|
|
|
|
id = "clee704",
|
|
|
|
name = "Chungmin Lee",
|
|
|
|
email = "",
|
|
|
|
url = url("https://github.com/clee704")))
|
2020-06-19 07:54:26 +03:00
|
|
|
|
2021-04-28 09:14:52 +03:00
|
|
|
ThisBuild / description := "Hyperspace: An Indexing Subsystem for Apache Spark"
|
|
|
|
ThisBuild / licenses := List(
|
|
|
|
"Apache 2" -> new URL("http://www.apache.org/licenses/LICENSE-2.0.txt"))
|
|
|
|
ThisBuild / homepage := Some(url("https://github.com/microsoft/hyperspace"))
|
2020-06-19 07:54:26 +03:00
|
|
|
|
|
|
|
// Remove all additional repository other than Maven Central from POM
|
2021-04-28 09:14:52 +03:00
|
|
|
ThisBuild / pomIncludeRepository := { _ =>
|
2021-02-23 09:04:50 +03:00
|
|
|
false
|
|
|
|
}
|
2021-04-28 09:14:52 +03:00
|
|
|
ThisBuild / publishTo := {
|
2020-06-19 07:54:26 +03:00
|
|
|
val nexus = "https://oss.sonatype.org/"
|
2021-04-28 09:14:52 +03:00
|
|
|
if (isSnapshot.value) {
|
|
|
|
Some("snapshots" at nexus + "content/repositories/snapshots")
|
|
|
|
} else {
|
|
|
|
Some("releases" at nexus + "service/local/staging/deploy/maven2")
|
|
|
|
}
|
2020-06-19 07:54:26 +03:00
|
|
|
}
|
|
|
|
|
2021-04-28 09:14:52 +03:00
|
|
|
ThisBuild / publishMavenStyle := true
|
2020-06-19 07:54:26 +03:00
|
|
|
|
|
|
|
import ReleaseTransformations._
|
|
|
|
|
2021-04-28 09:14:52 +03:00
|
|
|
ThisBuild / releasePublishArtifactsAction := PgpKeys.publishSigned.value
|
2020-06-19 20:20:10 +03:00
|
|
|
|
2021-04-28 09:14:52 +03:00
|
|
|
ThisBuild / releaseProcess := Seq[ReleaseStep](
|
2020-06-19 07:54:26 +03:00
|
|
|
checkSnapshotDependencies,
|
|
|
|
inquireVersions,
|
2020-06-19 20:20:10 +03:00
|
|
|
runClean,
|
2020-06-19 07:54:26 +03:00
|
|
|
runTest,
|
|
|
|
setReleaseVersion,
|
|
|
|
commitReleaseVersion,
|
|
|
|
tagRelease,
|
|
|
|
publishArtifacts,
|
|
|
|
setNextVersion,
|
2021-02-23 09:04:50 +03:00
|
|
|
commitNextVersion)
|
2021-04-28 09:14:52 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Others
|
|
|
|
*/
|
|
|
|
bspEnabled := false
|