Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 328246 - Under Windows build doesn't stop if sub-project builds or tests fail
Summary: Under Windows build doesn't stop if sub-project builds or tests fail
Status: CLOSED FIXED
Alias: None
Product: Virgo
Classification: RT
Component: virgo-build (show other bugs)
Version: 2.1.0.M06-incubation   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Steve Powell CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-20 10:11 EDT by Steve Powell CLA
Modified: 2010-10-21 07:54 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steve Powell CLA 2010-10-20 10:11:59 EDT
After correcting the permgen execution problem by making sub-projects run under a new shell (using <exec .."ant">) we changed this under windows to run "ant.bat".  This works fine, except that, under Windows, the ERRORLEVEL appears to be lost -- so we cannot abort the build if a step fails (normal practice).
Comment 1 Steve Powell CLA 2010-10-20 12:44:22 EDT
Lots of tests tried here:

1) Fixed problem with failonerror set to true (it should be set to false and the returncode checked explicitly.
-- BUT WINDOWS ant.bat returns 0   :-(  when it should return 1 on failure.

2) Tried calling ant.bat via cmd.exe /c (advice from ant website/blogs)
-- WINDOWS gives return code 0.

3) Investigated using <ant> task instead of <subant> but cannot iterate through projects easily, and it probably suffers from the same problem as direct <subant>  (viz. permgen problems caused by ivy).

4) Tried various options on cmd.exe to get ERRORLEVEL back (ERRORLEVEL is properly set, I think).
-- exec seems incapable of getting the value back.

I'm leaving this problem open and asking any interested parties to see if they can find a solution.
Comment 2 Steve Powell CLA 2010-10-20 13:08:14 EDT
Committed changes to virgo-build at version 1.34:

SHA:	676173b3a40ddbe0de4820ea1653b4e1fd181287
Author:	Steve Powell <spowell@vmware.com>
Date:	Wed Oct 20 2010 17:13:16 GMT+0100 (BST)
Subject:	Tidy up exec-ant target to diagnose return codes.
Comment 3 Steve Powell CLA 2010-10-20 13:13:31 EDT
Pushed virgo-build 1.34 to all master repositories.
Comment 4 Steve Powell CLA 2010-10-20 13:25:46 EDT
Pushed virgo-build 1.34 to 2.1.x branches (and connected).  This change does not affect shipped code.
Comment 5 Hristo Iliev CLA 2010-10-21 02:35:16 EDT
The search returned a proposal for wrapping the execution in batch file(s). This is proposed here:

http://stackoverflow.com/questions/1456979/why-does-ant-bat-not-return-an-error-status-when-run-programmatically

However this workaround looks quite ugly...
Comment 6 Steve Powell CLA 2010-10-21 07:11:56 EDT
(In reply to comment #5)
Hristo,
   I had already seen that solution, thank you, and rejected it for ugly reasons and since it required
  us to supply two bat files to the build.

  However, after exhausting many other solutions I returned to this one and determined to find out why it might work.  I found out that a single bat file works well.

  This means that my solution is now going in to virgo-build 1.35.  Thanks for the work.
Comment 7 Steve Powell CLA 2010-10-21 07:19:03 EDT
SHA:	a88282f1b0fddde381c33ed4866648cc9ef33b57
Author:	Steve Powell <spowell@vmware.com>
Date:	Thu Oct 21 2010 12:15:32 GMT+0100 (BST)
Subject:	Solves Bug 328246 - Windows ant builds do not stop when jar or test.do fails in subproject.
Refs:	master; origin/HEAD; origin/master; 1.35
Comment 8 Steve Powell CLA 2010-10-21 07:23:02 EDT
Updated all 2.1.x repo branches (and gemini-web-container 1.1.x) to use virgo-build 1.35.
Comment 9 Steve Powell CLA 2010-10-21 07:54:24 EDT
Updated all master repo branches to use virgo-build 1.35.