有条件地在mxmlc / compc ant任务中包含Flex库(SWC) [英] Conditionally including Flex libraries (SWCs) in mxmlc/compc ant tasks

查看:214
本文介绍了有条件地在mxmlc / compc ant任务中包含Flex库(SWC)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在努力想弄清楚如何有条件地将Flex库包含在基于在命令行中设置的属性的ant版本中。我已经用< condition /> 任务尝试了很多方法,但到目前为止还没有得到它的工作。这里是我目前的地方。

我有一个init目标,包括这样的条件任务:

 < condition property =automation.libsvalue =automation.qtp> 
<等于arg1 =$ {automation}arg2 =qtpcasesensitive =falsetrim =true/>
< / condition>

这个任务的目的是设置一个属性来确定当使用的模式集的名字在mxmlc或compc任务上声明隐式文件集。上面引用的模式集定义为:

 < patternset id =automation.qtp> 
< include name =automation * .swc/>
< include name =qtp.swc/>
< / patternset>

命名的模式集随后被mxmlc或compc任务引用,如下所示:

 < compc> 
< compiler.include-libraries dir =$ {FLEX_HOME} / frameworks / libsappend =true>
< patternset refid =$ {automation.libs}/>
< / compc>

这似乎不起作用。至少SWC大小并不表示额外的自动化库已被编译。我想能够指定一个命令行属性,以确定哪种模式集用于各种类型的构建。



有没有人有关于如何做到这一点的任何想法?如果你不能得到< patternset> 要正确地工作,你可以看看< if> < then> < else> ant-contrib提供的任务。我们最终做了这样的事情:

 < target name =build> 
< if>
<等于arg1 =automation.qtparg2 =true/>
< then>
<! -
- 使用QTP支持构建。
- >
< / then>
< else>
<! -
- 没有QTP支持的构建。
- >
< / else>
< / if>
< / target>

if和else分支之间的构建逻辑有一些重复,但是你可以考虑一些如果你用一个macrodef来包装< mxmlc> ,那么就出来了。


I have been struggling trying to figure out how to conditionally include Flex libraries in an ant build based on a property that is set on the command line. I have tried a number of approaches with the <condition/> task, but so far have not gotten it to work. Here is where I am currently.

I have an init target that includes condition tasks like this:

 <condition property="automation.libs" value="automation.qtp">
  <equals arg1="${automation}" arg2="qtp" casesensitive="false" trim="true"/>
 </condition>

The purpose of this task is to set a property that determines the name of the patternset to be used when declaring the implicit fileset on a mxmlc or compc task. The pattern set referenced above is defined as:

 <patternset id="automation.qtp">
  <include name="automation*.swc"/>
  <include name="qtp.swc"/>
 </patternset>

The named patternset is then referenced by the mxmlc or compc task like this:

<compc>
 <compiler.include-libraries dir="${FLEX_HOME}/frameworks/libs" append="true">
  <patternset refid="${automation.libs}"/>
 </compiler.include-libraries>
</compc>

This doesn't appear to work. At least the SWC size does not indicate that the additional automation libraries have been compiled in. I want to be able to specify a command line property that determine which patternset to use for various types of builds.

Does anyone have any ideas about how to accomplish this? Thanks!

解决方案

If you can't get <patternset> to work correctly, you might want to take a look at the <if> <then> and <else> tasks provided by ant-contrib. We ended up doing something like this:

<target name = "build">
    <if>
        <equals arg1="automation.qtp" arg2="true"/>
        <then>
            <!--
               - Build with QTP support.
               -->
        </then>
        <else>
            <!--
               - Build without QTP support.
               -->
        </else>
    </if>
</target>

There is some duplication of build logic between the if and else branch, but you can factor some of that out if you wrap <mxmlc> with a macrodef.

这篇关于有条件地在mxmlc / compc ant任务中包含Flex库(SWC)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆