Scanner Item

A Scanner item can appear inside a Module Item, and allows to extract dependencies for artifacts from the artifacts' file contents. For example, this is what a scanner for "qrc" files might look like:


  import qbs.Xml

  Module {
    Scanner {
      inputs: 'qrc'
      scan: {
        var xml = new XmlDomDocument(input.filePath);
        dependencies = [];
        // retrieve <file> entries from the XML document
        return dependencies;
      }
    }
  }

Scanner Properties

PropertyTypeDefaultDescription
conditionbooltrueIf true, the scanner is enabled, otherwise it does nothing.
inputsstring listundefinedFile tags the input artifacts must match.
recursiveboolfalseDetermines whether to scan the returned dependencies using the same scanner.
searchPathsscriptundefinedScript that returns paths to look for dependencies. The code in this script is treated as a function with the signature function(project, product, input).
scanscriptundefinedScript that reads the input artifact and returns string list with dependencies. The code in this script is treated as a function with the signature function(project, product, input).