-
Notifications
You must be signed in to change notification settings - Fork 484
fix: #860 composite gradle build #1001
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Great PR! I think the If you make that change, then the tests should pass again. If they're still failing, you might need to tweak this: spotless/plugin-gradle/src/test/java/com/diffplug/gradle/spotless/GradleIntegrationHarness.java Lines 149 to 159 in 93c80ac
|
the project.gradle.includeBuilds did not work, it yield |
Hrm... A multiproject build with no included builds should not be doing the hashCode thing. I'd be very surprised if |
Sure! I added some log lines when testing this: System.out.println("project name: " + project.getName());
System.out.println("project builds: " + project.getGradle().getIncludedBuilds().size());
System.out.println("project root project: " + project.getRootProject().getName());
System.out.println("project root project builds: " + project.getRootProject().getGradle().getIncludedBuilds().size());
System.out.println("project root project subprojects: " + project.getRootProject().getSubprojects().size()); I have 11 projects under my root project and they are defined in
I have spotless plugin defined in project1 and 2. This is what shows up when I do a gradle build in the root project $./gradlew build
> Configure project :project1
project name: project1
project builds: 0
project root project: myrootproject
project root project builds: 0
project root project subprojects: 11
Including axis libraries in the build...
classpath
classpath
> Configure project :project2
project name: project2
project builds: 0
project root project: myrootproject
project root project builds: 0
project root project subprojects: 11
I hope this helps. |
What you described above is a multi-project build. A composite build is a bit different, you'd have to use Spotless already works 100% with multiproject builds to my knowledge (I am using it on several such projects). I see from #860 that you are in fact getting the How are you applying spotless? From the |
Oh ok, hopefully this fixes that too. Each subproject has a plugin block with spotless in it, no plugin block in the root project or in settings.gradle. Let me know if you want me to try a specific configuration. |
Ahhhh... Interesting. If you specified spotless in the The What do you think about trying this? try {
// register buildService or registerDependenciesTask
} catch (InvalidUserDataException e) {
if (e.message.contains("is not a subclass of the given type")) {
// try again with the System.identityHashCode trick
}
} That way the workaround only happens when absolutely needed, and the rest of the time users get nice predictable and repeatable task names. |
…t one by parsing out the previous result.
…sk whenever necessary, but only when necessary.
Thanks for that tip on plugin management, that did work, I was traveling and did not get the chance to come back to this. |
Published in |
nedtwigg edit: fixes #860