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

Add support for gradle build-tools warnings (w:)

      Support gradle build-tools warnings form console log

      Example:

      25.11.2022 09:06:54  > Task :travel:compileDebugKotlin
      25.11.2022 09:06:54  w: '-Xjvm-default=compatibility' is deprecated, please use '-Xjvm-default=all|all-compatibility'
      25.11.2022 09:06:54  w: /var/lib/jenkins/workspace/.../CountryFavoriteRepositoryImpl.kt: (35, 35): Type mismatch: inferred type is CountryFavoriteDto? but CountryFavoriteDto was expected
      25.11.2022 09:06:54  w: /var/lib/jenkins/workspace/.../CountryFavoriteUseCase.kt: (86, 39): Name shadowed: favoriteCountry
      25.11.2022 09:06:54  w: /var/lib/jenkins/workspace/.../CountryDetailActivity.kt: (48, 30): 'getParcelableExtra(String!): T?' is deprecated. Deprecated in Java 

      And Gradle WARNINGS.

      Example:

      25.11.2022 09:07:34  > Configure project :app
      25.11.2022 09:07:34  WARNING:The option setting 'android.jetifier.ignorelist=io.cucumber.cucumber-java' is experimental.
      25.11.2022 09:07:34  WARNING:API 'android.registerTransform' is obsolete.
      25.11.2022 09:07:34  It will be removed in version 8.0 of the Android Gradle plugin.
      25.11.2022 09:07:34  The Transform API is removed to improve build performance. Projects that use the
      25.11.2022 09:07:34  Transform API force the Android Gradle plugin to use a less optimized flow for the
      25.11.2022 09:07:34  build that can result in large regressions in build times. It's also difficult to
      25.11.2022 09:07:34  use the Transform API and combine it with other Gradle features; the replacement
      25.11.2022 09:07:34  APIs aim to make it easier to extend the build without introducing performance or
      25.11.2022 09:07:34  correctness issues.
      25.11.2022 09:07:34  
      25.11.2022 09:07:34  There is no single replacement for the Transform API—there are new, targeted
      25.11.2022 09:07:34  APIs for each use case. All the replacement APIs are in the
      25.11.2022 09:07:34  `androidComponents {}` block.
      25.11.2022 09:07:34  
      25.11.2022 09:07:34  The Transform API uses incremental APIs deprecated since Gradle 7.5. Please add
      25.11.2022 09:07:34  `android.experimental.legacyTransform.forceNonIncremental=true` to
      25.11.2022 09:07:34  `gradle.properties` to fix this issue. Note that this will run transforms
      25.11.2022 09:07:34  non-incrementally and may have a build performance impact.
      25.11.2022 09:07:34  For more information, see https://developer.android.com/studio/releases/gradle-plugin-api-updates#transform-api.
      25.11.2022 09:07:34  To determine what is calling android.registerTransform, use -Pandroid.debug.obsoleteApi=true on the command line to display more information. 

          [JENKINS-70153] Add support for gradle build-tools warnings (w:)

          Pinned comments

          Pinned by Pratik

          Ulli Hafner added a comment -

          The best starting place for this issue probably is the analysis-model library that contains the parsers for the warnings plugin.

          Your basically need:
          1. a test case that contains the example messages (first block with "w:...") from above as a text file
          2. try to use the JavacParser as parser for those files. If the parser does not read those files,

          • try to change the regular expression if possible
          • write a new parser if the regexp cannot be adapted

          Ulli Hafner added a comment - The best starting place for this issue probably is the analysis-model library that contains the parsers for the warnings plugin. Your basically need: 1. a test case that contains the example messages (first block with "w:...") from above as a text file 2. try to use the JavacParser as parser for those files. If the parser does not read those files, try to change the regular expression if possible write a new parser if the regexp cannot be adapted

          All comments

          Pratik added a comment - - edited

          Thank You so much markewaite . In how much time did you expect for this issue to get solved from me ?

          Pratik added a comment - - edited Thank You so much markewaite . In how much time did you expect for this issue to get solved from me ?

          Mark Waite added a comment -

          In how much time did you expect for this issue to get solved from me ?

          There is no expectation of a specific timeline to resolve an issue.

          Mark Waite added a comment - In how much time did you expect for this issue to get solved from me ? There is no expectation of a specific timeline to resolve an issue.

          Pratik added a comment - - edited

          Hi markewaite Sir, I have started working on issue. Have setup jenkins locally and tried a simple CI/CD pipeline for simple free-style project to get familier with jenkins but as per youtube video https://www.youtube.com/watch?v=u3eCEw6l8t0 it is about all plugins but I need to setup for only warning plugins to solve this issue. Means I have to fork & clone this repo - https://github.com/jenkinsci/warnings-ng-plugin

          Am I Right ?

           

          Pratik added a comment - - edited Hi markewaite Sir, I have started working on issue. Have setup jenkins locally and tried a simple CI/CD pipeline for simple free-style project to get familier with jenkins but as per youtube video https://www.youtube.com/watch?v=u3eCEw6l8t0 it is about all plugins but I need to setup for only warning plugins to solve this issue. Means I have to fork & clone this repo - https://github.com/jenkinsci/warnings-ng-plugin .  Am I Right ?  

          Mark Waite added a comment -

          Am I Right ?

          You've chosen exactly the correct video to use as your tutorial. These plugins are maintained by drulli and that video was created by him to highlight how to work with the plugins that he maintains. You'll need to explore further for yourself to decide which repositories you need to fork. I assume you'll need:

          • analysis-model
          • warnings-ng

          However, that is just an assumption. Your best step is to start working on the issue and learn as you go. Forking a repository is very low cost and there are many more things that you'll learn while you're working through it. If you think it might help you to fork the repository, then it is a good idea to fork the repository.

          Mark Waite added a comment - Am I Right ? You've chosen exactly the correct video to use as your tutorial. These plugins are maintained by drulli and that video was created by him to highlight how to work with the plugins that he maintains. You'll need to explore further for yourself to decide which repositories you need to fork. I assume you'll need: analysis-model warnings-ng However, that is just an assumption. Your best step is to start working on the issue and learn as you go. Forking a repository is very low cost and there are many more things that you'll learn while you're working through it. If you think it might help you to fork the repository, then it is a good idea to fork the repository.

          Pinned by Pratik

          Ulli Hafner added a comment -

          The best starting place for this issue probably is the analysis-model library that contains the parsers for the warnings plugin.

          Your basically need:
          1. a test case that contains the example messages (first block with "w:...") from above as a text file
          2. try to use the JavacParser as parser for those files. If the parser does not read those files,

          • try to change the regular expression if possible
          • write a new parser if the regexp cannot be adapted

          Ulli Hafner added a comment - The best starting place for this issue probably is the analysis-model library that contains the parsers for the warnings plugin. Your basically need: 1. a test case that contains the example messages (first block with "w:...") from above as a text file 2. try to use the JavacParser as parser for those files. If the parser does not read those files, try to change the regular expression if possible write a new parser if the regexp cannot be adapted

          Arnab added a comment - - edited

          Hello drulli, I followed the setup from the video and ran all the tests for "analysis-model". It looks like it finished all the tests successfully (passed -1295, ignored -1) but I can see these errors on my terminal, can you please help me troubleshoot this - https://pastebin.com/7B25Y0v8

           

          I assume that the issues are somewhat related to the windows CRLF (or how windows handles EOLs and whitespaces), as I faced formatting problems in diff when working with maven-hpi-plugin earlier.

          Arnab added a comment - - edited Hello drulli , I followed the setup from the video and ran all the tests for "analysis-model". It looks like it finished all the tests successfully (passed -1295, ignored -1) but I can see these errors on my terminal, can you please help me troubleshoot this - https://pastebin.com/7B25Y0v8   I assume that the issues are somewhat related to the windows CRLF (or how windows handles EOLs and whitespaces), as I faced formatting problems in diff when working with maven-hpi-plugin earlier.

          Ulli Hafner added a comment -

          I cannot read private pastebin texts. Can't you simply use the issue tracker to show me the errors?

          Ulli Hafner added a comment - I cannot read private pastebin texts. Can't you simply use the issue tracker to show me the errors?

          Arnab added a comment - - edited

          drulli

          Ah sorry, I didn't knew it was private. 

          Actually the log was way too long but here is a small part of it and I'm also attaching the .txt file of the entire log. Thank You.  file - error log-1.txt

          Arnab added a comment - - edited drulli Ah sorry, I didn't knew it was private.  Actually the log was way too long but here is a small part of it and I'm also attaching the .txt file of the entire log. Thank You.  file - error log-1.txt

          Ulli Hafner added a comment - - edited

          Can you wrap log messages in the text using the Jira

          {noformat}text{noformat}
          

          tags?

          Most errors you are encountering are normal, they test the parsers with broken files. What does Maven report at the end? If the build is successful, then everything is ok.

          See the following green reports: https://github.com/jenkinsci/analysis-model/actions/runs/12418074139/job/34670448465

          Ulli Hafner added a comment - - edited Can you wrap log messages in the text using the Jira {noformat}text{noformat} tags? Most errors you are encountering are normal, they test the parsers with broken files. What does Maven report at the end? If the build is successful, then everything is ok. See the following green reports: https://github.com/jenkinsci/analysis-model/actions/runs/12418074139/job/34670448465

          Arnab added a comment - - edited

          drulli 

           at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
          at java.base/java.util.ArrayList.forEach(ArrayList.java:1596)
          Caused by: org.opentest4j.AssertionFailedError: 
          Expecting value to be false but was true
          ... 4 more
           
          [Fatal Error] :-1:-1: Premature end of file.
          [Fatal Error] :-1:-1: Premature end of file.
           [Fatal Error] :-1:-1: Premature end of file.
          [Fatal Error] :-1:-1: Premature end of file.
          Mockito is currently self-attaching to enable the inline-mock-maker. This will no longer work in future releases of the JDK. Please add Mockito as an agent to your build what is described in Mockito's documentation: https://javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/Mockito.html#0.3
          WARNING: A Java agent has been loaded dynamically (C:\Users\arnab\.m2\repository\net\bytebuddy\byte-buddy-agent\1.15.4\byte-buddy-agent-1.15.4.jar)
          WARNING: If a serviceability tool is in use, please run with -XX:+EnableDynamicAgentLoading to hide this warning
          WARNING: If a serviceability tool is not in use, please run with -Djdk.instrument.traceUsage for more information
          WARNING: Dynamic loading of agents will be disallowed by default in a future release
          Java HotSpot(TM) 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended

          Oh that explains all those warnings. So, it was because of testing against broken files.

          And for the build Maven produced something like this After executing ./bin/clone-repos.sh -

          --------------------------
           Build Successfull
          --------------------------
          Total Time: 5:06 min
          ...

          And after running the test "All in analysis-model".  It says 1295 test passed (green ticks), 1 ignored and in the terminal it logged all those warnings and errors in the text file that I sent earlier and at the end of the terminal after running the tests it says 

          Process finished with exit code -1 

          Arnab added a comment - - edited drulli   at java.base/java.util.ArrayList.forEach(ArrayList.java:1596) at java.base/java.util.ArrayList.forEach(ArrayList.java:1596) Caused by: org.opentest4j.AssertionFailedError:  Expecting value to be false but was true ... 4 more   [Fatal Error] :-1:-1: Premature end of file. [Fatal Error] :-1:-1: Premature end of file.  [Fatal Error] :-1:-1: Premature end of file. [Fatal Error] :-1:-1: Premature end of file. Mockito is currently self-attaching to enable the inline-mock-maker. This will no longer work in future releases of the JDK. Please add Mockito as an agent to your build what is described in Mockito's documentation: https://javadoc.io/doc/org.mockito/mockito-core/latest/org/mockito/Mockito.html#0.3 WARNING: A Java agent has been loaded dynamically (C:\Users\arnab\.m2\repository\net\bytebuddy\byte-buddy-agent\1.15.4\byte-buddy-agent-1.15.4.jar) WARNING: If a serviceability tool is in use, please run with -XX:+EnableDynamicAgentLoading to hide this warning WARNING: If a serviceability tool is not in use, please run with -Djdk.instrument.traceUsage for more information WARNING: Dynamic loading of agents will be disallowed by default in a future release Java HotSpot(TM) 64-Bit Server VM warning: Sharing is only supported for boot loader classes because bootstrap classpath has been appended Oh that explains all those warnings. So, it was because of testing against broken files. And for the build Maven produced something like this After executing ./bin/clone-repos.sh - -------------------------- Build Successfull -------------------------- Total Time: 5:06 min ... And after running the test "All in analysis-model".  It says 1295 test passed (green ticks), 1 ignored and in the terminal it logged all those warnings and errors in the text file that I sent earlier and at the end of the terminal after running the tests it says  Process finished with exit code -1

            Unassigned Unassigned
            it12lsp Christian Häussler
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: