Centralize spotless setup as a buildSrc convention plugin.#11384
Centralize spotless setup as a buildSrc convention plugin.#11384AlexeyKuznetsov-DD wants to merge 4 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
There was a problem hiding this comment.
Nice, but finally I applied a bit different approach.
| 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.
There was a problem hiding this comment.
Agree. Refactored to apply per project at java_no_deps.gradle
What Does This Do
Move the Spotless configuration out of
gradle/spotless.gradleinto abuildSrcconvention plugin (dd-trace-java.spotless-conventions). Also upgrades Spotless to8.5.0and tweaks a dedicated CI job with extra heap to avoid OOM.Motivation
Refactor legacy Groovy scripts to modern Kotlin convention plugins.
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 errors and 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: