Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 348432 - Add support for individual element validation to Autoconf parser
Summary: Add support for individual element validation to Autoconf parser
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Autotools (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Jeff Johnston CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-06 12:18 EDT by Sami Wagiaalla CLA
Modified: 2011-06-16 17:23 EDT (History)
0 users

See Also:


Attachments
Add support for individual element validation. (14.64 KB, patch)
2011-06-06 12:18 EDT, Sami Wagiaalla CLA
no flags Details | Diff
Add support for individual element validation. (20.40 KB, patch)
2011-06-07 11:44 EDT, Sami Wagiaalla CLA
no flags Details | Diff
Add support for individual element validation. (20.88 KB, patch)
2011-06-07 16:53 EDT, Sami Wagiaalla CLA
no flags Details | Diff
Add support for individual element validation. (22.91 KB, patch)
2011-06-10 10:30 EDT, Sami Wagiaalla CLA
jjohnstn: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sami Wagiaalla CLA 2011-06-06 12:18:01 EDT
Created attachment 197417 [details]
Add support for individual element validation.

The autoconf parser does not allow individual elements to validate their arguments.

I am attaching a patch which adds that support and uses it in validating AC_INIT as an example use case.
Comment 1 Andrew Overholt CLA 2011-06-06 14:43:56 EDT
Thanks for the patch, Sami!  I like where this is going.  There are some unnecessary blank line additions and some minor indentation changes (perhaps they're corrections?) but otherwise it looks pretty good.  I'll let Jeff do a full review.
Comment 2 Jeff Johnston CLA 2011-06-06 15:11:53 EDT
Comment on attachment 197417 [details]
Add support for individual element validation.

1. AcInitElement should base it's logic on the current Autoconf Editor version in project properties.  2.13 means one argument which is a file or directory that exists in the top-level directory.  2.59 and higher means first argument is project name, 2nd argument is version number and there may be two additional optional arguments (e.g. 3 or 4 arguments total).

2. Error names should be less generic (badProjectName and badVersionNumber for example).

3. Bad version number message should have "be a version number" not "must the version number".

4. "AC_INIT" string being compared to should be denoted with //$NON-NLS-1$

Other than that looks good and you provided a ChangeLog entry.
Comment 3 Sami Wagiaalla CLA 2011-06-07 11:44:06 EDT
Created attachment 197510 [details]
Add support for individual element validation.

- Made macro validation aware of current version
- Removed incorrect validation of first argument (no restrictions)
- Removed misc new lines changes.
- Improved error message names.
Comment 4 Sami Wagiaalla CLA 2011-06-07 11:46:11 EDT
(In reply to comment #1)
> Thanks for the patch, Sami!  I like where this is going.  There are some
> unnecessary blank line additions and some minor indentation changes (perhaps
> they're corrections?)

Most were just artefacts, AutoconfMacro was intentional as indicated in the Changelog. All clean up now.
Comment 5 Sami Wagiaalla CLA 2011-06-07 16:53:46 EDT
Created attachment 197543 [details]
Add support for individual element validation.

- Use plugin default when version property is not set
Comment 6 Jeff Johnston CLA 2011-06-08 17:01:02 EDT
Comment on attachment 197543 [details]
Add support for individual element validation.

Looks good.  Only remaining comment I would have would be to add a simple Comparator class for the version strings.  That way, the AC_INIT macro can check for >=2.59 rather than hard-code the two latest current choices.  This means no updating required if a new version gets added.  The Comparator could simply compare the first numeral and then the second following the decimal-point (e.g. "2.61" > "2.59", "2.61" < "2.129").
Comment 7 Sami Wagiaalla CLA 2011-06-10 10:30:02 EDT
Created attachment 197786 [details]
Add support for individual element validation.

- Added requested VersionComparator class to be used for version comparison
Comment 8 Jeff Johnston CLA 2011-06-10 13:48:03 EDT
(In reply to comment #7)
> Created attachment 197786 [details]
> Add support for individual element validation.
> 
> - Added requested VersionComparator class to be used for version comparison

Looks good.  Thanks.
Comment 9 Jeff Johnston CLA 2011-06-16 17:23:31 EDT
Code checked in to repository.  Thanks.