Skip to content

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

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open

build.sbt refactor + plugin for easy installation #17

wants to merge 16 commits into from

Conversation

kondaurovDev
Copy link
Contributor

Hello!
I've added sbt plugin for this library for easy usage. What do you think?

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",
Copy link
Contributor Author

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",
Copy link
Contributor Author

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?

Copy link
Owner

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

Copy link
Contributor Author

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"
Copy link
Contributor Author

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

Copy link
Owner

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

Copy link
Contributor Author

@kondaurovDev kondaurovDev Dec 19, 2017

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"

@kondaurovDev
Copy link
Contributor Author

kondaurovDev commented Dec 20, 2017

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?

@btlines
Copy link
Owner

btlines commented Dec 22, 2017

Thanks for the PR!
The plugin approach certainly makes things easier on the user side.
I leave this open for a few days to see what people think ... and I'll get back to it after the holidays

@kondaurovDev
Copy link
Contributor Author

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

@@ -0,0 +1,3 @@
target
.idea
Copy link
Owner

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

Copy link
Contributor Author

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 :)

@@ -0,0 +1,3 @@
target
.idea
**/specs/*.yml
Copy link
Owner

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?

Copy link
Contributor Author

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

@@ -0,0 +1,67 @@
scalaVersion in ThisBuild := "2.12.2"
Copy link
Owner

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

Copy link
Contributor Author

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)
Copy link
Owner

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

Copy link
Contributor Author

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) {}
Copy link
Owner

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

Copy link
Contributor Author

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:
#	build.sbt
#	generator/src/main/scala/grpcgateway/generators/GatewayGenerator.scala
#	generator/src/main/scala/grpcgateway/generators/SwaggerGenerator.scala
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.

2 participants