Centralize spotless setup as a buildSrc convention plugin.#11384
Centralize spotless setup as a buildSrc convention plugin.#11384AlexeyKuznetsov-DD wants to merge 6 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).
There was a problem hiding this comment.
Wait I'm thinking, about something to handle test-published-dependencies/. The spot convention could be something to put in the future included build build-logic/.
So this could be imported there. 🤔
See the pointer I left on #11404.
bric3
left a comment
There was a problem hiding this comment.
That's a nice simplification! I found a few other simple gotcha, otherwise good to go !
| `java-gradle-plugin` | ||
| `kotlin-dsl` | ||
| `jvm-test-suite` | ||
| id("com.diffplug.spotless") version "8.4.0" |
There was a problem hiding this comment.
note: This actually removes spotless from the buildSrc project
There was a problem hiding this comment.
I moved it inside spotless convention plugin, see
To process whole dd-trace-java with single ./gradlew spotlessApply command.
Also folders like test-published-dependencies will be processed too.
There was a problem hiding this comment.
Imho this looks incorrect to modify these project from the main dd-trace-java.
| "ktlint_standard_trailing-comma-on-declaration-site" to "disabled" | ||
| ) | ||
|
|
||
| val EXCLUDED_PROJECTS = setOf(":dd-java-agent:agent-jmxfetch") |
There was a problem hiding this comment.
issue: This looks wrong. Spotless was applied to this module before.
There was a problem hiding this comment.
Hmm, as far as I understand it is external project that injected into dd-trace-java and it should have its own spotless or other way to clean code.
There was a problem hiding this comment.
:dd-java-agent:agent-jmxfetch is from us, but dd-java-agent/agent-jmxfetch/integrations-core is a git submodule.
| ) | ||
| } | ||
|
|
||
| private fun configureProjectFormatting(project: Project) { |
There was a problem hiding this comment.
issue: It seems that project-local markdown and misc formats were not carried over.
There was a problem hiding this comment.
Not sure what is wrong, but I can see in my branch the following changes
I actually think we need to add folders like .claude, docs to process md files.
Let me know WDYT?
There was a problem hiding this comment.
It's just that I don;t sse markdown and misc being configured, so that seems a bit strange, compared to previous spotless.gradle.
dd-trace-java/gradle/spotless.gradle
Lines 77 to 90 in 198a35d
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: