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

Incorrect resolution of the scope

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Not Evaluated Not Evaluated
    • 2.2.0
    • 2.1.1, 2.1.2
    • None
    • b661c34d8 (master)

      In my project, I have a certain naming style guide for the products. For example, all QML engine extensions are prefixed by ext- and all dynamically loaded plugins are prefixed with plugin-.

      Now, I want to simplify life for myself so that I can write something like this:

      mega-app.qbs
      Application {
          Relies { on: 'lib-logger' }
          Relies { on: 'ext-controls' }
          Relies { on: 'plugin-mega-addon' }
      
          name: 'mega-app'
      }
      

      For this, I define an auxiliary item like this:

      Relies.qbs
      Depends {
          id: root
      
          property string on
      
          name: on
          enableFallback: false
          cpp.link: {
              var prefix = root.name.split('-')[0]
      
              console.warn(root.name)  // => name of the product,
                                       //    not of the Depends item
              console.warn(root.on)    // => undefined
      
              return prefix !== 'ext' && prefix !== 'plugin'
          }
      }
      

      I described the actual result in the comments above.

      The expected behavior though would be to get the property of the item, not of the product it's in. Effectively, root.name should be equal to root.on in this case.

        For Gerrit Dashboard: QBS-1762
        # Subject Branch Project Status CR V

            kandeler Christian Kandeler
            gooroo Serhii Olendarenko
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes