ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan.Mate...@rzf.fin-nrw.de
Subject AW: AW: load property from refid
Date Fri, 09 May 2003 08:53:53 GMT
I am using the Javadoc of Ant.
I look into the implementation of <script>
(...taskdefs.optional.Script.java)
shows that there are several named objects available:
- project		a reference to the project
  You can also use the value of the name attribute: <project
name="thisvalue"/>
- self		a reference to the <script> task itself

Usually I start on project and do my work with Javascript. You can create
tasks with
project.createTask() and their values with appropriate setters. Calling the
perform()
method does its work.
	mytask = project.createTask("echo");
	mytask.setMessage("This is a dynamic task");
	mytask.perform();

Doco - good hint. Maybe I can spend some time for improving that.



Jan
	


> -----Urspr√ľngliche Nachricht-----
> Von: mmocek@cleverlance.com [mailto:mmocek@cleverlance.com]
> Gesendet am: Donnerstag, 8. Mai 2003 22:01
> An: Ant Users List
> Betreff: Re: AW: load property from refid
> 
> Thanks a lot. I've used <concat> and it works great.
> I'm also planning to use similar script in future targets, so 
> you have saved me 
> a lot of time. 
> 
> Is there some good manual about scripting?
> (I have all the required jars, it works, but I'm not sure 
> what I can use. 
> Description, API, something..)
> 
> Mirek 
> 
> Quoting Jan.Materne@rzf.fin-nrw.de:
> 
> > > -----Urspr√ľngliche Nachricht-----
> > > Von: Stefan Bodewig [mailto:bodewig@apache.org]
> > > Gesendet am: Mittwoch, 7. Mai 2003 08:41
> > > An: user@ant.apache.org
> > > Betreff: Re: load property from refid
> > > 
> > > On Wed, 7 May 2003, Jan Materne 
> <Jan.Materne@rzf.fin-nrw.de> wrote:
> > > 
> > > > I played a little bit around. Solution: create a temporary 
> > > > property file using <concat> and load that.
> > > 
> > > Neat.
> > > 
> > > Stefan
> > 
> > 
> > Thanx :-)
> > 
> > 
> > Using <script> works, too, as you said:
> > 
> >         <fileset id="fs" dir="." includes="*.properties"/>
> >         <script language="javascript"> <![CDATA[
> >             // reference to the project
> >             prj = self.getProject();
> > 
> >             // get a directory scanner
> >             ds = fs.getDirectoryScanner(prj);
> > 
> >             // iterate over the file
> >             propFiles = ds.getIncludedFiles();
> >             for (i=0; i<propFiles.length; i++) {
> >                 load = prj.createTask("property");
> >                 file = new java.io.File(propFiles[i]);
> >                 load.setFile(file);
> >                 load.perform();
> >             }
> >         ]]>
> >         </script>
> > 
> > 
> > 
> > Jan
> > 
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message