2011-10-30 13 views
0

私はターゲットを2回呼び出したい:最初に外部lib名 "temp.swc"、この外部libの2回目。Antスクリプト:同じターゲットを異なるプロパティ値で使用する方法は?

<target name="build-trinity-client"> 
    <mxmlc 
     file="${src.dir}/${trinity.project}.mxml" 
     output="${release.dir}/${trinity-client}.swf" 
     locale="fr_FR" 
     static-rsls="true" 
     accessible="true" 
     configname="air" 
     debug="false" 
     failonerror="true" 
     fork="true" 
     maxmemory="512m"> 
      <source-path path-element="${src.dir}"/> 
      <external-library-path file="${FLEX_HOME}/frameworks/libs/air/airglobal.swc" append="true"/> 
      <library-path dir="${ivy.cache.dir}" append="true"> 
       <include name="${puremvc.lib}"/> 
       <include name="${kccalendar.lib}"/> 
       <include name="${as3commons.lib}"/> 
       <include name="d:/temp.swc"/> 
      </library-path>    
    </mxmlc> 

</target> 

答えて

1

あなたはantcallタグとifタグを使用する必要があります

<taskdef resource="net/sf/antcontrib/antlib.xml"/> 

<target name="build-trinity-client"> 
    <if> 
     <isset property="swc.name"/> 
     <then> 
      <mxmlc 
       file="${src.dir}/${trinity.project}.mxml" 
       output="${release.dir}/${trinity-client}.swf" 
       locale="fr_FR" 
       static-rsls="true" 
       accessible="true" 
       configname="air" 
       debug="false" 
       failonerror="true" 
       fork="true" 
       maxmemory="512m"> 
       <source-path path-element="${src.dir}"/> 
       <external-library-path file="${FLEX_HOME}/frameworks/libs/air/airglobal.swc" append="true"/> 
       <library-path dir="${ivy.cache.dir}" append="true"> 
        <include name="${puremvc.lib}"/> 
        <include name="${kccalendar.lib}"/> 
        <include name="${as3commons.lib}"/> 
        <include name="${swc.name}"/> 
       </library-path>    
      </mxmlc> 
     </then> 
     <else> 
      <mxmlc 
       file="${src.dir}/${trinity.project}.mxml" 
       output="${release.dir}/${trinity-client}.swf" 
       locale="fr_FR" 
       static-rsls="true" 
       accessible="true" 
       configname="air" 
       debug="false" 
       failonerror="true" 
       fork="true" 
       maxmemory="512m"> 
       <source-path path-element="${src.dir}"/> 
       <external-library-path file="${FLEX_HOME}/frameworks/libs/air/airglobal.swc" append="true"/> 
       <library-path dir="${ivy.cache.dir}" append="true"> 
        <include name="${puremvc.lib}"/> 
        <include name="${kccalendar.lib}"/> 
        <include name="${as3commons.lib}"/> 
       </library-path>    
      </mxmlc> 
     </else> 
    </if> 
</target> 

<target name="sample_call"> 
    <echo>First call: library name is passing</echo> 
    <antcall target="build-trinity-client"> 
     <param name="swc.name" value="d:/temp.swc"/> 
    </antcall> 

    <echo>Second call: don't use external library</echo> 
    <antcall target="build-trinity-client"> 
     <param name="swc.name" value=""/> 
    </antcall> 
</target> 
+0

こんにちは、アレックス、あなたの答えをありがとう。しかし、実際には、私の最初のケースでは、私はlibを使いたくない、そして2番目の場合、私はlibを使いたい。だから、私は "ない"または "if"条件を使用する必要があると思うが、どうすれば設定できますか? – Anthony

+0

@ user497724回答を受け入れる必要があります - 回答を引き続き受けたい場合。 – FailedDev