akka-grpc icon indicating copy to clipboard operation
akka-grpc copied to clipboard

IDE support in IntelliJ

Open johanandren opened this issue 7 years ago • 10 comments

In #243 I added support for eclipse to pick up/understand that the akka-grpc plugin is part of a maven build and is a source code generator that needs to be run to build the project.

Is there something like that which makes IntelliJ understand that "rebuild project" should also trigger compilation of the proto-files?

johanandren avatar Jul 04 '18 09:07 johanandren

For sbt: https://youtrack.jetbrains.com/issue/SCL-9301#comment=27-2041907

Using sbt-shell when importing a project will supposedly make IntelliJ compile through sbt triggering the protobuf compilation on "Build project"

johanandren avatar Jul 11 '18 12:07 johanandren

Any updates on this?

benthecarman avatar Apr 08 '21 19:04 benthecarman

No specific work on the Akka gRPC side.

Quite some time has passed since I opened this issue though, so there has been a number of IntelliJ releases since, not sure if anything improved in IntelliJ wrt to this, or some other changes to how the generation is hooked into the respective build tools that could make IntelliJ pick it up/understand that it is a generator better.

johanandren avatar Apr 09 '21 07:04 johanandren

It's really surprising no one has found a work around for this considering intellij is one of the more popular IDEs for development in Scala.

Christewart avatar Apr 09 '21 13:04 Christewart

It's really surprising no one has found a work around for this considering intellij is one of the more popular IDEs for development in Scala.

I think the workaround is to use sbt and IntelliJ side-by-side - IIRC once sbt has compiled the project then doing further development in IntelliJ mostly works, right? So once someone is used to that workflow it becomes less urgent to improve the integration.

I agree "properly" fixing this would be great, though!

raboof avatar Apr 09 '21 13:04 raboof

Yeah, that seems to be true in our case.

I have limited understanding of grpc, but it seems we need to

  1. Execute the protobuf generation
  2. Actually compile all source code

I'm trying to understand what the command is that does (1) so that I might be able to work around this problem by manually defining the ordering

Christewart avatar Apr 09 '21 14:04 Christewart

I'm trying to understand what the command is that does (1)

I think that should be sbt protocGenerate

so that I might be able to work around this problem by manually defining the ordering

Well, the ordering should already be there though... from the start of this thread I had the impression that it might have been some caching issue? I also know several things have changed in this area in sbt-protoc, though, so that might no longer be up-to-date.

raboof avatar Apr 09 '21 14:04 raboof

I'm trying to understand what the command is that does (1)

I think that should be sbt protocGenerate

so that I might be able to work around this problem by manually defining the ordering

Well, the ordering should already be there though... from the start of this thread I had the impression that it might have been some caching issue? I also know several things have changed in this area in sbt-protoc, though, so that might no longer be up-to-date.

You likely have a better idea of what is going on than i do frankly :joy:

I'll look into this later again, if you are curious the project in reference is lnd-rpc on bitcoin-s:

https://github.com/bitcoin-s/bitcoin-s/tree/master/lnd-rpc

Christewart avatar Apr 09 '21 15:04 Christewart

At least a little bit surprising that the IntelliJ sbt integration does not pick up that there are sourceGenerators defined for a project (https://github.com/thesamet/sbt-protoc/blob/master/src/main/scala/sbtprotoc/ProtocPlugin.scala#L335) but maybe that is not a general concept that IntelliJ handles.

johanandren avatar Apr 09 '21 15:04 johanandren

At least a little bit surprising that the IntelliJ sbt integration does not pick up that there are sourceGenerators defined for a project (https://github.com/thesamet/sbt-protoc/blob/master/src/main/scala/sbtprotoc/ProtocPlugin.scala#L335) but maybe that is not a general concept that IntelliJ handles.

It is very possible that i am missing something since this is a submodule, but we do add it in .aggregate() and .dependsOn() for the root project

Christewart avatar Apr 09 '21 15:04 Christewart