Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Convert scalafmt integration to use a compile-only sourceset #1283

Merged

Conversation

mdedetrich
Copy link
Contributor

@mdedetrich mdedetrich commented Aug 22, 2022

public String apply(String input) throws Exception {
ScalafmtConfig config;
if (configSignature.files().isEmpty()) {
// Note that reflection is used here only because Scalafmt has a method called
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One way around this may be that instead of defining ScalafmtFormatterFunc as a Java source file, instead we can define it as a Scala source file (which with a basic class Java has no issues calling). Not sure if this is possible or even desirable

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be okay putting Scala into our codebase if it was really useful for some task, but this is small enough that I'd prefer the reflection. Note the little refactor I did in a75877c.

@mdedetrich mdedetrich force-pushed the scalafmt-compile-time-only-sourceset branch 2 times, most recently from ea185c5 to d0e5667 Compare August 22, 2022 11:40
@mdedetrich mdedetrich force-pushed the scalafmt-compile-time-only-sourceset branch from d0e5667 to 966f33d Compare August 22, 2022 11:43
@mdedetrich mdedetrich force-pushed the scalafmt-compile-time-only-sourceset branch from 966f33d to 781eb68 Compare August 22, 2022 11:57
@nedtwigg
Copy link
Member

nedtwigg commented Aug 22, 2022

NBD, but please push new commits instead of force-pushing. Easier to review only what has changed that way :)

@nedtwigg
Copy link
Member

Also thanks for this very good PR, it will definitely get merged :D

@mdedetrich
Copy link
Contributor Author

So I just added a commit which implements the scalaMajorVersion configuration as well as resolving conflicts from master branch. Let me know if anything else is needed!

@mdedetrich
Copy link
Contributor Author

CI is passing now, forgot about the newly formatted files and accidentally deleted a line which I didn't realize.

@mdedetrich mdedetrich requested a review from nedtwigg August 22, 2022 23:56
@mdedetrich
Copy link
Contributor Author

mdedetrich commented Aug 23, 2022

Just pushed some commits regarding updates/changes in the documentation.

…lved in serialization/equality, so good to eagerly initialize in the constructor.
@nedtwigg
Copy link
Member

Thanks very much! I'm ready to merge this when you are. My planned commit message:

Add support for setting scala version for scalafmt, and also convert to compile-time (#1283 fixes #1273 helps with #524)

@mdedetrich
Copy link
Contributor Author

Perfect, happy with the commit message so feel free to merge and thanks for being responsive on the PR!

@nedtwigg nedtwigg enabled auto-merge August 23, 2022 20:03
@nedtwigg nedtwigg merged commit 24b8d3a into diffplug:main Aug 23, 2022
@mdedetrich mdedetrich deleted the scalafmt-compile-time-only-sourceset branch August 23, 2022 21:25
@nedtwigg
Copy link
Member

Published in plugin-gradle 6.10.0 and plugin-maven 2.25.0.

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

Successfully merging this pull request may close these issues.

2 participants