Repository navigation
Fix GrEclipse leaving a file%3A directory in the working directory - #3162
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing. Review the Copilot code review billing settings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2019 (and its duplicate #2726).
Problem
Every JVM that starts the GrEclipse formatter leaves an empty
file%3A%2Ftmp%2Fspotless-groovy-instance<N>%2F/JarUrlResolver/directory in its working directory. That's the project root under Maven, andlib-extra/when Spotless's own tests run. You get one per GrEclipse version per run, so they pile up.Root cause
GrEclipseFormatterStepImplpasses a temp dir asosgi.instance.area. Solstice'sBundleContextShimnormalizes that value to a URL (file:/tmp/spotless-groovy-instance<N>/).ShimIdeBootstrapServices.applythen builds theJarUrlResolverdir from it like this:URL-encoding turns the whole URL into a single relative file name.
JarUrlResolver's constructor thenmkdirs()that name in the working directory. This happens for any explicit instance area, whatever form the path takes, and Solstice 1.8.2 (the latest) still has the same code.Fix
Pass the temp dir as
osgi.instance.area.defaultinstead ofosgi.instance.area.osgi.instance.areaisn't set, so the instance location (and the.metadatawritten there) stays in the temp dir.osgi.instance.area, so it no longer creates the stray directory.The only side effect: Solstice no longer registers its
jar:URLConverter. The directories it created were always empty, so formatting never used it. Dropping the instance area altogether would not work, because Equinox would then fall back to<working dir>/workspace.Tests
GrEclipseFormatterStepTest.doesNotCreateDirectoriesInWorkingDirectory. It formats with the default version, then asserts the working directory has nofile%3A*entry.mainit fails, listing thefile%3A%2Fvar%2Ffolders%2F...spotless-groovy-instance...%2Fdirectory.lib-extra/file%3A*directories first, or this test will flag them../gradlew :lib-extra:test,:plugin-maven:test --tests com.diffplug.spotless.maven.groovy.GrEclipseTest,:lib-extra:spotlessCheck,:lib-extra:spotbugsMainand:spotlessCheckall pass.