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

file tag confusion

    XMLWordPrintable

Details

    • 3b50726352fd1b1c5fc5424856ccb9446c87a30f

    Description

      Consider this example:

      import qbs
      import qbs.FileInfo
      import qbs.TextFile
      
      Project {
          CppApplication {
              files: [
                  "one.h", "two.h",
                  "one.cpp", "two.cpp",
                  "main.cpp"
              ]
              Group {
                  files: ["one.h", "two.h"]
                  fileTags: ["pch"]
                  overrideTags: false
              }
              Rule {
                  inputs: ['pch']
                  multiplex:true
      
                  Artifact {
                      fileName: "pch_headers.h"
                      fileTags: [ "hpp" ]
                  }
      
                  prepare: {
                      var cmd = new JavaScriptCommand();
                      cmd.description = "generating precompiled header file";
                      cmd.sourceCode = function() {
                          var fileContent="#if defined __cplusplus\n";
                          for(var i in inputs.pch)
                          {
                              fileContent+="#include \"" +FileInfo.fileName(inputs.pch[i].filePath) + "\"\n";
                          }
                          fileContent+="#endif"
                          var file = new TextFile(output.filePath, TextFile.WriteOnly);
                          file.truncate();
                          file.write(fileContent);
                          file.close();
                      }
                      return cmd;
                  }
              }    
          }
      }
      

      The rule does not run.

      In the log appears:

      TRACE: [PR] adding file tags (hpp) to one.h
      TRACE: [PR] adding file tags (hpp) to two.h
      TRACE: [PR] adding file tags (cpp) to one.cpp
      TRACE: [PR] adding file tags (cpp) to two.cpp
      TRACE: [PR] adding file tags (cpp) to main.cpp
      TRACE: [PR] adding file tags (pch, hpp) to one.h
      TRACE: [PR] adding file tags (pch, hpp) to two.h
      Commenting out {{"one.h", "two.h"}} in the Product.files binding lets the rule run. 
      
      The log looks like this:
      

      TRACE: [PR] adding file tags (cpp) to one.cpp
      TRACE: [PR] adding file tags (cpp) to two.cpp
      TRACE: [PR] adding file tags (cpp) to main.cpp
      TRACE: [PR] adding file tags (hpp, pch) to one.h
      TRACE: [PR] adding file tags (hpp, pch) to two.h

      
      

      Issues:

      • the rule should run in the first case
      • looks like the FileTaggers are run if overrideTags is false
      • if overrideTags is true, there's no log output for the headers

      Attachments

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

        Activity

          People

            jbornema Joerg Bornemann
            jbornema Joerg Bornemann
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes