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

qbs.architecture for AVR toolchain ends with an '\n\r' symbols

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 1.10.0
    • 1.9.1
    • General
    • None
    • * Windows 10 x64
       * QtC 4.4.1
       * GCC AVR toolchain
    • 8c6ea8d35c24901ec886b18e8bef13d84cf4d607

    Description

      This QBS-1203 added support for AVR toolchains, but, seems, that the qbs.architecture contains the superfluous symbols (e.g. \n\r).
             
      E.g. when I use the 'archiver' module, with this code:

      import qbs
      import qbs.FileInfo
      import qbs.ModUtils
      import qbs.TextFile
      
      Product {
          builtByDefault: false
          targetName: project.name + qbs.architecture
          destinationDirectory: project.buildDirectory
      
          Depends { name: "cpp" } // for qbs.architecture
          Depends { name: "archiver" }
          type: ["archiver.archive"]
          archiver.type: "zip"
          archiver.workingDirectory: qbs.installRoot
      
          Rule {
              multiplex: true
              inputsFromDependencies: ["installable"]
              Artifact {
                  filePath: product.name + ".tarlist"
                  fileTags: ["archiver.input-list"]
              }
              prepare: {
                  var cmd = new JavaScriptCommand();
                  cmd.silent = true;
                  cmd.sourceCode = function() {
                      var ofile = new TextFile(output.filePath, TextFile.WriteOnly);
                      try {
                          for (var i = 0; i < inputs["installable"].length; ++i) {
                              var inp = inputs["installable"][i];
                              var installRoot = inp.moduleProperty("qbs", "installRoot");
                              var installedFilePath = ModUtils.artifactInstalledFilePath(inp);
                              ofile.writeLine(FileInfo.relativePath(installRoot, installedFilePath));
                          }
                      } finally {
                          ofile.close();
                      }
                  };
                  return [cmd];
              }
          }
      }
      

      Then it fails, because generates an wrong file output path, like:

      Creating archive: D:/WORK/Projects/firmware-avr2 <<< THIS, SEEMS ADDS A NEW LINE SYMBOLS
      .zip
      
      Items to compress: 2
      
      Error:
      cannot open file
      
      D:/WORK/Projects/firmware-avr2 <<< THIS, SEEMS ADDS A NEW LINE SYMBOLS
      .zip

      But, If I add the trim() function:

      targetName: project.name + qbs.architecture.trim()
      

      then it generates a correct path:

      Creating archive: D:/WORK/Projects/firmware-avr2.zip

       

      Attachments

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

        Activity

          People

            jakepetroules Jake Petroules (DO NOT ASSIGN ISSUES)
            kuzulis Denis Shienkov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes