build.sbt refactor + plugin for easy installation#17
build.sbt refactor + plugin for easy installation#17kondaurovDev wants to merge 16 commits intobtlines:masterfrom kondaurovDev:plugin
Conversation
build.sbt
Outdated
| name := "GrpcGatewayRuntime", | ||
| libraryDependencies ++= Seq( | ||
| "com.trueaccord.scalapb" %% "compilerplugin" % "0.6.7", | ||
| "com.trueaccord.scalapb" %% "scalapb-runtime-grpc" % "0.6.7", |
There was a problem hiding this comment.
that was written twice
| "org.webjars" % "swagger-ui" % "3.5.0", | ||
| "com.google.api.grpc" % "googleapis-common-protos" % "0.0.3" % "protobuf" | ||
| ), | ||
| PB.protoSources in Compile += target.value / "protobuf_external", |
There was a problem hiding this comment.
We don't need these settings, do we?
There was a problem hiding this comment.
This is where the http option is defined
There was a problem hiding this comment.
Yes, but everything works without that dependency. runtime doesn't need protos, they are generated at compile time
| libraryDependencies ++= Seq( | ||
| "com.trueaccord.scalapb" %% "compilerplugin" % "0.6.7", | ||
| "com.trueaccord.scalapb" %% "scalapb-runtime-grpc" % "0.6.7", | ||
| "com.google.api.grpc" % "googleapis-common-protos" % "0.0.3" % "protobuf" |
There was a problem hiding this comment.
why do we depend on scalapb-runtime-grpc? We don't need this, because it's just source code generator
There was a problem hiding this comment.
In theory it's not needed but I think there is a compile error if missing
There was a problem hiding this comment.
I believe user has to specify this dependency "googleapis-common-protos" explicitly, no need to depend on this in generator. I don't have any compile errors.
"generator" artifact has to depend only on libraries that it needs. There's only one dependency "compilerplugin"
# Conflicts: # build.sbt
|
I've added example project that uses that library but it's not ready yet. I can't build gateway module, i will look at it later. What do you think about plugin? It it good solution? |
|
Thanks for the PR! |
|
I've added example project, don't worry that there are many new files :) I've refactored gateway generator and swagger generator a little bit. I think that's all for now that i want to add in this PR |
examples/first/.gitignore
Outdated
| @@ -0,0 +1,3 @@ | |||
| target | |||
| .idea | |||
There was a problem hiding this comment.
I wouldn't put anything related to a specific IDE in .gitignore
There was a problem hiding this comment.
Yep, i forgot it, i've created this commit from another machine where global ignore isn't configured :)
examples/first/.gitignore
Outdated
| @@ -0,0 +1,3 @@ | |||
| target | |||
| .idea | |||
| **/specs/*.yml No newline at end of file | |||
There was a problem hiding this comment.
Can you end your files with an empty line?
There was a problem hiding this comment.
I will search for this option in idea intellij
examples/first/build.sbt
Outdated
| @@ -0,0 +1,67 @@ | |||
| scalaVersion in ThisBuild := "2.12.2" | |||
There was a problem hiding this comment.
Ok, i will fix it
|
|
||
| resolvers in ThisBuild += Resolver.bintrayRepo("beyondthelines", "maven") | ||
|
|
||
| disablePlugins(RevolverPlugin) |
There was a problem hiding this comment.
Not sure about using the RevolverPlugin
There was a problem hiding this comment.
This is example project and moreover RevolverPlugin add ability to run multiple projects in forked process. We can start service and gateway separately and link them via port, do you know other solutions? I think it's like docker's goal :)
| val b = CodeGeneratorResponse.File.newBuilder() | ||
| val packageName: List[String] = serviceDescriptor.getFile.scalaPackagePartsAsSymbols.toList | ||
| b.setName(s"${packageName.mkString("/")}/${serviceDescriptor.getName}Handler.scala") | ||
| if (params.flatPackage) {} |
There was a problem hiding this comment.
ok, i'll fix it
# Conflicts: # examples/first/build.sbt
# Conflicts: # build.sbt # generator/src/main/scala/grpcgateway/generators/GatewayGenerator.scala # generator/src/main/scala/grpcgateway/generators/SwaggerGenerator.scala
# Conflicts: # examples/first/build.sbt
Hello!
I've added sbt plugin for this library for easy usage. What do you think?