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

[WIP]: Fix code generation problems for Play #524

Closed
wants to merge 1 commit into from
Closed

[WIP]: Fix code generation problems for Play #524

wants to merge 1 commit into from

Conversation

marcospereira
Copy link
Contributor

@marcospereira marcospereira commented Feb 6, 2019

Release 0.5.0 is not generating valid code. This fixes the templates to adapt them to the recent API changes.

Fixes #523.

Status

WIP since the code now compiles, but the tests for play-grpc fail when using a local build of akka-grpc. To reproduce, just check out playframework/play-grpc#45 and run the tests.

Release 0.5.0 is not generating valid code. This fixes the templates
to adapt them to the recent API changes.
@akka-ci
Copy link

akka-ci commented Feb 6, 2019

Thank you for your pull request! After a quick sanity check one of the team will reply with 'OK TO TEST' to kick off our automated validation on Jenkins. This compiles the project, runs the tests, and checks for things like binary compatibility and source code formatting. When two team members have also manually reviewed and (perhaps after asking for some amendments) accepted your contribution, it should be good to be merged.

For more details about our contributing process, check out CONTRIBUTING.md - and feel free to ask!

@@ -25,23 +27,25 @@ import io.grpc.Status;
* Abstract base class for implementing @{service.name} in Java and using as a play Router
*/
public abstract class Abstract@{service.name}Router extends PlayRouter implements @{service.name} {
private final Function<Throwable, Status> eHandler;
private final ActorSystem actorSystem;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would be better to change PlayRouter to also requires an ActorSystem and not only a Materializer. But decide not to change it here to keep the impact of this PR small.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get this comment, because it has been changed to also require an actor system now.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I mean here, at the constructor:

@InternalApi abstract class PlayRouter(mat: Materializer, serviceName: String) extends play.api.routing.Router {

Should it instead be:

@InternalApi abstract class PlayRouter(mat: Materializer, actorSystem: ActorSystem, serviceName: String) extends play.api.routing.Router

?

In the end, user extending the generated code will need to inject an ActorSystem anyway.

}

/**
* INTERNAL API
*/
final public scala.Function1<HttpRequest, Future<HttpResponse>> createHandler(String prefix, Materializer mat) {
return akka.grpc.internal.PlayRouterHelper.handlerFor(
@{service.name}HandlerFactory.create(this, prefix, mat, eHandler)
@{service.name}HandlerFactory.create(this, prefix, mat, eHandler, this.actorSystem)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It also makes more sense to have the exception handler as the last parameter, but again, avoid pilling up changes here.

Copy link
Member

@johanandren johanandren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM I guess

@@ -25,23 +27,25 @@ import io.grpc.Status;
* Abstract base class for implementing @{service.name} in Java and using as a play Router
*/
public abstract class Abstract@{service.name}Router extends PlayRouter implements @{service.name} {
private final Function<Throwable, Status> eHandler;
private final ActorSystem actorSystem;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get this comment, because it has been changed to also require an actor system now.

@johanandren
Copy link
Member

OK TO TEST

@marcospereira
Copy link
Contributor Author

LGTM I guess

Thanks for reviewing, @johanandren. I will keep this as WIP until I have time to investigate why the tests for play-grpc are failing.

@raboof
Copy link
Member

raboof commented Feb 26, 2019

@marcospereira I noticed akka-grpc was still depending on a RC of Play, added #531 to update.

@raboof
Copy link
Member

raboof commented Feb 26, 2019

(looking at the conflicts now)

@raboof
Copy link
Member

raboof commented Feb 26, 2019

Hmm, it seems like the changes in the PR were already part of #429 so are already on master - so this PR is perhaps no longer necessary?

@marcospereira
Copy link
Contributor Author

@raboof yes, we can close this.

I've created #533 to handle a small problem when trying a local build of akka-grpc in play-grpc. There are still some tests failing there though.

@marcospereira marcospereira deleted the fix-play-code-generation branch February 26, 2019 19:08
@marcospereira
Copy link
Contributor Author

By the way, you can still use playframework/play-grpc#45 to see the tests failures.

dwijnand pushed a commit to playframework/play-grpc that referenced this pull request Feb 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generate invalid code for server side in play-java
4 participants