Jan, On 24/11/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I´ve played a little bit ...
thanks for playing :-) While trying to understand how your snippet works, I added inline comments (or questions, rather). > <mapper id="out" type="glob" > from="*.js" > to="dest/*.js"/> "Map" (whatever this means exactly) each file ending in .js to dest/*.js. This will be used later on. > <apply executable="jsmin"> > <fileset dir="src" includes="*.js"/> Create a fileset of all files in the src/ directory ending in .js. I guess this is represented internally as a list of absolute pathnames of all files ending .js in the src/ directory. The apply task will then cycle through this list, file by file. > <mapper refid="out"/> Now, apply the mapper defined earlier. But what does this mean exactly "apply the mapper"? When the file is to be written (output), write them to the location defined by the @to attribute of the mapper? At least, I found you can put this element anywhere inside the apply task. Another thing, I commented this line out, and the results are the same. Bizarre?! > <redirector> > <inputmapper type="glob" from="*" to="src/*"/> Ah, I guess this is the equivalent of the < standard input. Although it is rather cryptic: @from set to "*" and @to is set to "src/*", and all this in the context of the current directory, I assume? > <outputmapper refid="out"/> So, this must be the > standard output operator. Again, a reference to the mapper declared earlier. If the current file (from the fileset) ends in .js than output it to dest/*.js, as defined in the @to attribute of the mapper? > </redirector> > </apply> And it works! Wow, that's what I call black magic. Although, there's still one minor hiccup; the input filename is passed to jsmin as an argument, but where? I know this because it re-appears at the beginning of the out output file as a comment, which is what jsmin does with additional arguments. (This is why I tried to uncomment the <mapper refid="out"/> line, but to no effect.) Thanks a lot. Now, how can I contribute some documentation for this? > Jan -- cheers, Jakob. > >-----Ursprüngliche Nachricht----- > >Von: Jakob Fix [mailto:[EMAIL PROTECTED] > >Gesendet: Donnerstag, 24. November 2005 15:20 > >An: Ant Users List > >Betreff: Re: apply task trouble for command using < and > > > > >Jan, > > > >On 24/11/05, [EMAIL PROTECTED] > ><[EMAIL PROTECTED]> wrote: > >> < and > mean redirection of STDIN and STDOUT from/to file. > >> So I would have a look at nested <redirector>s. > > > >I was hoping never being required to use this element in my > >ant scripts, because they look so fiendishly difficult to use. > > Now, I've played around with them (after having to upgrade > >from 1.6.1 to 1.6.5), but I can't get my head around its > >usage. Apparently, only one redirector can be specified, but > >I have really no idea at which point inside the <apply> task, > >with which attributes, nested elements, etc. > >No examples are given in the documentation > >http://ant.apache.org/manual/CoreTypes/redirector.html > > > >I tried to add > > > ><redirector> > > <inputmapper type="identity"> > > <outputmapper type="identity"/> > ></redirector> > > > >inside the <apply> container, but am not seeing any light at > >the end of the tunnel. Please help! :-) > > > >> Jan > > > > > >-- > >cheers, > >Jakob. > > > > > >> >-----Ursprüngliche Nachricht----- > >> >Von: Jakob Fix [mailto:[EMAIL PROTECTED] > >> >Gesendet: Donnerstag, 24. November 2005 13:53 > >> >An: Ant Users List > >> >Betreff: apply task trouble for command using < and > > >> > > >> >Hello, > >> > > >> >I have the following command line (see [1] for jsmin): > >> > > >> > jsmin < bigfile.js > smallfile.js "prefix file with this comment" > >> > > >> >To do this for an entire directory I created this task: > >> > > >> ><target name="jsmin"> > >> > <apply executable="jsmin.exe" failonerror="true" > >dest="${dir.out}"> > >> > <arg value=" < "/> > >> > <srcfile/> > >> > <arg value=" > "/> > >> > <targetfile/> > >> > <arg value="${comment}"/> > >> > <fileset dir="${dir.in}" includes="*.js"/> > >> > <mapper type="identity"/> > >> > </apply> > >> ></target> > >> > > >> >This runs, but the result is not at all satisfactory: > >> >- No output is produced, > >> >- Only four lines are written to standard output as javascript > >> >comments (as jsmin would do with everything after the outfile > >> >argument). > >> > > >> >My suspicion is that the problem may be caused by the "<" and ">" > >> >characters in the command line. Could it be that they are ignored? > >> > > >> >Thanks for any idea to get this resolved. > >> > > >> > > >> >The -v output of this is: > >> > > >> >jsmin: > >> > [apply] Current OS is Windows XP > >> > [apply] DyApplication.js added as DyApplication.js > >doesn't exist. > >> > [apply] Executing > >> >'D:\Projects\dy\tests\JSMinAnt\jsmin.exe' with arguments: > >> > [apply] ' < ' > >> > [apply] 'D:\Projects\dy\tests\JSMinAnt\in\DyApplication.js' > >> > [apply] ' > ' > >> > [apply] 'D:\Projects\dy\tests\JSMinAnt\out\DyApplication.js' > >> > [apply] 'prefix file with this comment' > >> > [apply] > >> > [apply] The ' characters around the executable and arguments are > >> > [apply] not part of the command. > >> > [apply] // < > >> > [apply] // D:\Projects\dy\tests\JSMinAnt\in\DyApplication.js > >> > [apply] // > > >> > [apply] // D:\Projects\dy\tests\JSMinAnt\out\DyApplication.js > >> > [apply] // prefix file with this comment > >> > > >> > [apply] Applied D:\Projects\dy\tests\JSMinAnt\jsmin.exe to > >> >1 file and 0 directories. > >> > > >> > > >> >-- > >> >cheers, > >> >Jakob. > >> > > >> >[1] http://www.crockford.com/javascript/jsmin.html --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]