ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Beard <jbea...@cs.mcgill.ca>
Subject Re: convert ant path without assigning to immutable property
Date Sat, 21 Aug 2010 02:50:55 GMT
Great, thanks!

Jake

On 10-08-20 05:07 PM, Peter Reilly wrote:
> you can use<local>  from ant 1.8 onwards.
>                 <local name="target-test-path"/>
>                 <pathconvert  property="target-test-path">
>                   <path  path="@{test-path}"/>
>                   <chainedmapper>
>                     <flattenmapper/>
>                     <globmapper  from="*.xml"
> to="build/@{backend}/@{for-ie}/*.js"/>
>                   </chainedmapper>
>                 </pathconvert>
>
>                 <local name="target-test-path-dir"/>
>                 <dirname  property="target-test-path-dir"
> file="${target-test-path}"/>
>
> http://ant.apache.org/manual/Tasks/local.html
>
> Peter
> On Fri, Aug 20, 2010 at 9:32 PM, Jacob Beard<jbeard4@cs.mcgill.ca>  wrote:
>    
>> Hi,
>>
>> I have a situation where I have a path with a number of path segments, and,
>> for each path segment, I need to transform that path segment (presumably
>> using a mapper), and then pass the original path segment AND the transformed
>> path segment to a macro.
>>
>> The problem is that it's not clear to me how to transform the path, without
>> assigning the transformed path to an immutable property.
>>
>> The slightly simplified build file is below.
>>
>> |<?xml version="1.0"  encoding="ISO-8859-1"?>
>> <project  name="scxml-js"  basedir="."  default="generate-javascript">
>>   <taskdef  resource="net/sf/antcontrib/antcontrib.properties">
>>     <classpath>
>>       <pathelement  location="${basedir}/lib/build-java/ant-contrib-0.6.jar"
>>   />
>>     </classpath>
>>   </taskdef>
>>
>>   <property  name="backends"  value="switch,table,state"/>
>>   <property  name="browsers"  value="firefox,ie,chrome"/>
>>   <property  name="for-ie"  value="is-for-ie,is-not-for-ie"/>
>>
>>   <path  id="scxml-tests-xml">
>>     <pathelement  location="test/kitchen_sink/KitchenSink.xml"/>
>>     <pathelement  location="test/kitchen_sink/KitchenSink_dataModule.xml"/>
>>     <!-- ... -->
>>   </path>
>>
>>   <!-- the macro call java with specific arguments -->
>>   <macrodef  name="compile-with-scxml-js">
>>     <attribute  name="backend"/>
>>     <attribute  name="test-path"/>
>>     <attribute  name="out-path"/>
>>
>>     <sequential>
>>       <java  classname="org.mozilla.javascript.tools.shell.Main"
>>   output="@{out-path}">
>>         <classpath>
>>           <pathelement  location="lib/java/js.jar"/>
>>            <!-- ... -->
>>         </classpath>
>>         <arg  value="${basedir}/runner.js"/>
>>         <arg  value="${basedir}"/>
>>         <arg  value="src/javascript/scxml/cgf/main"/>
>>
>>         <arg  value="--backend=@{backend}"/>
>>         <arg  value="--beautify"/>
>>         <arg  value="--ie"/>
>>         <arg  value="@{test-path}"/>
>>       </java>
>>     </sequential>
>>   </macrodef>
>>
>>   <!-- run unit and performance tests -->
>>   <target  name="generate-javascript">
>>
>>     <for  list="${for-ie}"  param="for-ie">
>>       <sequential>
>>         <for  list="${backends}"  param="backend">
>>           <sequential>
>>             <for  param="test-path">
>>               <path  refid="scxml-tests-xml"/>
>>               <sequential>
>>
>>                 <!-- do some manipulation -->
>>                 <pathconvert  property="target-test-path">
>>                   <path  path="@{test-path}"/>
>>                   <chainedmapper>
>>                     <flattenmapper/>
>>                     <globmapper  from="*.xml"
>>   to="build/@{backend}/@{for-ie}/*.js"/>
>>                   </chainedmapper>
>>                 </pathconvert>
>>
>>                 <dirname  property="target-test-path-dir"
>>   file="${target-test-path}"/>
>>
>>                 <echo>${target-test-path}, ${target-test-path-dir}</echo>
>>
>>                 <!-- execute some tasks, call a macro -->
>>
>>                 <mkdir  dir="${target-test-path-dir}"/>
>>
>>                 <compile-with-scxml-js-ie
>>                   test-path="@{test-path}"
>>                   backend="@{backend}"
>>                   out-path="${target-test-path}"/>
>>               </sequential>
>>             </for>
>>           </sequential>
>>         </for>
>>       </sequential>
>>     </for>
>>   </target>
>>
>> </project>
>> |
>>
>> Because target-test-path and target-test-path-dir will only be assigned to
>> once, this will repeatedly echo the following:
>> [echo] build/switch/is-for-ie/KitchenSink.js,
>> /home/jacob/workspace/gsoc2010/git-scxml-js/scxml-js/build/switch/is-for-ie
>>
>> I'd appreciate any guidance anyone can offer. Thanks,
>>
>> Jake
>>
>> PS: I've also posted this question on Stack Overflow:
>> http://stackoverflow.com/questions/3534659/convert-ant-path-without-assigning-to-immutable-property
>>
>>
>>      
> ---------------------------------------------------------------------
> 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


Mime
View raw message