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

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

问题描述

我一直在努力弄清楚如何根据在命令行上设置的属性有条件地将 Flex 库包含在 ant 构建中.我已经尝试了多种使用 任务的方法,但到目前为止还没有让它起作用.这是我目前所在的位置.

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.

我有一个包含条件任务的 init 目标,如下所示:

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>

此任务的目的是设置一个属性,该属性确定在 mxmlc 或 compc 任务上声明隐式文件集时要使用的模式集的名称.上面引用的模式集定义为:

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>

然后 mxmlc 或 compc 任务会像这样引用命名模式集:

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>

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

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!

推荐答案

如果您无法让 正常工作,您可能需要查看 任务由 ant-contrib 提供.我们最终做了这样的事情:

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>

在 if 和 else 分支之间存在一些构建逻辑的重复,但是如果您将 <mxmlc> 用宏定义包装起来,您可以将其中的一些因素考虑在内.

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天全站免登陆