2011-02-08 77 views
0

你是如何做到這一點的?鑑於幾個構建文件,我只想包含目標(從命令行指定)存在的那些文件。使用target::exists似乎不起作用。謝謝。包括/排除buildfiles

<target name="*"> 
     <property name="curr.target" value="${target::get-current-target()}"/> 

     <nant target="${curr.target}"> 
      <buildfiles>      
       <include name="*.build" if="${target::exists(curr.target)}"/> 
       <!-- avoid recursive execution of current build file--> 
       <exclude name="${project::get-buildfile-path()}" />      
      </buildfiles>        
     </nant> 
    </target> 

使用robaker的解決方案,我的最終構建文件看起來像這樣。如果在某個構建文件中找不到目標,它就不會失敗(與我之前的代碼不同)。

<project> 
    <include buildfile="A.build"/> 
    <include buildfile="B.build"/> 

    <target name="*"> 
     <nant target="${target::get-current-target()}"/> 
    </target> 
</project> 

回答

1

爲什麼不使用include task來代替所有的子構建腳本?

+0

它的工作!感謝robaker - 非常感謝你的幫助! – 2011-02-09 19:33:29