Uploaded image for project: 'Qbs ("Cubes")'
  1. Qbs ("Cubes")
  2. QBS-1707

Providers can return module properties

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • None
    • None

    Description

      Originally, Qt provider was a JS-based re-implementation of the setup-qt tool which generated Qt modules based on templates.
      What if instead of writing files to the disk and replacing templates with actual values, Provider will return properties it overrides and Qbs will set those when loading a module?
      The provider will then return the path to the location where "templates" are (which are now regular modules) and thus avoid modifing filesystem.
      Note, that props set per Product or command line should have higher priority then those returned by a provider.
      Suggested syntax:

      // modules/bar/bar.qbs
      Module {
          property string foo: "foo"
          property string baz: "baz"
      }
      
      ModuleProvider {
           property string foo: "value"
           // built-in property var moduleInfo
           moduleInfo: {
                return {
                    "searchPaths": ["path/to/modules"],
                    "properties": {
                          "bar": { // module name
                              "foo": foo, // prop
                              "baz": "baazz", // prop
                          }
                    }
                }
           }
      }
      

      If providers are multi-shot (QBS-1706), this can be simplified:

      ModuleProvider {
           // built-in property var moduleName
           property string foo: "value"
           // built-in property var moduleInfo
           moduleInfo: {
                if (moduleName === "non-existent-module")
                    return {};
                return {
                    "searchPaths": ["path/to/modules"],
                    "properties": {
                        "foo": foo, // prop
                        "baz": "baazz", // prop
                    }
                };
           }
      }
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              arch Ivan Komissarov
              arch Ivan Komissarov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes