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

Bump scalafmt version #1543

Merged
merged 7 commits into from
Jan 30, 2024
Merged

Conversation

mateuszkuta256
Copy link
Contributor

Description

Bump scalafmt version

Motivation

With older version formatting didn't work for scala3

Comment on lines -4 to +5
danglingParentheses = true
docstrings = JavaDoc
danglingParentheses.preset = true
docstrings.style = Asterisk
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not really sure if release note or 'incompatible change' action is necessary
in newer versions of scalafmt properties are a bit different

Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this is transitively incompatible as users still can define the version they want to use, right?

Copy link

@eed3si9n eed3si9n left a comment

Choose a reason for hiding this comment

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

Thanks!

@liucijus liucijus merged commit bfa9167 into bazelbuild:master Jan 30, 2024
2 checks passed
mbland added a commit to mbland/rules_scala that referenced this pull request Oct 1, 2024
As it turns out, we're using a very old version of Scalafmt that breaks
completely:

```txt
ERROR: rules_scala/test/scalafmt/BUILD:43:20:
  ScalaFmt test/scalafmt/test/scalafmt/formatted/formatted-test.scala.fmt.output failed:
  (Exit 1): scalafmt failed: error executing ScalaFmt command
  (from target //test/scalafmt:formatted-test)
bazel-out/darwin_arm64-opt-exec-ST-d57f47055a04/bin/scala/scalafmt/scalafmt
  '--jvm_flag=-Dfile.encoding=UTF-8' ... (remaining 1 argument skipped)

java.util.NoSuchElementException: last of empty IndexedSeq
```

This matches:

- scala/community-build#1680

Which mentions apparent fixes in:

- scalameta/scalameta#3235
- scalameta/scalafmt#3581

So the fix is to update Scalafmt, but given how we don't use
rules_jvm_external, that means a lot of manual updates to
third_party/repositories/scala_*.bzl. There doesn't appear to be a way
to automate this; there's no indication that the most recent update was
automated in any way:

- bazelbuild#1543

So I'll plow through all the JARs and make the necessary changes:

- https://mvnrepository.com/artifact/org.scalameta/scalafmt-core

I can't update scala_2_11, since there's not a more recent compatible
version. But the changes to scala_2_12 and scala_2_13 should be similar,
and the changes to 2_13 should apply to 3_{1,2,3,4} as well.

I had to hack .scalafmt.conf and ScalafmtWorker.scala a bit. This may
make it incompatible with 2.11.
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.

3 participants