Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 352536

Summary: Default target is selected when invalid targets are passed
Product: [Eclipse Project] Platform Reporter: Krzysztof Daniel <krzysztof.daniel>
Component: AntAssignee: Satyam Kandula <satyam.kandula>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, darin.eclipse, kazm, krzysztof.daniel, Michael_Rennie, remy.suen, satyam.kandula
Version: 3.7Flags: Michael_Rennie: review+
Target Milestone: 3.8 M1   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 353220, 355614    
Attachments:
Description Flags
Proposed patch + regression test none

Description Krzysztof Daniel CLA 2011-07-20 03:37:26 EDT
If you invoke ant runner with an invalid target, the default one will be selected although the invocation was incorrect. 
This surprises the user, especially in automated environment, where build should fail fast.
Comment 1 Krzysztof Daniel CLA 2011-07-20 03:38:09 EDT
This is a tradeoff of bug 294502. There is no way to distinguish between invalid ant target and other attribute parameter.
Comment 2 Michael Rennie CLA 2011-07-21 13:00:12 EDT
Either way feels fine to me, it is nice to help the user recover (sort of) by running the default target, but I think it is more common for this to be used in the headless-automated fashion, which should fail-fast as you mentioned Christoper.
Comment 3 Satyam Kandula CLA 2011-07-25 07:50:09 EDT
Invalid targets are removed from the target list and if there are no known targets, the default target is being run. I think the default target should not be run if invalid targets are found in the command line.
Comment 4 Satyam Kandula CLA 2011-07-25 07:53:48 EDT
Created attachment 200270 [details]
Proposed patch + regression test
Comment 5 Satyam Kandula CLA 2011-07-25 07:57:14 EDT
(In reply to comment #4 and comment #3)
In the patch, the script is not run if unknown targets are specified and there is no specified target. Michael, what do you think about this approach. Please review the patch.
Comment 6 Michael Rennie CLA 2011-07-25 15:59:50 EDT
+1 the patch looks good.

I committed the patch to HEAD with some Javadoc updates + bundle version updates
Comment 7 Michael Rennie CLA 2011-07-25 16:00:19 EDT
verified
Comment 8 Dani Megert CLA 2011-07-26 04:47:34 EDT
> I committed the patch to HEAD with some Javadoc updates + bundle version
> updates

The bundle version was not updated correctly. Please read http://wiki.eclipse.org/Version_Numbering. I've fixed that in HEAD and for the upcoming I-build.
Comment 9 Michael Rennie CLA 2011-07-26 09:46:42 EDT
(In reply to comment #8) 
> The bundle version was not updated correctly. Please read
> http://wiki.eclipse.org/Version_Numbering. 

I did read it and it *was* updated correctly. The wiki states that "The minor segment number must be incremented when a plug-in changes in an "externally visible" way." which this change does - it alters the way AntRunner behaves in the case where no valid targets have been specified. In this case AntRunner is a de-facto API for running Ant from headless Eclipse...

Its fine either way, thanks for verifying Dani.