Centralize spotless setup as a buildSrc convention plugin.#11384
Centralize spotless setup as a buildSrc convention plugin.#11384AlexeyKuznetsov-DD wants to merge 3 commits into
Conversation
| version = versionFromFile | ||
|
|
||
| apply from: "$sharedConfigDirectory/repositories.gradle" | ||
| apply from: "$sharedConfigDirectory/spotless.gradle" |
There was a problem hiding this comment.
note: FYI test-published-dependencies/ is a complete different project. And it doesn't have access to the included build that buildSrc is (unless we do something different).
| predeclareDeps() | ||
| } | ||
|
|
||
| with(extensions["spotlessPredeclare"] as SpotlessExtension) { |
There was a problem hiding this comment.
note: 8.5.0 allows to use spotlessPredeclare {} directly
| val spotlessExcludedProjects = setOf(":dd-java-agent:agent-jmxfetch") | ||
|
|
||
| // Spotless applied per-module for parallel execution, configured centrally here. | ||
| allprojects { |
There was a problem hiding this comment.
suggestion: I think I wouldn't use allproject it breaks isolation: they do cross-project configuration, this coupling is usually a bad thing and it can also affect negatively the capability of having a working configuration cache.
Instead, I suggest to apply the same spotless convention plugin, were it was declared before, in particular the root build.gradle.kts and in the java_no_deps.gradle.
And, let this plugin react differently if it's the root project or not, like it is in the body of the allproject lambda.
I'm not quite sure, at this point, but it might be sensible to declare spotless directly in the test-published-dependencies/, the project is less prone to modifications and doesn't have a lot of code.
What Does This Do
Move the Spotless configuration out of
gradle/spotless.gradleinto abuildSrcconvention plugin (dd-trace-java.spotless-conventions). Modules now opt in by applying the plugin id instead ofapply from: .... Also upgrades Spotless to8.5.0and tweaks a dedicated CI job with extra heap to avoid OOM.Motivation
The legacy
apply from:script was duplicated across every module. The convention plugin removes all the boilerplate.Additional Notes
To simplify review this PR has ONLY BUILD CHANGES!!! for now. Once reviewed I will run
spotlessApplybefore merge to master.Note
For the first run, it’s recommended to execute the following commands to avoid spotless crashing with an
OutOfMemoryErroror hanging during GC:After the initial run, the spotless artifacts will be cached, and it should be safe to run it as usual: