View Single Post
  #2  
Old 10-19-2006, 02:37 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 5,743
Re: Failure handling in groups and subroutines

Quote:
Originally posted by mike_laff
I've used your product now for a few weeks to attempt produce a complex build of a number of projects. However, I find the error handling of groups and subroutines in general very confusing and in a complex project (with error handling!) it appears that groups and subroutines are relatively useless.

For example, in both groups and subroutines, exactly what effect do the "On Step Failure" properties do? Groups and subroutines never fail!

If this does nothing surely it should be removed (on groups/subs) to avoid confusion and time wasting trying to use them.
The On Step Failure settings apply to any step that fails, whether in a group or subroutine or not.

Quote:
However, use of these properties could be made valuable by extending them with an option to exit from the group/subroutine with a status. I believe this would be an extremely useful enhancement.

ie. Build failure steps: [ ] (blank for all)
(o) continue building or
(o) exit group/subroutine with success (?)
(o) exit group/subroutine with fail

For a basic example of why this would be used....

I wish to build 20 projects. Each project requires a version change, a VC build and a setup built. I create a subroutine to do these 3 steps (could be 10 or more in reality) and call the subroutine 20 times from the main project steps using parameters. Naturally, there is no point trying to build the setup if the VC build fails but I do wish the other 20 projects to be allowed their own attempt at building. With diligent use of the "Continue building" option and lots of conditional build rules, I have actually managed to achieve this but it was very cumbersome for a requirement that seems so basic.

Apart from this one semi-serious failing, however, it's a magic product - keep up the good work
Not a bad idea. I suspect the reason it hasn't been requested before now are:
1) It's more common to do all that from a single step in VBP (a Make VC or Make VS.NET step to set/increment versions, specifying a workspace or solution containing all 20 projects + setup projects)

2) If broken out into multiple steps for each project, it's still probably more common to stop on any step failure and correct the problem before continuing (later projects will likely depend on the earlier ones, etc.).

3) Even when continuing, there probably aren't many steps that could fail and the build should still continue, so

what you could do: in the subroutine, mark the build step to continue on failure, and add an Exit step (configured to exit with a success status) after it with a build rule of

%LASTSTEP_STATUS% does not equal 0

This will exit from the subroutine at that point if the build step failed, and the build will continue at the next project step.

If you do end up with several steps in the subroutine that should trigger an exit of the subroutine on failure, you could get more elaborate and use project-level step script events to store the status and conditionally skip the remaining steps.
http://www.visualbuild.com/Manual/scriptevents.htm
Reply With Quote