2016-08-16 60 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

我想将一个文件复制到一个位置,但是从两个子项目中复制。 –