开发者

Converting ../ in paths in Ant

开发者 https://www.devze.com 2022-12-13 13:12 出处:网络
I have an Ant build that has this line in it: WORKSPACE.dir = ${basedir}/../ I then have: CORE_PROJECT.dir= ${WORKSPACE.dir}/UUI_Core

I have an Ant build that has this line in it:

WORKSPACE.dir = ${basedir}/../

I then have:

CORE_PROJECT.dir= ${WORKSPACE.dir}/UUI_Core

which means that I end up with paths like this:

C:\dev\workspaces\RTC\UUI_Core_ANT/..//UUI_Core

This works fine in almost all cases but I am trying to build a list of classes to be used in a build. At the moment I have this code:

<pathconvert 
    property="coreClasses" 
    pathsep=" " 
    dirsep="." 
    refid="coreSources">
    <map from="C:\dev\workspaces\RTC\UUI_Core\src\" to="" />
    <mapper>
        <chainedmapper>
            <globmapper from="*.mxml" to="*"/>
        </chainedmapper>
        <chainedmapper>
            <globmapper from="*.as" to="*"/>
        </chainedmapper>
    </mapper>
</pathconvert>

Which does the job of removing the file location and jsut leaving the package structure. 开发者_如何学CIt is not very flexible though. I should be able to use CORE_PROJECT.dir here.

So, how can I convert

C:\dev\workspaces\RTC\UUI_Core_ANT/..//UUI_Core

to

C:\dev\workspaces\RTC\UUI_Core


WORKSPACE.dir = ${basedir}/../

This is not a valid Ant syntax.

To convert .. you should use location attribute of the <property> task instead of value. location substitutes the attribute value with an absolute path. In your case:

<property name="WORKSPACE.dir" location="${basedir}/.."/>

EDIT: I should add, always use location attribute when setting path-like properties.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号