Skip to content

Commit

Permalink
Use Scala 3 for proto compilation (#178)
Browse files Browse the repository at this point in the history
This removes the need to use Scala 2 in proto compilation. Now we use it only for scalameta.
  • Loading branch information
Ostrzyciel authored Oct 15, 2024
1 parent ff597b9 commit 4ad7b2f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 2 additions & 3 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,14 @@ 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"
),
// 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,
)

Expand All @@ -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),
Expand Down
1 change: 1 addition & 0 deletions rdf-protos/src/main/protobuf/package.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit 4ad7b2f

Please sign in to comment.