-
Notifications
You must be signed in to change notification settings - Fork 19
build.sbt refactor + plugin for easy installation #17
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
base: master
Are you sure you want to change the base?
Conversation
build.sbt
Outdated
@@ -10,37 +10,31 @@ lazy val runtime = (project in file("runtime")) | |||
crossScalaVersions := Seq("2.12.4", "2.11.11"), | |||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that was written twice
build.sbt
Outdated
"com.trueaccord.scalapb" %% "scalapb-runtime-grpc" % "0.6.7", | ||
"com.trueaccord.scalapb" %% "scalapb-json4s" % "0.3.3", | ||
"io.grpc" % "grpc-netty" % "1.8.0", | ||
"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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need these settings, do we?
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.
This is where the http
option is defined
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.
Yes, but everything works without that dependency. runtime doesn't need protos, they are generated at compile time
build.sbt
Outdated
crossScalaVersions := Seq("2.12.4", "2.10.6"), | ||
name := "GrpcGatewayGenerator", | ||
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory it's not needed but I think there is a compile error if missing
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't put anything related to a specific IDE in .gitignore
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.
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 |
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.
Can you end your files with an empty line?
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can even go with 2.12.4
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.
Ok, i will fix it
|
||
resolvers in ThisBuild += Resolver.bintrayRepo("beyondthelines", "maven") | ||
|
||
disablePlugins(RevolverPlugin) |
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.
Not sure about using the RevolverPlugin
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line can be removed
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.
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?