|
#1
|
|||
|
|||
Setting Ignore Failure for all subroutine steps
I am trying to set the ignore failure property for all the steps in a script. I got the code below from you some time ago.
It sets ignore for the project steps, but not the subroutine steps. The net effect is that the build stops if there is an error, which is what I am trying to prevent: here is the script, which I have in a step at the top of the bld file: Option Explicit Dim objSteps, idx Set objSteps = Project.Steps(vbldStepMain) ' set all projects steps except first one to ' ignore failure For idx = 1 To objSteps.Count-1 objSteps(idx).IgnoreFailure = True Next Set objSteps = Project.Steps(vbldStepSubroutine) ' set all projects subroutine steps to ignore failure For idx = 0 To objSteps.Count-1 objSteps(idx).IgnoreFailure = True Next |
#2
|
|||
|
|||
That code works for me...
That is some interesting code, I tested it, and it seems to work fine for me.
BTW, the Ignore Fail check box doesn't get updated in the grid, but the value is updated to True with this script for all Project Steps and Subroutine Steps (perhaps you wanted all Global Subroutine Steps to be flagged as well??). If that is what you need, add this script code: Set objSteps = Project.Steps(vbldStepGlobalSubroutine) ' set all projects subroutine steps to ignore failure For idx = 0 To objSteps.Count-1 objSteps(idx).IgnoreFailure = True Next If that isn't what you needed, how exactly isn't it working for you? Kevin |
#3
|
|||
|
|||
Hmmm, how do you know it gets updated internally? What I see is with this macro having been run, If I get a VC.NET build error it stops the visual build process. I dont really care about the checkbox being updated visually as long as I can get the build to keep chugging along
thanks rich |
#4
|
|||
|
|||
How I verified internal state change...
Here is the bld file I used to test the script code (all steps after the first will always fail [division by 0]).
Are you conditionally doing this step (marking all steps as Ignore Fail)? If not, why not just mark them Ignore Fail, remove the script step, save the build, and eliminate the need for this script code? Kevin |
#5
|
|||
|
|||
Aha,
but is fails when the project step is a subroutine call. I have modified your sample. Check it out. |
#6
|
|||
|
|||
It seemed to work for me...
I ran your modified script, and it seemd to work for me.
Here is the output I received: Building project step 'Set Ignore Fail for all steps (including children)'... Building project step 'Main Fail Step'... Error at Line 2, Column 1 (Division by zero) Building project step 'Child Fail Step'... Error at Line 2, Column 1 (Division by zero) Building project step 'Child Subroutine TEst'... Building subroutine step 'Fail Subroutine'... Error at Line 2, Column 1 (Division by zero) Building project step 'Grandchild Fail Step'... Error at Line 2, Column 1 (Division by zero) Building project step 'Child Fail Step'... Error at Line 2, Column 1 (Division by zero) Building project step 'Grandchild Fail Step'... Error at Line 2, Column 1 (Division by zero) Building project step 'Grandchild Fail Step'... Error at Line 2, Column 1 (Division by zero) Build successfully completed. It stepped thru all the steps (including the subroutine) without stopping... BTW, I am using the latest version (5.1) available... What version are you using (I don't believe there were any changes recently that would affect this, however). Kevin |
#7
|
|||
|
|||
I got the test case to work as well. I closed and reopened the project, to get a correct setting for the ignore failure flag. Then I unclicked all and re-ran and it works.
However, I am still having a problem with my real project file. I applied the same treatment. When I run it with ignore fail set, a step that executes another sub-project never completes. The log window for the subproject says build is complete, but it never shuts down the project file, and the calling project is in a wait state for it. any ideas about this one? |
#8
|
|||
|
|||
Need more details...
Ok, so it appears we have ruled out the script code marking a build's steps for Ignore Fail = True.
The issue at hand, then, is that a build is invoking another build, which is completing but not returning to the main build? Is the subBuild setting it's steps to Ignore Fail = True? Is a step 'failing' there but not continuing? You say you see in the log window that the build is complete, but it never shuts down the 'project file'. First I assume you are running both these builds in the GUI (not from a command line). When you say 'project file' are you refering to the Visual Build Pro GUI or a project that you are compiling? Please provide a little more detail on what is going wrong so we can narrow this down to a single problem... Or, ideally, can you create 2 small sample build scripts that reproduce the same error condition? That would be most helpful. Kevin |
#9
|
|||
|
|||
I've tried to narrow down a similar case with the test project, but it just doesnt fail. My real life project still fails. here is the output:
subproject doesnt close (the leave gui window open is not checked for the caller) and the master project is waiting forever. output: ===============subproject Build started at Dec 10 2003 12:40 AM Building Release: Release 1 Error: -1016 Build finished at Dec 10 2003 12:40 AM Process completed with exit code 1 Build successfully completed. ===============project Building project step 'Build Micro-Magic Products'... Building project step 'Build VC.NET MFC Toolset'... Building project step 'VC.NET MFC Dlls'... "C:\Program Files\VisBuildPro\VisBuildPro.exe" FORCE_REBUILD=1 IGNORE_FAILURE=Yes /s /b G:\scsiplus-mfc-4.0.bld |
#10
|
|||
|
|||
Try Console App mode...
Unfortunately, we have not been able to reproduce this error...
Would you be able to test running the secondary build in Console App mode? Obviously if you need to view the running sub-build during execution than this isn't an option. Having this info will help pinpoint the location of this error condition a bit more... Kevin |
#11
|
|||
|
|||
The problem doesnt occur in the cmd line mode, so at least there is a workaround
|
|
|