[Qt-creator] [Qbs] Qtc+Qbs+git wroktree = cannot lock build graph

Christian Gagneraud chgans at gmail.com
Wed Dec 13 21:30:25 CET 2017


On 13/12/2017 8:58 PM, Eike Ziller wrote:
> 
> 
>> On 12. Dec 2017, at 23:02, Christian Gagneraud <chgans at gmail.com>
>> wrote:
>> 
>> On 12/12/2017 9:56 PM, Christian Kandeler wrote:
>>> On Tue, 12 Dec 2017 10:03:58 +1300 Christian Gagneraud 
>>> <chgans at gmail.com> wrote:
>>>> Not sure if it's a Qtc or a Qbs issue, but here is my problem:
>>>> I'm using git worktrees, which means i have the same project 
>>>> checked-out on different branches in different sibling
>>>> directories, the main qbs files have the same name, and so by
>>>> default, Qtc try to use the same build directory, luckily qbs
>>>> refuse to go ahead (not sure if with qmake i'll get a warning
>>>> about that). Anyway, the solution is to edit the project's
>>>> build settings. It's OK, but it's a bit annoying over time.
>>>> What about if Qtc would hash the path to the project file and
>>>> use it (as a prefix) to name the default build folder?
>>> Shouldn't you be able to set 
>>> Tools->Options->Build&Run->General->Default build directory to a 
>>> value that makes sense for your setup?
>> 
>> Yes, I would need to add a unique marker based on
>> CurrentProject::FilePath, is there a javascript function to
>> calculate a hash of the file path?
>> 
>> So my case is:
>> 
>> $ cd ~/Projects/$project $ ls master <branch1> <branch2> ...
>> 
>> Each <branch> directory contains a git worktree, so they all have
>> the same project name and so the same location and directory name
>> for their build:
>> ~/Projects/$project/build-<project>-<kit>-<config>, i would like to
>> have
>> ~/Projects/$project/build-<project>-<kit>-<config>-<hash-of-project-filepath>.
>
>> 
> Maybe you could use %{CurrentProject:VcsTopic}

Interesting idea, in my case the topic contains '/', but this could 
still work.

> 
> Otherwise
> 
> %{JS:Util.completeBaseName("%{CurrentProject:Path}”)}
> 
> will expand to the last path component of the project file, e.g. if
> the project file is "/foo/bar/1.0/foo.pro" it will expand to “1.0”

This could work as well, thanks.

> 
> (The JS variable will evaluate the javascript following “JS:”; you
> find the methods that are available in “Util” here:
> http://code.qt.io/cgit/qt-creator/qt-creator.git/tree/src/plugins/coreplugin/corejsextensions.h
> .)

Thanks for the link.
Wouldn't it be nice to have a javascript section int the QtC manual? 
Maybe in the "Advanced use" main section.

Chris



More information about the Qt-creator mailing list