You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Rich Goldman <ri...@tinypictures.us> on 2006/07/13 23:14:50 UTC

trouble passing args to

Hello, I'm really stuck here, would be very very grateful for some help.

I'm using the ant core task <apply> successfully to process all the
files in a directory, like this:

    <target name="compress-css" depends="clean-css">
        <echo message="Compressing CSS files" />
        <mapper id="css_dir"
                type="glob"
              from="*.css"
              to="${deploy.css}/*.css"/>
        <apply executable="${tools.bin}/csstidy-1.2" failonerror="yes"
dest="${deploy.css}" verbose="yes">
            <fileset dir="${web.css.home}" includes="*.css"/>
            <mapper refid="css_dir"/>
            <redirector>
                <outputmapper refid="css_dir"/>
            </redirector>
        </apply>
        <antcall target="rename-css" />
    </target>


However, I've realized that I now need to pass an argument along to
'csstidy'. So instead of this:

    bash$  csstidy infile.js outfile.js

...it needs to look like this:

    bash$  csstidy infile.js --silent=true outfile.js

I thought the following would work, but it doesn't:

        <apply executable="${tools.bin}/csstidy-1.2" failonerror="yes"
dest="${deploy.css}" verbose="yes">

            <srcfile/>
            <arg value="-silent=true"/>
            <targetfile/>

            <fileset dir="${web.css.home}" includes="*.css"/>
            <mapper refid="css_dir"/>
            <redirector>
                <outputmapper refid="css_dir"/>
            </redirector>
        </apply>

My output files are empty when I run this. Does anyone know what I'm
doing wrong?

Muchas gracias!!
rich

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


Re: trouble passing args to

Posted by "Alexey N. Solofnenko" <A....@mdl.com>.
Can you try putting both mappers inline?

- Alexey.

Rich Goldman wrote:
> Hello, I'm really stuck here, would be very very grateful for some help.
>
> I'm using the ant core task <apply> successfully to process all the
> files in a directory, like this:
>
>     <target name="compress-css" depends="clean-css">
>         <echo message="Compressing CSS files" />
>         <mapper id="css_dir"
>                 type="glob"
>               from="*.css"
>               to="${deploy.css}/*.css"/>
>         <apply executable="${tools.bin}/csstidy-1.2" failonerror="yes"
> dest="${deploy.css}" verbose="yes">
>             <fileset dir="${web.css.home}" includes="*.css"/>
>             <mapper refid="css_dir"/>
>             <redirector>
>                 <outputmapper refid="css_dir"/>
>             </redirector>
>         </apply>
>         <antcall target="rename-css" />
>     </target>
>
>
> However, I've realized that I now need to pass an argument along to
> 'csstidy'. So instead of this:
>
>     bash$  csstidy infile.js outfile.js
>
> ...it needs to look like this:
>
>     bash$  csstidy infile.js --silent=true outfile.js
>
> I thought the following would work, but it doesn't:
>
>         <apply executable="${tools.bin}/csstidy-1.2" failonerror="yes"
> dest="${deploy.css}" verbose="yes">
>
>             <srcfile/>
>             <arg value="-silent=true"/>
>             <targetfile/>
>
>             <fileset dir="${web.css.home}" includes="*.css"/>
>             <mapper refid="css_dir"/>
>             <redirector>
>                 <outputmapper refid="css_dir"/>
>             </redirector>
>         </apply>
>
> My output files are empty when I run this. Does anyone know what I'm
> doing wrong?
>
> Muchas gracias!!
> rich
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>   

Re: trouble passing args to

Posted by Rich Goldman <ri...@tinypictures.us>.
Tell me about it, I still don't understand what's going on, but it
works, so that's good enough for me.

Thanks!
rich

Matt Benson wrote:

>Mappers can be kind of funny.  It would probably take
>a lot of research to decide whether that is a bug.  :)
>
>-Matt
>  
>


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


Re: trouble passing args to

Posted by Matt Benson <gu...@yahoo.com>.
--- Rich Goldman <ri...@tinypictures.us> wrote:

> 'ant -v' helped, thanks!
> 
> Here's a snippet of verbosity i received:
> 
>     [apply] The ' characters around the executable
> and arguments are
>     [apply] not part of the command.
>     [apply] Output redirected to
>
/home/rich/workspace/radar/server/webapp/build/webapp/css/register.css
>     [apply] Executing
>
'/home/rich/workspace/radar/tjlib/server/common/../../tools/bin/linux/csstidy-1.2'
> with arguments:
>     [apply]
>
'/home/rich/workspace/radar/server/webapp/web/css/settings.css'
>     [apply] '--silent=true'
>     [apply]
>
'/home/rich/workspace/radar/server/webapp/build/webapp/css/home/rich/workspace/radar/server/webapp/build/webapp/css/settings.css'
> 
> So I had to remove '${deploy.css}' from the <mapper>
> 'to' attribute. I
> don't know if that's a bug or not? I'm just happy it
> works now.

Mappers can be kind of funny.  It would probably take
a lot of research to decide whether that is a bug.  :)

-Matt

> 
>     <target name="compress-css" depends="clean-css">
>         <echo message="Compressing CSS files" />
>         <mapper id="css_dir"
>               type="glob"
>               from="*.css"
>               to="*.css"/>  <!-- used to be
> "${deploy.css}/*.css" -->
>         <apply executable="${tools.bin}/csstidy-1.2"
>               failonerror="yes" dest="${deploy.css}"
> verbose="yes"
> parallel="false">
>             <srcfile/>
>             <arg value="--silent=true"/>
>             <targetfile/>
>                 <fileset dir="${web.css.home}"
> includes="*.css"/>
>             <mapper refid="css_dir"/>
>             <redirector>
>                     <outputmapper refid="css_dir"/>
>             </redirector>
>         </apply>
>         <antcall target="rename-css" />
>     </target>
> 
> 
> 
> 
> Matt Benson wrote:
> 
> >--- Rich Goldman <ri...@tinypictures.us> wrote:
> >
> >  
> >
> >>Hi, no, that's not it, unfortunately. I just
> noticed
> >>that myself, but it
> >>looks I deleted it by accident in the email, not
> the
> >>code itself.
> >>    
> >>
> >
> >You can run Ant with the -v "verbose" flag to see
> the
> >command lines generated.
> >
> >-Matt
> >
> >  
> >
> >>Matt Benson wrote:
> >>
> >>    
> >>
> >>>>My output files are empty when I run this. Does
> >>>>anyone know what I'm
> >>>>doing wrong?
> >>>>
> >>>>   
> >>>>
> >>>>        
> >>>>
> >>>The first thing I notice is that your commandline
> >>>example was --silent=true, but your <arg> element
> >>>shows "-silent=true".  Could that be it?
> >>>
> >>>-Matt
> >>>
> >>> 
> >>>
> >>>      
> >>>
> >>
> >>    
> >>
>
>---------------------------------------------------------------------
> >  
> >
> >>To unsubscribe, e-mail:
> >>user-unsubscribe@ant.apache.org
> >>For additional commands, e-mail:
> >>user-help@ant.apache.org
> >>
> >>
> >>    
> >>
> >
> >
> >__________________________________________________
> >Do You Yahoo!?
> >Tired of spam?  Yahoo! Mail has the best spam
> protection around 
> >http://mail.yahoo.com 
> >
>
>---------------------------------------------------------------------
> >To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> >For additional commands, e-mail:
> user-help@ant.apache.org
> >
> >  
> >
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: trouble passing args to

Posted by Rich Goldman <ri...@tinypictures.us>.
'ant -v' helped, thanks!

Here's a snippet of verbosity i received:

    [apply] The ' characters around the executable and arguments are
    [apply] not part of the command.
    [apply] Output redirected to
/home/rich/workspace/radar/server/webapp/build/webapp/css/register.css
    [apply] Executing
'/home/rich/workspace/radar/tjlib/server/common/../../tools/bin/linux/csstidy-1.2'
with arguments:
    [apply] '/home/rich/workspace/radar/server/webapp/web/css/settings.css'
    [apply] '--silent=true'
    [apply]
'/home/rich/workspace/radar/server/webapp/build/webapp/css/home/rich/workspace/radar/server/webapp/build/webapp/css/settings.css'

So I had to remove '${deploy.css}' from the <mapper> 'to' attribute. I
don't know if that's a bug or not? I'm just happy it works now.

    <target name="compress-css" depends="clean-css">
        <echo message="Compressing CSS files" />
        <mapper id="css_dir"
              type="glob"
              from="*.css"
              to="*.css"/>  <!-- used to be "${deploy.css}/*.css" -->
        <apply executable="${tools.bin}/csstidy-1.2"
              failonerror="yes" dest="${deploy.css}" verbose="yes"
parallel="false">
            <srcfile/>
            <arg value="--silent=true"/>
            <targetfile/>
                <fileset dir="${web.css.home}" includes="*.css"/>
            <mapper refid="css_dir"/>
            <redirector>
                    <outputmapper refid="css_dir"/>
            </redirector>
        </apply>
        <antcall target="rename-css" />
    </target>




Matt Benson wrote:

>--- Rich Goldman <ri...@tinypictures.us> wrote:
>
>  
>
>>Hi, no, that's not it, unfortunately. I just noticed
>>that myself, but it
>>looks I deleted it by accident in the email, not the
>>code itself.
>>    
>>
>
>You can run Ant with the -v "verbose" flag to see the
>command lines generated.
>
>-Matt
>
>  
>
>>Matt Benson wrote:
>>
>>    
>>
>>>>My output files are empty when I run this. Does
>>>>anyone know what I'm
>>>>doing wrong?
>>>>
>>>>   
>>>>
>>>>        
>>>>
>>>The first thing I notice is that your commandline
>>>example was --silent=true, but your <arg> element
>>>shows "-silent=true".  Could that be it?
>>>
>>>-Matt
>>>
>>> 
>>>
>>>      
>>>
>>
>>    
>>
>---------------------------------------------------------------------
>  
>
>>To unsubscribe, e-mail:
>>user-unsubscribe@ant.apache.org
>>For additional commands, e-mail:
>>user-help@ant.apache.org
>>
>>
>>    
>>
>
>
>__________________________________________________
>Do You Yahoo!?
>Tired of spam?  Yahoo! Mail has the best spam protection around 
>http://mail.yahoo.com 
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>For additional commands, e-mail: user-help@ant.apache.org
>
>  
>


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


Re: trouble passing args to

Posted by Matt Benson <gu...@yahoo.com>.

--- Rich Goldman <ri...@tinypictures.us> wrote:

> Hi, no, that's not it, unfortunately. I just noticed
> that myself, but it
> looks I deleted it by accident in the email, not the
> code itself.

You can run Ant with the -v "verbose" flag to see the
command lines generated.

-Matt

> 
> Matt Benson wrote:
> 
> >
> >>My output files are empty when I run this. Does
> >>anyone know what I'm
> >>doing wrong?
> >>
> >>    
> >>
> >The first thing I notice is that your commandline
> >example was --silent=true, but your <arg> element
> >shows "-silent=true".  Could that be it?
> >
> >-Matt
> >
> >  
> >
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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


Re: trouble passing args to

Posted by Rich Goldman <ri...@tinypictures.us>.
Hi, no, that's not it, unfortunately. I just noticed that myself, but it
looks I deleted it by accident in the email, not the code itself.

Matt Benson wrote:

>
>>My output files are empty when I run this. Does
>>anyone know what I'm
>>doing wrong?
>>
>>    
>>
>The first thing I notice is that your commandline
>example was --silent=true, but your <arg> element
>shows "-silent=true".  Could that be it?
>
>-Matt
>
>  
>


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


Re: trouble passing args to

Posted by Matt Benson <gu...@yahoo.com>.
--- Rich Goldman <ri...@tinypictures.us> wrote:

> Hello, I'm really stuck here, would be very very
> grateful for some help.
> 
> I'm using the ant core task <apply> successfully to
> process all the
> files in a directory, like this:
> 
>     <target name="compress-css" depends="clean-css">
>         <echo message="Compressing CSS files" />
>         <mapper id="css_dir"
>                 type="glob"
>               from="*.css"
>               to="${deploy.css}/*.css"/>
>         <apply executable="${tools.bin}/csstidy-1.2"
> failonerror="yes"
> dest="${deploy.css}" verbose="yes">
>             <fileset dir="${web.css.home}"
> includes="*.css"/>
>             <mapper refid="css_dir"/>
>             <redirector>
>                 <outputmapper refid="css_dir"/>
>             </redirector>
>         </apply>
>         <antcall target="rename-css" />
>     </target>
> 
> 
> However, I've realized that I now need to pass an
> argument along to
> 'csstidy'. So instead of this:
> 
>     bash$  csstidy infile.js outfile.js
> 
> ...it needs to look like this:
> 
>     bash$  csstidy infile.js --silent=true
> outfile.js
> 
> I thought the following would work, but it doesn't:
> 
>         <apply executable="${tools.bin}/csstidy-1.2"
> failonerror="yes"
> dest="${deploy.css}" verbose="yes">
> 
>             <srcfile/>
>             <arg value="-silent=true"/>
>             <targetfile/>
> 
>             <fileset dir="${web.css.home}"
> includes="*.css"/>
>             <mapper refid="css_dir"/>
>             <redirector>
>                 <outputmapper refid="css_dir"/>
>             </redirector>
>         </apply>
> 
> My output files are empty when I run this. Does
> anyone know what I'm
> doing wrong?
> 
The first thing I notice is that your commandline
example was --silent=true, but your <arg> element
shows "-silent=true".  Could that be it?

-Matt

> Muchas gracias!!
> rich
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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