Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 352536 - Default target is selected when invalid targets are passed
Summary: Default target is selected when invalid targets are passed
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Ant (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.8 M1   Edit
Assignee: Satyam Kandula CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 353220 355614
  Show dependency tree
 
Reported: 2011-07-20 03:37 EDT by Krzysztof Daniel CLA
Modified: 2011-08-29 10:32 EDT (History)
7 users (show)

See Also:
Michael_Rennie: review+


Attachments
Proposed patch + regression test (6.14 KB, patch)
2011-07-25 07:53 EDT, Satyam Kandula CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.