-
Notifications
You must be signed in to change notification settings - Fork 131
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
sbt plugin to generate a swagger api spec as part of the build pipeline #97
Conversation
val file = target.value / "swagger" / "swagger.json" | ||
val args = file.absolutePath +: swaggerDomainNameSpaces.value | ||
val swaggerClasspath = data((fullClasspath in Runtime).value) ++ update.value.select(configurationFilter(swaggerConfig.name)) | ||
runner.value.run("com.iheart.playSwagger.SwaggerSpecRunner", swaggerClasspath, args, streams.value.log) |
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.
Error handling is missing in case generation of the spec fails
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.
So does it blow up the sbt session? Does it at least display the error?
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 case of errors the build will now fail ...
First of all thank you so much @mosche ! This will make play-swagger so much better. |
@@ -16,7 +16,9 @@ libraryDependencies ++= | |||
|
|||
Publish.settings | |||
|
|||
lazy val playSwagger = project in file(".") | |||
lazy val playSwagger = project in file(".") aggregate sbtPlugin |
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.
How about we move current plays-swagger to a core folder and create new root project that aggregate the play-swagger project and the sbt plugin project?
Here is an example of what I am thinking.
https://github.com/iheartradio/kanaloa/blob/master/build.sbt#L21-L38
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.
yeah, that would be my preference as well... didn't wanna start moving files around before discussing with you guys
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.
restructured the whole project / build as you suggested, should be much cleaner now
name := "sbt-play-swagger", | ||
sbtPlugin := true, | ||
scalaVersion := "2.10.6", | ||
resourceGenerators in Compile <+= Versioning.writeVersionFile("com/iheart/play-swagger.version"), |
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 makes sense. I was thinking sbt-buildInfo but that'll probably be an overkill.
👍 This is fantastic. I left one trivial comment on redundant |
import sbt.ScriptedPlugin._ | ||
import sbt._ | ||
|
||
object ScriptedTesting { |
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.
You could use an AutoPlugin
here.
Hi @kailuowang, |
…api specs as part of the build pipeline. in favor of a multiproject build the play-swagger core library moved into the corresponding directory
Thanks very much! @mosche merging in. |
….5.8 Update sbt-web to 1.5.8
Hey,
here's a proposal for the plugin. Happy to get some feedback!
See the comments below for remaining issues.
Regards, Moritz