-
Notifications
You must be signed in to change notification settings - Fork 18
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
[scala3] Enable scala3_sources #222
Changes from 7 commits
64c5eb9
94a4831
597122c
ba21794
d67c5cc
f22d398
277bed4
743025d
831d696
8eaac08
98d651f
b3a6769
d07db68
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,6 +110,12 @@ jobs: | |
distribution: temurin | ||
java-version: 8 | ||
|
||
- name: Install go & go-protobuf | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: '^1.20' | ||
- run: go install google.golang.org/protobuf/cmd/[email protected] | ||
|
||
- name: Cache Coursier cache | ||
uses: coursier/cache-action@v6 | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You under the Apache License, Version 2.0 | ||
* (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.apache.pekko.grpc.gen.scaladsl | ||
|
||
private[scaladsl] class ScalaCompatConstants(emitScala3Sources: Boolean = false) { | ||
// val WildcardType: String = if (emitScala3Sources) "?" else "_" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess this can be dropped |
||
val WildcardImport: String = if (emitScala3Sources) "*" else "_" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,6 @@ import java.net.InetSocketAddress | |
import org.apache.pekko | ||
import pekko.actor.ActorSystem | ||
import pekko.grpc.GrpcClientSettings | ||
import pekko.grpc.internal.ClientConnectionException | ||
import pekko.grpc.scaladsl.tools.MutableServiceDiscovery | ||
import pekko.http.scaladsl.Http | ||
import pekko.stream.{ Materializer, SystemMaterializer } | ||
|
@@ -184,8 +183,7 @@ class NonBalancingIntegrationSpec(backend: String) | |
|
||
val failure = | ||
client.sayHello(HelloRequest(s"Hello friend")).failed.futureValue.asInstanceOf[StatusRuntimeException] | ||
failure.getStatus.getCode should be(Code.UNAVAILABLE) | ||
client.closed.failed.futureValue shouldBe a[ClientConnectionException] | ||
failure.getStatus.getCode should (equal(Code.UNKNOWN).or(equal(Code.UNAVAILABLE))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. strange but no problem |
||
} | ||
|
||
"not fail when no valid endpoints are provided but no limit on attempts is set" in { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
# Upgrade to io.grpc 1.60 caused this bin compat issue | ||
ProblemFilters.exclude[DirectMissingMethodProblem]("org.apache.pekko.grpc.internal.PekkoDiscoveryNameResolverProvider.this") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 since internal |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ import scala.concurrent.duration.FiniteDuration | |
class PekkoDiscoveryNameResolverProvider( | ||
discovery: ServiceDiscovery, | ||
defaultPort: Int, | ||
serviceName: String, | ||
portName: Option[String], | ||
protocol: Option[String], | ||
resolveTimeout: FiniteDuration)(implicit ec: ExecutionContext) | ||
|
@@ -34,8 +35,7 @@ class PekkoDiscoveryNameResolverProvider( | |
|
||
override def getDefaultScheme: String = "http" | ||
|
||
override def newNameResolver(targetUri: URI, args: NameResolver.Args): PekkoDiscoveryNameResolver = { | ||
require(targetUri.getAuthority != null, s"target uri should not have null authority, got [$targetUri]") | ||
new PekkoDiscoveryNameResolver(discovery, defaultPort, targetUri.getAuthority, portName, protocol, resolveTimeout) | ||
} | ||
override def newNameResolver(targetUri: URI, args: NameResolver.Args): PekkoDiscoveryNameResolver = | ||
new PekkoDiscoveryNameResolver(discovery, defaultPort, serviceName, portName, protocol, resolveTimeout) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this change related/required for the switch to the new io.grpc version and introduction of scala3_sources? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks like There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, that is slightly scary (I assume the assert was there for a reason), but if you're confident this is a correct fix then 👍 |
||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,5 +19,7 @@ object ProtocJSPlugin extends AutoPlugin { | |
override def requires: Plugins = ProtocPlugin | ||
|
||
override def projectSettings: Seq[Def.Setting[_]] = | ||
Seq(Compile, Test).flatMap(inConfig(_)(PB.targets += PB.gens.js -> resourceManaged.value / "js")) | ||
Seq(Compile, Test).flatMap(inConfig(_)( | ||
Seq( | ||
PB.targets += PB.gens.go -> resourceManaged.value / "go"))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should the |
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
> compile | ||
|
||
$ exists target/scala-2.12/resource_managed/main/js/hellorequest.js | ||
$ exists target/scala-2.12/resource_managed/main/go/github.com/apache/pekko-grpc/helloworld.pb.go | ||
$ exists target/scala-2.12/pekko-grpc/main/example/myapp/helloworld/grpc/HelloRequest.scala | ||
|
||
> test:compile | ||
$ exists target/scala-2.12/resource_managed/test/js/echomessage.js | ||
$ exists target/scala-2.12/resource_managed/test/go/github.com/apache/pekko-grpc/echo.pb.go | ||
$ exists target/scala-2.12/pekko-grpc/test/example/myapp/echo/grpc/EchoMessage.scala |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah looks like we have to split this into two: "a step cannot have both the
uses
andrun
keys"