[JIRA] (JENKINS-62087) Detect Gradle module names

0 views
Skip to first unread message

jhansche@meetme.com (JIRA)

unread,
Apr 28, 2020, 7:29:03 PM4/28/20
to jenkinsc...@googlegroups.com
Joe Hansche created an issue
 
Jenkins / New Feature JENKINS-62087
Detect Gradle module names
Issue Type: New Feature New Feature
Assignee: Ulli Hafner
Components: warnings-ng-plugin
Created: 2020-04-28 23:28
Priority: Major Major
Reporter: Joe Hansche

Currently ModuleDetector[1] is capable of detecting module names from pom.xml files, build.xml files, and MANIFEST.MF files. But I would also like to look for Gradle module names.

Typically in a multi-module Gradle project, the module name would match the subdirectory that the module is in, but it can also be overridden by settings.gradle[2]. The easy way would be to find the build.gradle file the same way it looks for the other files, and take that file's parent directory name:

./
|-- settings.gradle
|-- build.gradle
    |-- moduleA/
        |-- build.gradle
        |-- build/   (contains for example **/checkstyle-result.xml)
    |-- moduleB/
        |-- build.gradle
        |-- build/

So as an example, when we find ./moduleA/build/reports/checkstyle/checkstyle-result.xml, that belongs to the ":moduleA" gradle module.

[1] https://github.com/jenkinsci/analysis-model/blob/master/src/main/java/edu/hm/hafner/analysis/ModuleDetector.java
[2] https://docs.gradle.org/current/userguide/organizing_gradle_projects.html

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo

ullrich.hafner@gmail.com (JIRA)

unread,
Apr 29, 2020, 7:01:03 AM4/29/20
to jenkinsc...@googlegroups.com
Ulli Hafner edited a comment on New Feature JENKINS-62087
 
Re: Detect Gradle module names
Yes, that would be a nice improvement! Interested in providing a PR?

ullrich.hafner@gmail.com (JIRA)

unread,
Apr 29, 2020, 7:01:04 AM4/29/20
to jenkinsc...@googlegroups.com
Ulli Hafner assigned an issue to Unassigned
 

Yes, that would be a nice improvement!

Jenkins / New Feature JENKINS-62087
Detect Gradle module names
Change By: Ulli Hafner
Component/s: analysis-model
Component/s: warnings-ng-plugin
Labels: help-wanted newbie-friendly
Assignee: Ulli Hafner

jhansche@meetme.com (JIRA)

unread,
Apr 29, 2020, 11:36:03 AM4/29/20
to jenkinsc...@googlegroups.com

I was planning to put together a PR last night and then I had to stop.

One question is: would it be worth it to read the full Gradle model to figure out the resolved and configured module names, or should we just start with a way to detect the common base directory name between the report file and the nearest build.gradle file?  The base directory would work for the most common scenario, but it's possible to redefine the module name or the $buildDir in which case it might not even be moduleA/build/.

I'll take a first pass at the simple case, and see if it proves useful.

ullrich.hafner@gmail.com (JIRA)

unread,
Apr 29, 2020, 3:01:02 PM4/29/20
to jenkinsc...@googlegroups.com

I think it makes sense to start with the simple case. I think for the other approaches we also tried to be as simple as possible. We can refine that later on if someone encounters problems.

jhansche@meetme.com (JIRA)

unread,
Apr 29, 2020, 4:03:02 PM4/29/20
to jenkinsc...@googlegroups.com

Makes sense - I've pushed the simple case(s) with just looking for parent directory names of build.gradle, to my fork (haven't opened a PR yet), and also working on a way to parse the rootProject name from settings.gradle.

The rootProject case might be worth resolving, because most Jenkins projects will checkout their SCM into the workspace directory which matches the Jenkins job name (usually).  So this might treat anything in the root project as if moduleName=jenkins-job-name.

You can check out current progress here: https://github.com/jhansche/analysis-model/commits/pr-62087

jhansche@meetme.com (JIRA)

unread,
Apr 29, 2020, 5:47:03 PM4/29/20
to jenkinsc...@googlegroups.com
Change By: Joe Hansche
Status: In Progress Review

jhansche@meetme.com (JIRA)

unread,
Apr 29, 2020, 5:47:03 PM4/29/20
to jenkinsc...@googlegroups.com
Joe Hansche started work on New Feature JENKINS-62087
 
Change By: Joe Hansche
Status: Open In Progress

jhansche@meetme.com (JIRA)

unread,
Apr 29, 2020, 5:47:03 PM4/29/20
to jenkinsc...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages