Gradle upgrade to 5.6 broke since new gradle is claiming old dirs to be subprojects

I have a directory structure like this

  • webpieces
    • core
      • core-project1
      • core-project2
    • http
      • http1-parser
      • http2-parser

It seems gradle is now injecting the subprojects section into ‘core’ even though ‘core’ is not in my settings.gradle. Jacoco is failing as it is looking for core/output/jacoco/exec.txt which will not exist since that is not a subproject. It is only a directory containing subprojects.

I am not sure how to workaround this. Is there a realsubprojects {} closure instead of subprojects { }.

Why is ‘core’ considered a subproject since I do not have it in settings.gradle?

This feels like a gradle bug rather than a jacoco plugin bug since ‘core’ is being treated as a subproject but I could be wrong since I don’t know the details. I definitely do not want core to really do anything. It should not even have an ‘buildDir’ created at the end of the day since it is only a directory.

thanks,
Dean

How are you adding these projects in settings.gradle?

If you’re doing something like:
include ":core:core-project1"

Then core is a parent project for core-project1. This has always worked this way.

There were some changes in 4.x or 5.x that changed the characters you were allowed to use in your subproject names, but I don’t know of anything specifically in 5.6.

hmmm, yes, :core:core-project1 is exactly how I add it though core directory is empty with just actual gradle projects in it. Is there any way I can fix this issue? or does the jacoco plugin somehow have to be fixed to account for this?

I am not sure why the jacoco plugin worked in 5.3.1 but not in 5.6.3. I ran through upgrading this week to see where we broke and fix it (NOTE: It doesn’t look like it but the link goes to gradle-wrapper.properties file history to see the upgrade version history)

We could not upgrade to 6 though as that broke even more stuff. All in all, I wish upgrading gradle was more like the jdk as every upgrade seems to break stuff :(. feels like ruby days which is sad since otherwise gradle is sooooo powerful.

ah, I have narrowed it down to this section. NOTE the findAll piece section like so

    executionData = files(executionData.findAll {
        it.exists()
    })

that exists in this section. It seems to no longer work so how to fix in 5.6 gradle…

task jacocoTestReport(type: org.gradle.testing.jacoco.tasks.JacocoReport) {
dependsOn = subprojects.test
additionalSourceDirs = files(subprojects.sourceSets.main.allSource.srcDirs)
sourceDirectories = files(subprojects.sourceSets.main.allSource.srcDirs)
classDirectories = files(subprojects.sourceSets.main.output)
executionData = files(subprojects.jacocoTestReport.executionData)
reports {
html.enabled = true
xml.enabled = true
csv.enabled = false
}
onlyIf = {
true
}
doFirst {
executionData = files(executionData.findAll {
it.exists()
})
}
}