2016-08-16 14 views
1

在我的項目,我有依賴單一模塊上幾個插件,包含Group項類似於:集團項目:不能安裝文件到同一位置

Group { 
    name: "group" 
    qbs.install: true 
    qbs.installDir: "../" 
    files: <filename> 
} 

但是編譯失敗「錯誤:無法安裝文件'filename'and'filename'to the same location'location'「。基本上,QBS不能將同一文件複製到同一位置兩次(對我來說似乎不合邏輯)

如何解決此錯誤或者是否有任何優雅的解決方法?

+0

如何將依賴關係添加到其他產品中的模塊? – BlueMagma

+0

@BlueMagma,在模塊上的每個產品依賴關係都被指定爲'Depends {name:「MyModuleName」}' –

+0

您能提供完整的模塊嗎(或者它是保密的)嗎? – BlueMagma

回答

0

有一種變通方法,這可能需要一個項目的一些調整:的

代替:

Module { 
    name: "somemodule" 

    // module properties set to dependant products 

    Group { 
     // files to install 
     qbs.install: true 
    } 
} 

我們可以使用:

Product { 
    name: "somemodule" 

    Group { 
     // files to install 
     qbs.install: true 
    } 

    Export { 
     // module properties set to dependant products 
    } 
} 

這樣,文件只安裝一旦運行mymodule的步驟,從而消除衝突。模塊屬性,通過Export項目導出,與通過Module導出的項目一樣工作。

限制:

  1. Product必須被添加到該Project項目
  2. Modules不能依賴於Product物品,這可能需要對所有依賴模塊重組爲Project /Export雙太
references
1

這是qbs.installSourceBase財產的工作。基本上,您將其設置爲包含組中文件的基本目錄,Qbs將基於其相對於上述基本目錄的路徑,將列出的文件分層安裝到qbs.installDir中。

例如,給定以下組:

// defined in /source/myproject/myproject.qbs 
Group { 
    qbs.install: true 
    qbs.installDir: "share/stuff" 
    qbs.installSourceBase: "." // relative to /source/myproject 
    files: [ 
     "fileA.txt", 
     "fileB.txt", 
     "subdir/fileB.txt", 
    ] 
} 

和下面的命令行調用:

$ qbs [...] --install-root /sample/some-root 

以下文件系統層次結構將導致:

/sample/some-root/share/stuff/fileA.txt 
/sample/some-root/share/stuff/fileB.txt 
/sample/some-root/share/stuff/subdir/fileB.txt 

見QBS Installation Properties文檔獲取更多信息。

+0

它不能解決問題,無法將兩個子項目中的同一個文件安裝到同一位置...... –

+0

這是一個邏輯悖論 - 您無法安裝兩個不同的文件到相同的路徑。你究竟在努力完成什麼? –

+0

我想將一個文件複製到一個位置,但是從兩個子項目中複製。 –

相關問題