-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
* support scala 2.13 and scala 3 build for codegen lib * Update build.sbt * rework build
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,7 +66,15 @@ lazy val codegen = Project(id = "codegen", base = file("codegen")) | |
(assembly / assemblyOption) := (assembly / assemblyOption).value.withPrependShellScript( | ||
Some(sbtassembly.AssemblyPlugin.defaultUniversalScript(shebang = true))), | ||
crossScalaVersions := Dependencies.Versions.CrossScalaForPlugin, | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
pjfanning
Author
Contributor
|
||
scalaVersion := scala212) | ||
scalaVersion := scala212, | ||
Compile / unmanagedSourceDirectories ++= { | ||
if (scalaBinaryVersion.value == "2.12") { | ||
Seq.empty | ||
} else { | ||
Seq( | ||
project.base / "src" / "main" / "scala-2.13+") | ||
} | ||
}) | ||
.settings(addArtifact(Compile / assembly / artifact, assembly)) | ||
.settings(addArtifact(Artifact(pekkoGrpcCodegenId, "bat", "bat", "bat"), mkBatAssemblyTask)) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* license agreements; and to You under the Apache License, version 2.0: | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* This file is part of the Apache Pekko project, which was derived from Akka. | ||
*/ | ||
|
||
/* | ||
* Copyright (C) 2018-2021 Lightbend Inc. <https://www.lightbend.com> | ||
*/ | ||
|
||
package org.apache.pekko.grpc.gen | ||
|
||
import com.google.protobuf.ExtensionRegistry | ||
import com.google.protobuf.compiler.PluginProtos.CodeGeneratorRequest | ||
import com.google.protobuf.compiler.PluginProtos.CodeGeneratorResponse | ||
import protocbridge.Artifact | ||
|
||
/** | ||
* Code generator trait that is not directly bound to scala-pb or protoc (other than the types). | ||
*/ | ||
trait CodeGenerator { | ||
import CodeGenerator._ | ||
|
||
/** Generator name; example: `pekko-grpc-scala` */ | ||
def name: String | ||
|
||
def run(request: CodeGeneratorRequest, logger: Logger): CodeGeneratorResponse | ||
|
||
/** Takes Scala binary version and returns suggested dependency Seq */ | ||
def suggestedDependencies: ScalaBinaryVersion => Seq[Artifact] | ||
|
||
def registerExtensions(registry: ExtensionRegistry): Unit = {} | ||
|
||
final def run(request: Array[Byte], logger: Logger): Array[Byte] = { | ||
val registry = ExtensionRegistry.newInstance | ||
registerExtensions(registry) | ||
run(CodeGeneratorRequest.parseFrom(request, registry), logger: Logger).toByteArray | ||
} | ||
} | ||
|
||
object CodeGenerator { | ||
|
||
/** Holds the prefix of a given Scala binary version */ | ||
case class ScalaBinaryVersion(prefix: String) | ||
} |
Hey, shouldn't the
crossScalaVersions
should be changed? Now it still default to2.12
only.I'm asking, because we're getting a conflicting information in the Scala 3 Open Community Build for this project.
In the Scaladex there is a published version of codegen for Scala 3 and 2.13, but the pekko-grpc build setup does say it only cross compiles to 2.12.