Add Eclipse JDT embedded lockfiles, upgrade formatter version to 4.40 - #3000
Add Eclipse JDT embedded lockfiles, upgrade formatter version to 4.40#3000scordio wants to merge 6 commits into
Conversation
I tried that locally, but it seems I have some cache configuration errors. Logs |
|
Excellent start! The lockfiles you have right now are keyed in only on the "root" dependency - The lockfiles need to set the version of all transitive dependencies, and then the maven configuration needs to be initialized with "downloadTransitives=false" and then explicitly seeded with all the needed transitives and their versions. The reason for this is that Eclipse tends to specify transitives in a wide range, see for examples: Now, it looks like Eclipse may have changed its policy for recent releases. I just looked at the metadata for 4.40, and I was surprised to see that it specified exact versions rather than broad ranges. So I think there's two options forward:
Doing A is easier. And it has the nice benefit that after A has been merged, you can always go back and do B and then we could turn it on for all versions at any time. Happy to move forward with either. |
# Conflicts: # CHANGES.md # plugin-gradle/CHANGES.md # plugin-maven/CHANGES.md
6331dcc to
045ea2a
Compare
The first version on Maven Central having exact versions seems to be 3.32.0. I think the discussion about having exact versions happened at: and the change that actually did it is: merged in October 2022, before 3.32.0 was published in December. |
I solved my local issues by pinning the Eclipse version to 4.40 in diff --git a/gradle/spotless.gradle b/gradle/spotless.gradle
--- a/gradle/spotless.gradle
+++ b/gradle/spotless.gradle
@@ -6,8 +6,8 @@
ratchetFrom 'origin/main'
bumpThisNumberIfACustomStepChanges(1)
licenseHeaderFile rootProject.file('gradle/spotless.license')
- importOrderFile rootProject.file('gradle/spotless.importorder')
- eclipse().configFile rootProject.file('gradle/spotless.eclipseformat.xml')
+ importOrderFile rootProject.file('gradle/spotless.importorder')
+ eclipse('4.40').configFile rootProject.file('gradle/spotless.eclipseformat.xml')
trimTrailingWhitespace()
removeUnusedImports()
formatAnnotations()
@@ -17,7 +17,7 @@
}
groovyGradle {
target '*.gradle', 'gradle/*.gradle'
- greclipse().configFile rootProject.files('gradle/spotless.eclipseformat.xml', 'gradle/spotless.groovyformat.prefs')
+ greclipse('4.40').configFile rootProject.files('gradle/spotless.eclipseformat.xml', 'gradle/spotless.groovyformat.prefs')
}
format 'dotfiles', {
target '.gitignore', '.gitattributes', '.editorconfig' |
I initially implemented A with 8bb5194, but then spent a bit more time and also implemented B with 71c40eb 🙃 Happy to know what you think! |
This PR introduces lockfiles for the Eclipse JDT formatter, falling back to today's behavior via P2 resolution if an embedded lockfile for the selected version doesn't exist.
In addition, the default JDT version is now upgraded to the latest available (4.40), and embedded lockfiles have been added for versions 4.40, 4.39, 4.11, and 4.9. The rationale for covering the last two is only because those versions appeared in test code, but please let me know what the proper version range should be, and I'll happily adjust this PR and/or introduce missing lockfiles.
To support maintenance and future lockfile generation, I added a new
EclipseJdtLockfileMetadataToolamong the test classes. This class has twomainentry points that can be manually invoked to either verify or update the existing lockfiles by resolvingorg.eclipse.jdt.coreversions directly from the metadata available athttps://download.eclipse.org/eclipse/updates/. If you think there is a better approach to achieve the same, please let me know, and I'd be happy to update my changes.Disclaimer: this is my first Spotless contribution and I wasn't familiar with its codebase and internal architecture. For this reason, I used GitHub Copilot to navigate through it, brainstorm on a possible solution, and implement the self-contained
EclipseJdtLockfileMetadataToolclass to make lockfile maintenance easier. Nevertheless, I went through and updated pretty much everything that Copilot generated.Please DO NOT FORCE PUSH. Don't worry about messy history, it's easier to do code review if we can tell what happened after the review, and force pushing breaks that.
Please make sure that your PR allows edits from maintainers. Sometimes it's faster for us to just fix something than it is to describe how to fix it.
After creating the PR, please add a commit that adds a bullet-point under the
[Unreleased]section of CHANGES.md, plugin-gradle/CHANGES.md, and plugin-maven/CHANGES.md which includes:If your change only affects a build plugin, and not the lib, then you only need to update the
plugin-foo/CHANGES.mdfor that plugin.If your change affects lib in an end-user-visible way (fixing a bug, updating a version) then you need to update
CHANGES.mdfor both the lib and all build plugins. Users of a build plugin shouldn't have to refer to lib to see changes that affect them.This makes it easier for the maintainers to quickly release your changes :)