ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ken Gentle <j.kenneth.gen...@acm.org>
Subject NOT A SOLUTION: Modifying a DirSet (or any AbstractFileSet) from within a <script>
Date Sat, 13 Sep 2003 14:44:24 GMT
My apologies for posting something with insufficient testing.  The code 
below executes cleanly, but the JavaScript subclass of DirectoryScanner 
does not appear to actually replace the DirectoryScanner for the FileSet.

On Windows, the fileset appears to always come out in alpha-numeric, 
ascending order, so even though I munged the order within the Javascript 
before sorting, it always appeared sorted.  I mistakenly thought that meant 
it was working.

Dominique and I independently tried some variations (like reverse order, or 
sorting on file size), and none of these have worked.

I'm still pursuing an answer to this issue, working with a Java extension 
to the base fileset.

Arghh!  This seemed like such a simple problem, too.

         Ken


At 08:03 2003-09-11, you wrote:
>At 01:57 AM 9/11/2003, you wrote:
>
>>By default only the "java" package is imported. So you have
>>to import that special class or the whole package with
>>     importClass(Package.org.apache.tools.ant.DirectoryScanner);
>
>I caught this right before I left last night.  Importing the class 
>resolved that problem, just as you've described.
>
>>I will update the doc about this error message.
>
>Cool...
>
>
>>Where I can get more infos about the adapter?
>
>I found the only documentation to JavaAdapter in the 
>netscape.public.mozilla.jseng forum 
>(http://groups.google.com/groups?q=JavaAdapter+group:netscape.public.mozilla.jseng+group:netscape.public.mozilla.jseng&hl=en&lr=&ie=UTF-8&oe=UTF-8&newwindow=1&group=netscape.public.mozilla.jseng&selm=391EEC3C.5236D929%40yahoo.com&rnum=1)
>
>
>My current solution looks like this:
>
>     <script language="javascript">
>       <![CDATA[
>         importPackage(Packages.java.lang);
>       prj = self.getProject();
>       dirset = prj.getReference("dirset.qa.releases");
>
>       scanner = dirset.getDirectoryScanner(prj);
>       fromDir = dirset.getDir(prj);
>       srcDirs = scanner.getIncludedDirectories();
>
>       obj = { getIncludedDirectories:
>         function(){
>           importPackage(Packages.java.util);
>           incDirs = super$getIncludedDirectories();
>           Arrays.sort(incDirs);
>           return incDirs;
>         }
>       };
>
>       importClass(Packages.org.apache.tools.ant.DirectoryScanner);
>       sordidScanner = new JavaAdapter (DirectoryScanner,obj);
>       dirset.setupDirectoryScanner (sordidScanner, prj);
>       ]]>
>     </script>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org

=============================================================
J. Kenneth Gentle (Ken)    | Phone: (610) 255-0361
Gentle Software, LLC       | Email: j.kenneth.gentle@acm.org
=============================================================


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message