2017-08-15 45 views
0

我想要子類探測器在開始構建之前從網絡中克隆自定義存儲庫。子類探測器不起作用

GitProbe:

import qbs 
import qbs.File 
import qbs.Process 

Probe { 
    property string gitUrl 
    property string wd 
    property string name 
    property string dir: wd + "/" + name 
    configure: { 
     try { 
      if(File.directoryEntries(dir, File.AllEntries).length > 0){ 
       File.remove(dir) 
      } 
      var gitProcess = Process() 
      gitProcess.setWorkingDirectory(wd) 
      gitProcess.exec("git", ["clone", gitUrl], true) 
      found = true 
     } catch(err) { 
      console.warn("GitProbe : could not clone repository " + gitUrl) 
      console.error("GitProbe : " + err) 
      found = false 
     } 
    } 
} 

我沒放dir/imports/GitProbe.qbs,在我的項目,我做了qbsSearchPath: "path-to-dir",但在解析文件Unexpected item type 'GitProbe'時QBS告訴我。

+0

目錄名稱需要是「進口」,而不是「進口」。 –

+0

是的,這是它是問題文本中的錯字。 –

+0

好的。請發佈一個完整的,但最小的項目,以便我可以嘗試重現該問題。 –

回答

0

這是一個已知的限制:在解析當前文件時需要設置搜索路徑。所以解決方法是從另一個文件中的Project項目引用您的文件,並在那裏設置搜索路徑。您可能要對https://bugreports.qt.io/browse/QBS-667進行投票。

+0

好的,謝謝你的答案,我做了投票。 –