Skip to content
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

feat(scio-cosmosdb): feat(azure-cosmosdb): Add support for cosmosdb with Core (SQL) API #4677

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
177 changes: 59 additions & 118 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ val algebraVersion = "2.9.0"
val annoy4sVersion = "0.10.0"
val annoyVersion = "0.2.6"
val breezeVersion = "2.1.0"
val bsonVersion = "4.8.1"
val cosmosVersion = "4.37.1"
val caffeineVersion = "2.9.3"
val cassandraDriverVersion = "3.11.3"
val cassandraVersion = "3.11.13"
Expand Down Expand Up @@ -156,9 +158,7 @@ ThisBuild / tpolecatDevModeOptions ~= { opts =>
opts.filterNot(excludes).union(extras)
}

ThisBuild / doc / tpolecatDevModeOptions ++= Set(
Scalac.docNoJavaCommentOption
)
ThisBuild / doc / tpolecatDevModeOptions ++= Set(Scalac.docNoJavaCommentOption)

ThisBuild / scalafixScalaBinaryVersion := CrossVersion.binaryScalaVersion(scalaVersion.value)
val excludeLint = SettingKey[Set[Def.KeyedInitialize[_]]]("excludeLintKeys")
Expand Down Expand Up @@ -199,9 +199,7 @@ lazy val keepExistingHeader =
HeaderCommentStyle.cStyleBlockComment.copy(commentCreator = new CommentCreator() {
override def apply(text: String, existingText: Option[String]): String =
existingText
.getOrElse(
HeaderCommentStyle.cStyleBlockComment.commentCreator(text)
)
.getOrElse(HeaderCommentStyle.cStyleBlockComment.commentCreator(text))
.trim()
})

Expand All @@ -217,9 +215,7 @@ val commonSettings = Def
inTask(doc)(TpolecatPlugin.projectSettings),
javacOptions ++= Seq("-source", "1.8", "-target", "1.8", "-Xlint:unchecked"),
Compile / doc / javacOptions := Seq("-source", "1.8"),
excludeDependencies ++= Seq(
"org.apache.beam" % "beam-sdks-java-io-kafka"
),
excludeDependencies ++= Seq("org.apache.beam" % "beam-sdks-java-io-kafka"),
resolvers ++= Resolver.sonatypeOssRepos("public"),
Test / javaOptions += "-Dscio.ignoreVersionWarning=true",
Test / testOptions += Tests.Argument("-oD"),
Expand All @@ -240,9 +236,7 @@ val commonSettings = Def
coverageHighlighting := true,
licenses := Seq("Apache 2" -> url("http://www.apache.org/licenses/LICENSE-2.0.txt")),
homepage := Some(url("https://github.com/spotify/scio")),
scmInfo := Some(
ScmInfo(url("https://github.com/spotify/scio"), "scm:git:git@github.com:spotify/scio.git")
),
scmInfo := Some(ScmInfo(url("https://github.com/spotify/scio"), "scm:git:git@github.com:spotify/scio.git")),
developers := List(
Developer(
id = "sinisa_lyh",
Expand Down Expand Up @@ -367,21 +361,15 @@ lazy val macroSettings = Def.settings(
libraryDependencies ++= {
VersionNumber(scalaVersion.value) match {
case v if v.matchesSemVer(SemanticSelector("2.12.x")) =>
Seq(
compilerPlugin(
("org.scalamacros" % "paradise" % scalaMacrosVersion).cross(CrossVersion.full)
)
)
Seq(compilerPlugin(("org.scalamacros" % "paradise" % scalaMacrosVersion).cross(CrossVersion.full)))
case _ => Nil
}
},
// see MacroSettings.scala
scalacOptions += "-Xmacro-settings:cache-implicit-schemas=true"
)

lazy val directRunnerDependencies = Seq(
"org.apache.beam" % "beam-runners-direct-java" % beamVersion % Runtime
)
lazy val directRunnerDependencies = Seq("org.apache.beam" % "beam-runners-direct-java" % beamVersion % Runtime)
lazy val dataflowRunnerDependencies = Seq(
"org.apache.beam" % "beam-runners-google-cloud-dataflow-java" % beamVersion % Runtime
)
Expand All @@ -402,27 +390,28 @@ lazy val flinkRunnerDependencies = Seq(
lazy val beamRunners = settingKey[String]("beam runners")
lazy val beamRunnersEval = settingKey[Seq[ModuleID]]("beam runners")

def beamRunnerSettings: Seq[Setting[_]] = Seq(
beamRunners := "",
beamRunnersEval := {
Option(beamRunners.value)
.filter(_.nonEmpty)
.orElse(sys.props.get("beamRunners"))
.orElse(sys.env.get("BEAM_RUNNERS"))
.map(_.split(","))
.map {
_.flatMap {
case "DirectRunner" => directRunnerDependencies
case "DataflowRunner" => dataflowRunnerDependencies
case "SparkRunner" => sparkRunnerDependencies
case "FlinkRunner" => flinkRunnerDependencies
case _ => Nil
}.toSeq
}
.getOrElse(directRunnerDependencies)
},
libraryDependencies ++= beamRunnersEval.value
)
def beamRunnerSettings: Seq[Setting[_]] =
Seq(
beamRunners := "",
beamRunnersEval := {
Option(beamRunners.value)
.filter(_.nonEmpty)
.orElse(sys.props.get("beamRunners"))
.orElse(sys.env.get("BEAM_RUNNERS"))
.map(_.split(","))
.map {
_.flatMap {
case "DirectRunner" => directRunnerDependencies
case "DataflowRunner" => dataflowRunnerDependencies
case "SparkRunner" => sparkRunnerDependencies
case "FlinkRunner" => flinkRunnerDependencies
case _ => Nil
}.toSeq
}
.getOrElse(directRunnerDependencies)
},
libraryDependencies ++= beamRunnersEval.value
)

ThisBuild / PB.protocVersion := protobufVersion
lazy val scopedProtobufSettings = Def.settings(
Expand Down Expand Up @@ -454,15 +443,12 @@ def splitTests(tests: Seq[TestDefinition], filter: Seq[String], forkOptions: For

lazy val root: Project = Project("scio", file("."))
.settings(commonSettings)
.settings(
publish / skip := true,
mimaPreviousArtifacts := Set.empty,
assembly / aggregate := false
)
.settings(publish / skip := true, mimaPreviousArtifacts := Set.empty, assembly / aggregate := false)
.aggregate(
`scio-avro`,
`scio-cassandra3`,
`scio-core`,
`scio-cosmosdb`,
`scio-elasticsearch6`,
`scio-elasticsearch7`,
`scio-elasticsearch8`,
Expand Down Expand Up @@ -548,6 +534,15 @@ lazy val `scio-core`: Project = project
buildInfoPackage := "com.spotify.scio"
)

lazy val `scio-cosmosdb`: Project = project
.in(file("scio-cosmosdb"))
.settings(commonSettings)
.settings(publishSettings)
.dependsOn(`scio-core`, `scio-test` % "test;it")
.settings(
libraryDependencies ++= Seq("org.mongodb" % "bson" % bsonVersion, "com.azure" % "azure-cosmos" % cosmosVersion)
)

lazy val `scio-test`: Project = project
.in(file("scio-test"))
.settings(commonSettings)
Expand Down Expand Up @@ -597,10 +592,7 @@ lazy val `scio-test`: Project = project
)
)
.configs(IntegrationTest)
.dependsOn(
`scio-core` % "test->test;compile->compile;it->it",
`scio-avro` % "compile->test;it->it"
)
.dependsOn(`scio-core` % "test->test;compile->compile;it->it", `scio-avro` % "compile->test;it->it")

lazy val `scio-macros`: Project = project
.in(file("scio-macros"))
Expand All @@ -621,9 +613,7 @@ lazy val `scio-macros`: Project = project

lazy val `scio-avro`: Project = project
.in(file("scio-avro"))
.dependsOn(
`scio-core` % "compile;it->it"
)
.dependsOn(`scio-core` % "compile;it->it")
.configs(IntegrationTest)
.settings(commonSettings)
.settings(publishSettings)
Expand Down Expand Up @@ -658,11 +648,7 @@ lazy val `scio-avro`: Project = project

lazy val `scio-google-cloud-platform`: Project = project
.in(file("scio-google-cloud-platform"))
.dependsOn(
`scio-core` % "compile;it->it",
`scio-avro` % "test",
`scio-test` % "test;it"
)
.dependsOn(`scio-core` % "compile;it->it", `scio-avro` % "test", `scio-test` % "test;it")
.configs(IntegrationTest)
.settings(commonSettings)
.settings(publishSettings)
Expand Down Expand Up @@ -721,10 +707,7 @@ lazy val `scio-google-cloud-platform`: Project = project

lazy val `scio-cassandra3`: Project = project
.in(file("scio-cassandra/cassandra3"))
.dependsOn(
`scio-core`,
`scio-test` % "test;it"
)
.dependsOn(`scio-core`, `scio-test` % "test;it")
.configs(IntegrationTest)
.settings(commonSettings)
.settings(publishSettings)
Expand Down Expand Up @@ -755,10 +738,7 @@ lazy val `scio-cassandra3`: Project = project

lazy val `scio-elasticsearch6`: Project = project
.in(file("scio-elasticsearch/es6"))
.dependsOn(
`scio-core`,
`scio-test` % "test"
)
.dependsOn(`scio-core`, `scio-test` % "test")
.settings(commonSettings)
.settings(publishSettings)
.settings(
Expand Down Expand Up @@ -800,17 +780,11 @@ lazy val `scio-elasticsearch7`: Project = project
"org.scalatest" %% "scalatest" % scalatestVersion % Test
)
)
.dependsOn(
`scio-core`,
`scio-test` % "test"
)
.dependsOn(`scio-core`, `scio-test` % "test")

lazy val `scio-elasticsearch8`: Project = project
.in(file("scio-elasticsearch/es8"))
.dependsOn(
`scio-core`,
`scio-test` % "test,it"
)
.dependsOn(`scio-core`, `scio-test` % "test,it")
.configs(IntegrationTest)
.settings(commonSettings)
.settings(publishSettings)
Expand Down Expand Up @@ -893,10 +867,7 @@ lazy val `scio-extra`: Project = project

lazy val `scio-grpc`: Project = project
.in(file("scio-grpc"))
.dependsOn(
`scio-core`,
`scio-test` % "test"
)
.dependsOn(`scio-core`, `scio-test` % "test")
.settings(commonSettings)
.settings(publishSettings)
.settings(protobufSettings)
Expand All @@ -913,10 +884,7 @@ lazy val `scio-grpc`: Project = project

lazy val `scio-jdbc`: Project = project
.in(file("scio-jdbc"))
.dependsOn(
`scio-core`,
`scio-test` % "test"
)
.dependsOn(`scio-core`, `scio-test` % "test")
.settings(commonSettings)
.settings(publishSettings)
.settings(
Expand All @@ -930,10 +898,7 @@ lazy val `scio-jdbc`: Project = project

lazy val `scio-neo4j`: Project = project
.in(file("scio-neo4j"))
.dependsOn(
`scio-core`,
`scio-test` % "test,it"
)
.dependsOn(`scio-core`, `scio-test` % "test,it")
.configs(IntegrationTest)
.settings(commonSettings)
.settings(itSettings)
Expand All @@ -956,11 +921,7 @@ val ensureSourceManaged = taskKey[Unit]("ensureSourceManaged")

lazy val `scio-parquet`: Project = project
.in(file("scio-parquet"))
.dependsOn(
`scio-core`,
`scio-avro`,
`scio-test` % "test->test"
)
.dependsOn(`scio-core`, `scio-avro`, `scio-test` % "test->test")
.settings(commonSettings)
.settings(publishSettings)
.settings(
Expand Down Expand Up @@ -1005,11 +966,7 @@ lazy val `scio-parquet`: Project = project

lazy val `scio-tensorflow`: Project = project
.in(file("scio-tensorflow"))
.dependsOn(
`scio-avro`,
`scio-core`,
`scio-test` % "test->test"
)
.dependsOn(`scio-avro`, `scio-core`, `scio-test` % "test->test")
.settings(commonSettings)
.settings(publishSettings)
.settings(itSettings)
Expand Down Expand Up @@ -1064,10 +1021,7 @@ lazy val `scio-examples`: Project = project
.settings(
publish / skip := true,
mimaPreviousArtifacts := Set.empty,
tpolecatExcludeOptions ++= Set(
ScalacOptions.warnUnusedLocals,
ScalacOptions.privateWarnUnusedLocals
),
tpolecatExcludeOptions ++= Set(ScalacOptions.warnUnusedLocals, ScalacOptions.privateWarnUnusedLocals),
libraryDependencies ++= Seq(
// compile
"com.chuusai" %% "shapeless" % shapelessVersion,
Expand Down Expand Up @@ -1131,11 +1085,7 @@ lazy val `scio-examples`: Project = project

lazy val `scio-repl`: Project = project
.in(file("scio-repl"))
.dependsOn(
`scio-core`,
`scio-google-cloud-platform`,
`scio-extra`
)
.dependsOn(`scio-core`, `scio-google-cloud-platform`, `scio-extra`)
.settings(commonSettings)
.settings(publishSettings)
.settings(assemblySettings)
Expand Down Expand Up @@ -1185,10 +1135,7 @@ lazy val `scio-repl`: Project = project
lazy val `scio-jmh`: Project = project
.in(file("scio-jmh"))
.enablePlugins(JmhPlugin)
.dependsOn(
`scio-core`,
`scio-avro`
)
.dependsOn(`scio-core`, `scio-avro`)
.settings(commonSettings)
.settings(macroSettings)
.settings(
Expand All @@ -1209,11 +1156,7 @@ lazy val `scio-jmh`: Project = project

lazy val `scio-smb`: Project = project
.in(file("scio-smb"))
.dependsOn(
`scio-core`,
`scio-test` % "test;it",
`scio-avro` % IntegrationTest
)
.dependsOn(`scio-core`, `scio-test` % "test;it", `scio-avro` % IntegrationTest)
.configs(IntegrationTest)
.settings(commonSettings)
.settings(publishSettings)
Expand Down Expand Up @@ -1273,10 +1216,7 @@ lazy val `scio-smb`: Project = project

lazy val `scio-redis`: Project = project
.in(file("scio-redis"))
.dependsOn(
`scio-core`,
`scio-test` % "test"
)
.dependsOn(`scio-core`, `scio-test` % "test")
.settings(commonSettings)
.settings(publishSettings)
.settings(itSettings)
Expand Down Expand Up @@ -1359,6 +1299,7 @@ lazy val siteSettings = Def.settings(
`scio-avro`,
`scio-google-cloud-platform`,
`scio-cassandra3`,
`scio-cosmosdb`,
`scio-elasticsearch8`,
`scio-extra`,
`scio-jdbc`,
Expand Down
Loading