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

support ScalaPB package/file-level customization #1253

Merged
merged 1 commit into from
Feb 1, 2021

Conversation

bjaglin
Copy link
Contributor

@bjaglin bjaglin commented Jan 31, 2021

See https://scalapb.github.io/docs/customizations

On master, code won't compile if package/file-level options are used to change flat_package as only ScalaPB honors the request.

@akka-ci
Copy link

akka-ci commented Jan 31, 2021

Thank you for your pull request! After a quick sanity check one of the team will reply with 'OK ΤO ΤESΤ' 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!

@bjaglin bjaglin force-pushed the scalapb-customizations branch 2 times, most recently from 4a2f727 to 7c46a20 Compare February 1, 2021 00:42
@bjaglin bjaglin marked this pull request as ready for review February 1, 2021 01:06
@raboof
Copy link
Member

raboof commented Feb 1, 2021

OK TO TEST

@raboof
Copy link
Member

raboof commented Feb 1, 2021

On master, code won't compile if package/file-level options are used to change flat_package as only ScalaPB honors the request.

Indeed the Akka gRPC code generation currently only allows changing flat_package as a 'build-wide' wide option. I think we would definitely want to update the Akka gRPC code generation to take into account package/file-level customizations, but this feature is already useful without it.

@bjaglin bjaglin force-pushed the scalapb-customizations branch from 7c46a20 to 15087df Compare February 1, 2021 08:32
$ exists target/scala-2.12/akka-grpc/main/example/myapp/helloworld/grpc/HelloRequest.scala
$ exists target/scala-2.12/akka-grpc/main/example/myapp/helloworld/grpc/HelloworldProto.scala
$ exists target/scala-2.12/akka-grpc/main/example/myapp/helloworld/grpc/GreeterService.scala
> compile
Copy link
Contributor Author

Choose a reason for hiding this comment

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

just force-pushed as I had forgotten this...

Copy link
Contributor

@ignasi35 ignasi35 left a comment

Choose a reason for hiding this comment

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

Nice that we're getting this.

(discussion for a separate PR/issue): I wonder if should eventually deprecate and remove the use of flat_package out of the box. We would then fallback to scalapb's behavior and transparently use the options available there.

@bjaglin
Copy link
Contributor Author

bjaglin commented Feb 1, 2021

I wonder if should eventually deprecate and remove the use of flat_package out of the box. We would then fallback to scalapb's behavior and transparently use the options available there.

I am not sure it will be required. ScalaPB has promising upcoming changes that will make consumption of JAR-packaged Scala stubs compiled with different options than the generator ones used for the local project seamless.

See scalapb/scalapb-validate#70 & scalapb/ScalaPB#873 for related discussions.

@ignasi35
Copy link
Contributor

ignasi35 commented Feb 1, 2021

The motivation of my comment was to eventually remove from akka-gRPC any access to scalaPB settings since those scalaPB settings are already available via options in the .proto file.

So users no longer need to specify akkaGrpcCodeGeneratorSettings := akkaGrpcCodeGeneratorSettings.value.filterNot(_ == "flat_package") and, instead, use plain scalapb syntax on the .proto file.

Again, I'd rather discuss these further improvements on a separate issue/PR since I'm sure there'll be use cases that require more attention.

Copy link
Member

@raboof raboof left a comment

Choose a reason for hiding this comment

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

Great! Would love to take into account the flat_package option better in the Akka gRPC codegen side but that's for another PR, this is already a great improvement.

@raboof raboof merged commit ec77ff5 into akka:master Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants