ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jacob Beard <>
Subject convert ant path without assigning to immutable property
Date Fri, 20 Aug 2010 20:32:15 GMT

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/">
       <pathelement  location="${basedir}/lib/build-java/ant-contrib-0.6.jar"  />

   <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"/>
     <!-- ... -->

   <!-- the macro call java with specific arguments -->
   <macrodef  name="compile-with-scxml-js">
     <attribute  name="backend"/>
     <attribute  name="test-path"/>
     <attribute  name="out-path"/>

       <java  classname=""  output="@{out-path}">
           <pathelement  location="lib/java/js.jar"/>
            <!-- ... -->
         <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}"/>

   <!-- run unit and performance tests -->
   <target  name="generate-javascript">

     <for  list="${for-ie}"  param="for-ie">
         <for  list="${backends}"  param="backend">
             <for  param="test-path">
               <path  refid="scxml-tests-xml"/>

                 <!-- do some manipulation -->
                 <pathconvert  property="target-test-path">
                   <path  path="@{test-path}"/>
                     <globmapper  from="*.xml"  to="build/@{backend}/@{for-ie}/*.js"/>

                 <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}"/>



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, 

I'd appreciate any guidance anyone can offer. Thanks,


PS: I've also posted this question on Stack Overflow:

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