Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-56193

Warnings-ng plugin cannot parse messages from MSBuild with relative paths

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • analysis-model
    • None
    • Versions:
      Jenkins: 2.150.3
      Warnings NG: 5.0.1
    • warnings-ng 4.0.0, analysis-model-api 3.0.0

      I use CMake to generate Visual Studio solution in a separate directory (out of source build)

      For example:

      mkdir build
      cd build
      cmake .. -GNinja

      Compiler prints warnings in the following format:

      [14/139] Building C object modules\Lib\CMakeFiles\Lib.dir\file.c.obj
       ..\modules\Lib\file.c(608): warning C4101: 'i': unreferenced local variable
       ..\modules\Lib\file.c(725): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data

      And the Warnings-NG plugin, called at the post-build step, cannot find these files and outputs errors:

      [MSBuild] [ERROR] Can't resolve absolute paths for some files:
      [MSBuild] [ERROR] - ../modules/Lib/file.c
       ...
      [MSBuild] [ERROR] Can't create fingerprints for some files:
      [MSBuild] [ERROR] - '../modules/Lib/file.c', IO exception has been thrown: java.nio.file.NoSuchFileException: ..\modules\Lib\file.c
       ...
      [MSBuild] [ERROR] Can't create blame requests for some affected files:
      [MSBuild] [ERROR] - Skipping non-workspace file ../modules/Lib/file.c
       ...

      Suggestion:

      Add option for path mapping, relative to workspace root.

          [JENKINS-56193] Warnings-ng plugin cannot parse messages from MSBuild with relative paths

          Vladimir Eremeev created issue -
          Vladimir Eremeev made changes -
          Description Original: I use CMake to generate Visual Studio solution in a separate directory ([out of source build|https://cgold.readthedocs.io/en/latest/tutorials/out-of-source.html])

          For example:

          {{mkdir build}}
          {{ cd build }}
          {{ cmake .. -GNinja}}

          Compiler prints warnings in the following format:

          {{[14/139] Building C object modules\Lib\CMakeFiles\Lib.dir\file.c.obj}}
          {{ ..\modules\Lib\file.c(608): warning C4101: 'i': unreferenced local variable}}
          {{ ..\modules\Lib\file.c(725): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data}}

          And the Warnings-NG plugin, called at the post-build step, cannot find these files and outputs errors:

          {{[MSBuild] [ERROR] Can't resolve absolute paths for some files:}}
          {{ [MSBuild] [ERROR] - ../modules/Lib/file.c}}
          {{ ...}}
          {{ [MSBuild] [ERROR] Can't create fingerprints for some files:}}
          {{ [MSBuild] [ERROR] - '../modules/Lib/file.c', IO exception has been thrown: java.nio.file.NoSuchFileException: ..\modules\Lib\file.c}}
          {{ ...}}
          {{ [MSBuild] [ERROR] Can't create blame requests for some affected files:}}
          {{ [MSBuild] [ERROR] - Skipping non-workspace file ../modules/Lib/file.c}}
          {{ ...}}
          h2. Suggestion:

          Add option for path mapping, relative to workspace root.
          New: I use CMake to generate Visual Studio solution in a separate directory ([out of source build|https://cgold.readthedocs.io/en/latest/tutorials/out-of-source.html])

          For example:

          {{{{mkdir build}}}}
          {{cd build}}
          {{cmake .. -GNinja}}

          Compiler prints warnings in the following format:

          {{{{[14/139] Building C object modules\Lib\CMakeFiles\Lib.dir\file.c.obj}}}}
          {{ ..\modules\Lib\file.c(608): warning C4101: 'i': unreferenced local variable}}
          {{ ..\modules\Lib\file.c(725): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data}}

          And the Warnings-NG plugin, called at the post-build step, cannot find these files and outputs errors:

          {{{{[MSBuild] [ERROR] Can't resolve absolute paths for some files:}}}}
          {{[MSBuild] [ERROR] - ../modules/Lib/file.c}}
          {{ ...}}
          {{[MSBuild] [ERROR] Can't create fingerprints for some files:}}
          {{[MSBuild] [ERROR] - '../modules/Lib/file.c', IO exception has been thrown: java.nio.file.NoSuchFileException: ..\modules\Lib\file.c}}
          {{ ...}}
          {{[MSBuild] [ERROR] Can't create blame requests for some affected files:}}
          {{[MSBuild] [ERROR] - Skipping non-workspace file ../modules/Lib/file.c}}
          {{ ...}}
          h2. Suggestion:

          Add option for path mapping, relative to workspace root.
          Vladimir Eremeev made changes -
          Description Original: I use CMake to generate Visual Studio solution in a separate directory ([out of source build|https://cgold.readthedocs.io/en/latest/tutorials/out-of-source.html])

          For example:

          {{{{mkdir build}}}}
          {{cd build}}
          {{cmake .. -GNinja}}

          Compiler prints warnings in the following format:

          {{{{[14/139] Building C object modules\Lib\CMakeFiles\Lib.dir\file.c.obj}}}}
          {{ ..\modules\Lib\file.c(608): warning C4101: 'i': unreferenced local variable}}
          {{ ..\modules\Lib\file.c(725): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data}}

          And the Warnings-NG plugin, called at the post-build step, cannot find these files and outputs errors:

          {{{{[MSBuild] [ERROR] Can't resolve absolute paths for some files:}}}}
          {{[MSBuild] [ERROR] - ../modules/Lib/file.c}}
          {{ ...}}
          {{[MSBuild] [ERROR] Can't create fingerprints for some files:}}
          {{[MSBuild] [ERROR] - '../modules/Lib/file.c', IO exception has been thrown: java.nio.file.NoSuchFileException: ..\modules\Lib\file.c}}
          {{ ...}}
          {{[MSBuild] [ERROR] Can't create blame requests for some affected files:}}
          {{[MSBuild] [ERROR] - Skipping non-workspace file ../modules/Lib/file.c}}
          {{ ...}}
          h2. Suggestion:

          Add option for path mapping, relative to workspace root.
          New: I use CMake to generate Visual Studio solution in a separate directory ([out of source build|https://cgold.readthedocs.io/en/latest/tutorials/out-of-source.html])

          For example:

          {{mkdir build}}
           {{cd build}}
           {{cmake .. -GNinja}}

          Compiler prints warnings in the following format:

          {{[14/139] Building C object modules\Lib\CMakeFiles\Lib.dir\file.c.obj}}
           {{ ..\modules\Lib\file.c(608): warning C4101: 'i': unreferenced local variable}}
           {{ ..\modules\Lib\file.c(725): warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data}}

          And the Warnings-NG plugin, called at the post-build step, cannot find these files and outputs errors:

          {{[MSBuild] [ERROR] Can't resolve absolute paths for some files:}}
           {{[MSBuild] [ERROR] - ../modules/Lib/file.c}}
           {{ ...}}
           {{[MSBuild] [ERROR] Can't create fingerprints for some files:}}
           {{[MSBuild] [ERROR] - '../modules/Lib/file.c', IO exception has been thrown: java.nio.file.NoSuchFileException: ..\modules\Lib\file.c}}
           {{ ...}}
           {{[MSBuild] [ERROR] Can't create blame requests for some affected files:}}
           {{[MSBuild] [ERROR] - Skipping non-workspace file ../modules/Lib/file.c}}
           {{ ...}}
          h2. Suggestion:

          Add option for path mapping, relative to workspace root.
          Ulli Hafner made changes -
          Link New: This issue depends on JENKINS-56020 [ JENKINS-56020 ]

          Ulli Hafner added a comment -

          Looks similar to JENKINS-56020.

          Ulli Hafner added a comment - Looks similar to JENKINS-56020 .

          Yes, similar.

          What about letting user to specify path mapping? Valgrind plugin does so.

           

          Vladimir Eremeev added a comment - Yes, similar. What about letting user to specify path mapping? Valgrind plugin does so.  
          Ulli Hafner made changes -
          Link New: This issue depends on JENKINS-48802 [ JENKINS-48802 ]

          Ulli Hafner added a comment -

          Yes, this is also a feature request, see JENKINS-48802. But I think it would be smarter if the "entering directory /foo/bar" messages would be parsed. Can you please also attach a snippet of your log that contains both the directory messages and the actual warning?

          Ulli Hafner added a comment - Yes, this is also a feature request, see JENKINS-48802 . But I think it would be smarter if the "entering directory /foo/bar" messages would be parsed. Can you please also attach a snippet of your log that contains both the directory messages and the actual warning?
          Vladimir Eremeev made changes -
          Attachment New: consoleText.txt [ 46118 ]
          Ulli Hafner made changes -
          Rank New: Ranked higher

            drulli Ulli Hafner
            wl2776 Vladimir Eremeev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: