From 4ad7b2f11b8a39b99ce98770cd779b6da2c07554 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Sowi=C5=84ski?= Date: Tue, 15 Oct 2024 21:53:06 +0200 Subject: [PATCH] Use Scala 3 for proto compilation (#178) This removes the need to use Scala 2 in proto compilation. Now we use it only for scalameta. --- build.sbt | 5 ++--- rdf-protos/src/main/protobuf/package.proto | 1 + 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index fd0ff044..c3dd3058 100644 --- a/build.sbt +++ b/build.sbt @@ -67,7 +67,7 @@ lazy val commonSettings = Seq( // Intermediate project that generates the Scala code from the protobuf files lazy val rdfProtos = (project in file("rdf-protos")) .settings( - name := "jelly-scalameta-test", + name := "jelly-scalameta", libraryDependencies ++= protobufCompilerDeps, Compile / PB.targets := Seq( scalapb.gen() -> (Compile / sourceManaged).value / "scalapb" @@ -75,7 +75,6 @@ lazy val rdfProtos = (project in file("rdf-protos")) // Add the shared proto sources Compile / PB.protoSources ++= Seq(baseDirectory.value / "src" / "main" / "protobuf_shared"), Compile / PB.generate / excludeFilter := "grpc.proto", - scalaVersion := "2.13.15", publishArtifact := false, ) @@ -90,7 +89,7 @@ lazy val core = (project in file("core")) // Add the generated proto classes after transforming them with Scalameta Compile / sourceGenerators += Def.task { Generator.gen( - inputDir = (rdfProtos / target).value / "scala-2.13" / "src_managed" / "main", + inputDir = (rdfProtos / target).value / ("scala-" + scalaVersion.value) / "src_managed" / "main", outputDir = sourceManaged.value / "scalapb", ) }.dependsOn(rdfProtos / Compile / PB.generate), diff --git a/rdf-protos/src/main/protobuf/package.proto b/rdf-protos/src/main/protobuf/package.proto index dcb1bad3..87099ae2 100644 --- a/rdf-protos/src/main/protobuf/package.proto +++ b/rdf-protos/src/main/protobuf/package.proto @@ -14,6 +14,7 @@ option (scalapb.options) = { // Disabling this can substantially improve performance preserve_unknown_fields: false enum_strip_prefix: true + scala3_sources: true }; option java_package = "eu.ostrzyciel.jelly.core.proto.v1";