Add scalafmt plugin to scala-play-server generator

IN
6h ago
+229-83

Part of #23274 — adds the scalafmt setup to the scala-play-server generator, following the same pattern as the already-merged generators (scala-http4s, scala-sttp, scala-finch, etc., e.g. #23300).

What changed

  • ScalaPlayFrameworkServerCodegen: generate a .scalafmt.conf supporting file.
  • New scala-play-server/scalafmt.mustache template (scalafmt 3.10.6, runner.dialect = scala212 — same configuration as scala-finch, which also targets Scala 2.12).
  • scala-play-server/project/plugins.sbt.mustache: add the org.scalameta sbt-scalafmt 2.5.6 plugin (sbt 1.2.4 is used by this generator, so the plugin is compatible).
  • Regenerated samples/server/petstore/scala-play-server (the sample was last generated at 5.0.0-SNAPSHOT, so the diff also carries unrelated pending template drift such as the @Generated annotation and import changes).

Notes for the remaining generators from #23274

  • scalatra is being decommissioned (#24525), so it is intentionally skipped.
  • scalaz still targets Scala 2.11 / sbt 0.13.15; modern sbt-scalafmt does not support sbt 0.13, so enabling scalafmt there would require a build toolchain bump first.
  • scala-lagom-server has no sample config (bin/configs), so it is left for a follow-up.

PR checklist

  • Read the contribution guidelines.
  • Regenerated the affected sample via ./bin/generate-samples.sh bin/configs/unmaintained/scala-play-server.yaml; no files deleted.
  • Pull request is created against the master branch.

Summary by cubic

Adds scalafmt formatting setup to the scala-play-server generator, matching what was already merged for other Scala generators. Generated projects now include a .scalafmt.conf (scalafmt 3.10.6, scala212 dialect), the sbt-scalafmt 2.5.6 plugin, and an sbt bump to 1.10.11 so the plugin loads reliably.

Part of #23274.

Sample regeneration

  • The regenerated petstore sample also picks up unrelated pending template drift (@Generated annotations, import and spec changes) because it was last generated at 5.0.0-SNAPSHOT and is now at 7.27.0-SNAPSHOT.

Remaining generators

  • scalatra is skipped since it's being decommissioned.
  • scalaz still targets Scala 2.11 / sbt 0.13, which modern sbt-scalafmt doesn't support.
  • scala-lagom-server has no sample config and is left for a follow-up.