Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Modify IDE Hook to work with configuration cache #2278

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

lehmanju
Copy link

@lehmanju lehmanju commented Sep 26, 2024

This changes the implementation of the IDE hook to work with Gradle's configuration cache. Essentially, the old IDE hook implementation is deleted and the execution of the regular spotless task is augmented to filter the files before applying changes. If the property is missing, it just works like before.

As stdIn/stdOut properties are missing, I don't expect this to be merged in its current state, but I'd like to hear some feedback whether the approach is feasible. Ideally, I would also integrate #1101.

fixes #1082

@lehmanju
Copy link
Author

I changed the behavior to enable/disable the task based on whether a file is in the target set. This works quite well and avoids task execution for all other projects.

@nedtwigg
Copy link
Member

This seems like a great approach if you can get it to work!

@nedtwigg
Copy link
Member

Oh! Sorry, I spoke a bit too soon. This is going to interact a bit with the linting changes...

I'll try to get this ironed out this weekend...

@lehmanju
Copy link
Author

lehmanju commented Oct 3, 2024

This seems like a great approach if you can get it to work!

Yeah, the only thing that isn't working right now is the IDEHook test.

Tasks with empty target are disabled, which leaves only one task with exactly one file. Reexecuting on the same file successfully uses the configuration cache.

I plan to look into supporting multiple files at once. Maybe this can be integrated into IntelliJ IDEA to format all files before commiting.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

spotlessIdeHook and configuration cache
2 participants