----- Original Message ----- From: "Rob Oxspring" <[EMAIL PROTECTED]> To: "Ant Developers List" <[EMAIL PROTECTED]> Sent: Tuesday, April 09, 2002 3:57 PM Subject: [SUBMIT] FileOrder element for ordering of filesets
> Background: > IIRC at least one of the problems with submitted concatenation tasks in the > past was that ant does not guarentee the order of files within the > concatenated file. Instead of patching one of the concat tasks (admittedly > where I started) this submission is just a utility to allow file order to be > specified by the user and applied by the task. I'm sure this is useful for > concatenation, it may also be handy for the tar/zip family of tasks and it > might also add an extra aesthetic bonus to the mail task. > > User perspective: > The idea is that tasks can be enhanced with a fileorder element that takes > an order attribute defining the order to be used when processing files. > Implementation using an attribute would involve creating an implicit > fileorder object to hold the value. Various attributes of a file can be > used to specify the order, can be reversed with a '-' prefix, and combined > with ',' symbols. Currently the supported attributes are > name|basename|extension|path|size|length|date. > > E.g. > <fileorder order="path,extension,basename"/> - group by directory and then > file extension > <fileorder order="-date"/> - decreasing date order ok, to be an XML pedant we should really have somethign verbose like <fileorder> <sort="date" direction="descending"/> <sort="size" direction="ascending"/> <sort="org.someone.newsort" direction="ascending"/> </fileorder> I know it is harder to use, but it is better than encoding magic in literals and makes XSLT rework that much easier. > How it works: > The Java2 Comparator is reimplemented and various implementations are used > to supply the ordering information. A merge sort is performed by the sort() > method, thus avoiding the Java2 dependancies of Collections.sort() or > Arrays.sort(). These should probably be revised when the move to Java2 is > made. So it works on java1.1 fine? Nice. > > Whats included: > o.a.t.a.util.FileOrder - the class doing the work. > o.a.t.a.util.compare.* - the classes doing the comparisons > > o.a.t.a.util.FileOrderTest - tests the attribute validation and general > sorting > o.a.t.a.util.compare.ComparatorTest - tests each comparator individually > So, anyone think that this is useful? is it worth me writing the docs? I think this is a nice feature, +1 on sticking it in the system with the appopriate docs and tests, though I am minded towards a more rigorous approach because it is more xml-ish, and may give more flexibilityin future. Which apps should have it? Mail, clearly; but which others? Concat? What do others think? -steve -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
