Thanks for your reaction. I completely agree that it might be undesirable to get a list of all the targets in a build.xml file.
But this is why I also suggested (it's not in the patch I submitted) to add a 'private' attribute to targets. This should prevent the target from being used as a primary target in your ant invocation, but restrict its use to 'depends' clauses. The list that '-targets' generates should then contain only the targets where 'private' is 'false' or unset. The 'help' element you mention provides exactly the kind of information I was looking for to add to the list of targets. Would it be useful if I tried to implement my ideas? Regards, Marcel Schutte > -----Original Message----- > From: Conor MacNeill [mailto:[EMAIL PROTECTED] > Sent: maandag 14 augustus 2000 13:37 > To: [EMAIL PROTECTED] > Subject: RE: [PATCH] Suggestion for new commandline switch -targets > > > Marcel, > > My own feeling about this patch is to ask why you don't just read the > build.xml file? Then again, not everyone thinks the way I do :-) > I have seen > some people saying that they have big build files and need this facility. > If, however, a build file is big (and presumably complex), I wonder if > giving a list of targets might not be a little dangerous, as in "a little > knowledge is a dangeroud thing". > > In the end, there is not much semantic content in a target name and users > may be tempted to guess what targets do, with surprising results. Do you > really want users to start executing targets when they aren't > familiar with > the build file. Perhaps this sort of information may be better provided in > documentation accompanying the build file rather than trying to extract > meaningful documentation purely based on the target names. > > We had another discussion once about including a <help> or <about> element > in a project which would display information about the build file. This > concept could be extended to include help about particular targets. > Something like > > <target name="upgrade"> > <help>Don't use this target as it will erase your operating > system</help> > <erase_os> > </target> > > Thoughts? > > Conor > > > > -----Original Message----- > > From: Marcel Schutte [mailto:[EMAIL PROTECTED] > > Sent: Monday, 14 August 2000 7:34 > > To: [EMAIL PROTECTED] > > Subject: [PATCH] Suggestion for new commandline switch -targets > > > > > > Reposted with my suggestion in a diff file. Also, see comments below. > > > > > -----Original Message----- > > > From: Christopher Elkins [mailto:[EMAIL PROTECTED] > > > Sent: zondag 13 augustus 2000 22:59 > > > To: [EMAIL PROTECTED] > > > Subject: Re: Suggestion for new commandline switch -targets > > > > > > > > > > Hi, > > > > > > > > In the attached version of Main.java there are some simple > > modifications > > > > which make ant recognize a -targets option. > > > > > > > > This will print out a list of all the targets available in > > the selected > > > > build-file. It is meant as some sort of documentation on what > > > the build-file > > > > can do. Execution is suppressed. > > > > > > > > Do you guys like this suggestion, and if so, how do I go about > > > incorporating > > > > it in ant? > > > > > > > First, you should submit your patch in diff form > > > <http://jakarta.apache.org/guidelines/source.html>. It makes it > > > much easier to > > > evaluate. > > > > > > Second, I think this would be a useful addition. Many ant-using > > > projects create > > > their own targets (e.g., "usage") to provide similar > > functionality as your > > > patch. Standardizing such behavior would be a very good thing. > > > > > > However, not all targets in a build file are suitable and/or > > relevant for > > > calling from the command-line. For example, calling the "prepare" > > > target in > > > jakarta-ant/build.xml from the command-line would have > limited utility. > > > Therefore, it might be useful to add an attribute to the > > <target> tag that > > > allowed one to specify whether that target should be output in > > > Main.printTargets(). > > > > Or perhaps a 'private' attribute, which can make a target > > invisible from the > > outside and only visible to 'depends' clauses. > > Another optional attribute could be 'description', to be printed > > as part of > > the target list. > > Let me know what you think of this, > > > > > > > > > Regards, > > > > Marcel Schutte > > > > > > > > > > -- > > > Christopher Elkins > > > > > > > > Regards, > > Marcel Schutte > > > >
