tuplejump / play-yeoman

Play + Yeoman integration sbt and play plugins
Apache License 2.0
237 stars 58 forks source link

dependence on successful grunt build #40

Closed jschaul closed 9 years ago

jschaul commented 10 years ago

Hello,

currently the play stage or dist task executes the grunt process, waits for it, but irrespectively whether that process succeeded or failed continues on to package the application. Is there a way to at least optionally configure this plugin to fail and stop when grunt fails? If grunt fails that's an indication that something in the code is wrong or tests failed, and that means the overall build should fail - especially in the context of continuous integration and deployment - I don't want to deploy a broken new version when there are problems in the build.

Thanks for your work, is has proved very valuable so far.

myinsiders commented 10 years ago

It could be done by changing gruntDist to something like the following inside play-Yeoman:

gruntDist := {
  val base = (uiDirectory in Compile).value
  val gruntFile = (gruntBuildFile in Compile).value
  val exitValue = runGrunt(base, gruntFile, List()).get.exitValue()
  if (exitValue != 0) throw new Exception("Grunt build failed.")
},

Mark.

On Tuesday, 4 March 2014 at 17:34, jschaul wrote:

Hello, currently the play stage or dist task executes the grunt process, waits for it, but irrespectively whether that process succeeded or failed continues on to package the application.
Is there a way to at least optionally configure this plugin to fail and stop when grunt fails? If grunt fails that's an indication that something in the code is wrong or tests failed, and that means the overall build should fail - especially in the context of continuous integration and deployment - I don't want to deploy a broken new version when there are problems in the build.
Thanks for your work, is has proved very valuable so far.

— Reply to this email directly or view it on GitHub (https://github.com/tuplejump/play-yeoman/issues/40).

milliondreams commented 10 years ago

Does this work for everyone? Many of us and users were having issues on forcing grunt task success. Many a times the task did succeed but it was failing cause of some karma issues.

milliondreams commented 10 years ago

@jschaul @myinsiders Can you confirm this works as expected for you guys. I will update the code accordingly.

myinsiders commented 10 years ago

I don't use play-yeoman any more but something similar works in our codebase. On 31 May 2014 08:08, "Rohit Rai" notifications@github.com wrote:

@jschaul https://github.com/jschaul @myinsiders https://github.com/myinsiders Can you confirm this works as expected for you guys. I will update the code accordingly.

— Reply to this email directly or view it on GitHub https://github.com/tuplejump/play-yeoman/issues/40#issuecomment-44719892 .

scottt732 commented 9 years ago

Is it possible to run sbt compile dist and not invoke grunt w/ --force?

fastf0rward commented 9 years ago

+1 on this issue: we also need grunt to run without --force.

fastf0rward commented 9 years ago

Any news on this issue @milliondreams ? Now play-yeoman supports running Grunt without the --force flag by setting Yeoman.forceGrunt := false, Play still continues building and deploying, irrespective of the failed Grunt build.

It would be great to have an optional flag to stop the Play build in case of an aborted Grunt build.

Shiti commented 9 years ago

Updated stage and dist tasks to throw an error when grunt fails if Yeoman.forceGrunt:= false but the build is not stopped.