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

Migrate from sbt-protobuf to sbt-protoc #4483

Merged
merged 4 commits into from
Aug 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
60 changes: 20 additions & 40 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -413,14 +413,26 @@ def beamRunnerSettings: Seq[Setting[_]] = Seq(
libraryDependencies ++= beamRunnersEval.value
)

lazy val protobufSettings = Def.settings(
ProtobufConfig / version := protobufVersion,
ProtobufConfig / protobufRunProtoc := (args =>
com.github.os72.protocjar.Protoc.runProtoc("-v3.17.3" +: args.toArray)
ThisBuild / PB.protocVersion := protobufVersion
lazy val scopedProtobufSettings = Def.settings(
PB.targets := Seq(
PB.gens.java -> (ThisScope.copy(config = Zero) / sourceManaged).value /
"compiled_proto" /
configuration.value.name,
PB.gens.plugin("grpc-java") -> (ThisScope.copy(config = Zero) / sourceManaged).value /
"compiled_grpc" /
configuration.value.name
),
libraryDependencies += "com.google.protobuf" % "protobuf-java" % (ProtobufConfig / version).value % ProtobufConfig.name
managedSourceDirectories ++= PB.targets.value.map(_.outputPath)
)

lazy val protobufSettings = Def.settings(
libraryDependencies ++= Seq(
"io.grpc" % "protoc-gen-grpc-java" % grpcVersion asProtocPlugin (),
"com.google.protobuf" % "protobuf-java" % protobufVersion % "protobuf"
)
) ++ Seq(Compile, Test).flatMap(c => inConfig(c)(scopedProtobufSettings))

def splitTests(tests: Seq[TestDefinition], filter: Seq[String], forkOptions: ForkOptions) = {
val (filtered, default) = tests.partition(test => filter.contains(test.name))
val policy = Tests.SubProcess(forkOptions)
Expand Down Expand Up @@ -449,7 +461,6 @@ lazy val root: Project = Project("scio", file("."))
`scio-jdbc`,
`scio-parquet`,
`scio-tensorflow`,
`scio-schemas`,
`scio-examples`,
`scio-repl`,
`scio-jmh`,
Expand Down Expand Up @@ -517,13 +528,8 @@ lazy val `scio-core`: Project = project
buildInfoKeys := Seq[BuildInfoKey](scalaVersion, version, "beamVersion" -> beamVersion),
buildInfoPackage := "com.spotify.scio"
)
.dependsOn(
`scio-schemas` % "test->test",
`scio-macros`
)
.configs(
IntegrationTest
)
.dependsOn(`scio-macros`)
.configs(IntegrationTest)
.enablePlugins(BuildInfoPlugin)

lazy val `scio-test`: Project = project
Expand All @@ -532,6 +538,7 @@ lazy val `scio-test`: Project = project
.settings(publishSettings)
.settings(itSettings)
.settings(macroSettings)
.settings(protobufSettings)
.settings(
description := "Scio helpers for ScalaTest",
libraryDependencies ++= Seq(
Expand Down Expand Up @@ -576,7 +583,6 @@ lazy val `scio-test`: Project = project
.configs(IntegrationTest)
.dependsOn(
`scio-core` % "test->test;compile->compile;it->it",
`scio-schemas` % "test;it",
`scio-avro` % "compile->test;it->it"
)

Expand Down Expand Up @@ -679,7 +685,6 @@ lazy val `scio-google-cloud-platform`: Project = project
)
.dependsOn(
`scio-core` % "compile;it->it",
`scio-schemas` % "test",
`scio-avro` % "test",
`scio-test` % "test;it"
)
Expand Down Expand Up @@ -907,7 +912,6 @@ lazy val `scio-parquet`: Project = project
.dependsOn(
`scio-core`,
`scio-avro`,
`scio-schemas` % "test",
`scio-test` % "test->test"
)

Expand Down Expand Up @@ -944,28 +948,6 @@ lazy val `scio-tensorflow`: Project = project
`scio-core`,
`scio-test` % "test->test"
)
.enablePlugins(ProtobufPlugin)

lazy val `scio-schemas`: Project = project
.in(file("scio-schemas"))
.settings(commonSettings)
.settings(protobufSettings)
.settings(
description := "Avro/Proto schemas for testing",
publish / skip := true,
mimaPreviousArtifacts := Set.empty,
libraryDependencies ++= Seq(
"org.scala-lang.modules" %% "scala-collection-compat" % scalaCollectionCompatVersion,
"org.apache.avro" % "avro" % avroVersion
),
Compile / sourceDirectories := (Compile / sourceDirectories).value
.filterNot(_.getPath.endsWith("/src_managed/main")),
Compile / managedSourceDirectories := (Compile / managedSourceDirectories).value
.filterNot(_.getPath.endsWith("/src_managed/main")),
Compile / doc / sources := List(), // suppress warnings
compileOrder := CompileOrder.JavaThenScala
)
.enablePlugins(ProtobufPlugin)

lazy val `scio-examples`: Project = project
.in(file("scio-examples"))
Expand Down Expand Up @@ -1042,7 +1024,6 @@ lazy val `scio-examples`: Project = project
.dependsOn(
`scio-core`,
`scio-google-cloud-platform`,
`scio-schemas`,
`scio-jdbc`,
`scio-extra`,
`scio-elasticsearch8`,
Expand Down Expand Up @@ -1223,7 +1204,6 @@ lazy val site: Project = project
`scio-avro`,
`scio-google-cloud-platform`,
`scio-parquet`,
`scio-schemas`,
`scio-smb`,
`scio-test`,
`scio-extra`
Expand Down
35 changes: 16 additions & 19 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,31 +1,28 @@
addDependencyTreePlugin
addSbtPlugin("com.github.sbt" % "sbt-avro" % "3.4.2")
addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.5.3")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.1")
addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "1.2.0")
addSbtPlugin("com.github.sbt" % "sbt-unidoc" % "0.5.0")
addSbtPlugin("com.github.sbt" % "sbt-protobuf" % "0.7.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.2")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.0")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.10.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.1")
addSbtPlugin("com.github.cb372" % "sbt-explicit-dependencies" % "0.2.16")
addSbtPlugin("com.github.sbt" % "sbt-avro" % "3.4.2")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10")
addSbtPlugin("com.github.sbt" % "sbt-unidoc" % "0.5.0")
addSbtPlugin("com.lightbend.paradox" % "sbt-paradox" % "0.10.2")
addSbtPlugin("io.github.jonas" % "sbt-paradox-material-theme" % "0.6.0")
addSbtPlugin("ch.epfl.scala" % "sbt-bloop" % "1.5.3")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.3")
addSbtPlugin("com.lightbend.sbt" % "sbt-java-formatter" % "0.7.0")
addSbtPlugin("com.github.cb372" % "sbt-explicit-dependencies" % "0.2.16")
addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.0")
addSbtPlugin("com.thoughtworks.sbt-api-mappings" % "sbt-api-mappings" % "3.0.2")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.1")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.7.0")
addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.10")
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.4.1")
addSbtPlugin("io.github.jonas" % "sbt-paradox-material-theme" % "0.6.0")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.3")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.6")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.2")
addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.3")

libraryDependencies ++= Seq(
"com.github.os72" % "protoc-jar" % "3.11.4",
"org.apache.avro" % "avro-compiler" % "1.8.2"
)
libraryDependencies += "org.apache.avro" % "avro-compiler" % "1.8.2"

// force usage of scala-xml v2
// See https://github.com/scoverage/sbt-scoverage/issues/439
Expand Down
45 changes: 0 additions & 45 deletions scio-schemas/src/main/avro/bytes.avsc

This file was deleted.