[Qt-creator] JSON wizard: build systems and sub-projects

Tobias Hunger tobias.hunger at gmail.com
Sun May 12 19:27:04 CEST 2019


Hi Christian,

On Sun, May 12, 2019, 12:04 Christian Gagneraud <chgans at gmail.com> wrote:

> Hi there,
>
> In my attempt to add a unified "subdirs" project and make all projects
> templates "subproject" friendly, I discovered a few grey area, and
> would like to discuss what they are how we could fix them.
>
> 1. "supportedProjectType" and "enabled" properties are currently
> redundant (in the way they are used), consider:
> "supportedProjectTypes": [ "CMakeProjectManager.CMakeProject",
> "Qbs.QbsProject", "Qt4ProjectManager.Qt4Project" ],
> and
> "enabled": "%{JS: value('Plugins').indexOf('QbsProjectManager') >= 0
> || value('Plugins').indexOf('QmakeProjectManager') >= 0 ||
> value('Plugins').indexOf('CMakeProjectManager') >= 0}",
>
> They both express the same thing, but using different approaches. IMHO
> enabled should be used to express further conditions on top of the
> supported project types.
>


They express slightly different things.

supportedProjectType says which build systems a wizard can support. This is
hard-coded into the wizard.

enabled is used to present which build systems the current Qt Creator
installation currently supports. This is dynamic as users can and do
disable plugins.

The wizard needs to know both.

2. "Define Build System" page.
> Currently the boiler plate attempt to identify the "Project type" to
> generate, but doesn't rely/use the semantic of the
> "supportedProjectType" above.
> Instead they use the HasPlugin concept to map the build system tool
> (aka, "qmake", "qbs", "cmake"), which is actually equivalent to the
> project type (the wizard doesn't care about the tool, it cares about
> the project manager it targets: CMakeProjectManager.CMakeProject,
> Qbs.QbsProject, ...).
>

Sure. Disable qmake and qbs support in Creator and see what happens:-)

<snip>

5. Ideas to achieve that
> I did some quick hack in the ProjectNode, there is a "buildKey()"
> there, that returns the build target key, so i added a
> "projectTypeKey()" that returns the project manager's project ID
> (CMakeProjectManager.CMakeProject, ...), and which is injected wizard
> environment.
>

That could help when starting the wizard via the context menu. That is
unfortunately not the only way to trigger this wizard.

With the above and proper macro nesting, it should be possible to
> define the following wizard options:
>  - IsSubProject, IsTopProject
>  - HasCMake, HasQmake, HasQbs

 - IsCMake, IsQmake, IsQbs
>

Please do not hardcore the list of possible build systems! There are more
plugins out there 5han those that are shipped with Creator.

  - top project:
>     by comparing the "Build system" page choice
>   - sub-project
>     by comparing the injected "projectType" (same values as above)
>
> The HasFoo, IsFoo and ProjectType could all rely on the project
> manager key. No need to deal with project manager key, plugin names
> and build tool names.
>

I disagree.

These low level details are exposed so  and that *any* plugin can have
wizards and so that the wizards we ship can be copied and modified easily
for non-standard plugins.

Best Regards,
Tobias

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/qt-creator/attachments/20190512/84101b92/attachment-0001.html>


More information about the Qt-creator mailing list