Re: Last Sequential File

2004-01-02 Thread Gilles Dodinet
Jake Ewerdt wrote:

I've looked through ant, jelly, and maven documentation, but I couldn't find an easier way to do this.  Any ideas?

Perhaps you could create a Jelly Tag with one attribute - the directory 
to look in - that would grab the date thanks a FileFilter and then put 
it in the context ?

-- gd

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Last Sequential File

2004-01-02 Thread Jake Ewerdt
I'm currenly working on moving a build system that comprises mainly of shell scripts 
to maven.  One of the things that the current system does is create a changelog file 
(changelog.${build.number}) that contains all CVS commit logs since the last release.  
We use build numbers, but releases are around every 100 builds, so the number is not 
sequential.

The code I have currently works, but it's not easy to understand and it seems like 
there should be an easier way.  Below is an example goal that works! and gets the last 
modified time from the last sequential file, which in my build process is used to get 
commit log entries from CVS.


--project.xml snippet---


  ant
  ant-apache-bsf
  1.6
  root
  http://jakarta.apache.org/bsf/



  bsf
  bsf
  2.2
  root
  http://www-124.ibm.com/developerworks/projects/bsf



  rhino
  js
  1.5R4-RC3
  root
  http://www.mozilla.org/rhino/



--maven.xml snippet--
  






 <![CDATA[
  project.setProperty("count", 
files.getDirectoryScanner(project).getIncludedFiles().length);
]]> 



  



  
   <![CDATA[
srcFiles = files.getDirectoryScanner(project).getIncludedFiles();
filename = new java.lang.String(srcFiles[0]);
for (i = 1; i != srcFiles.length; i++) {
  var j = filename.compareTo(srcFiles[i]);
  // the jelly parser can't have a greater than or less than sign or ampersand 
in the script section?
  if (j != 0) if (j != Math.abs(j)) filename = srcFiles[i];
}
project.setProperty("file", filename);
  ]]> 

  
  
  
  

  
   <![CDATA[
importClass(java.lang.Long);
importClass(java.text.SimpleDateFormat);
var formatter = new java.text.SimpleDateFormat("-MM-dd HH:mm");
project.setProperty("from", formatter.format(new 
java.util.Date(Long.parseLong(project.getProperty("mseconds");
  ]]> 

  

  

--END--


I've looked through ant, jelly, and maven documentation, but I couldn't find an easier 
way to do this.  Any ideas?

-jake


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]