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

Pre-Scala 2.13: Upgrade dependencies to versions also available for Scala 2.13 #522

Merged
merged 1 commit into from
Sep 10, 2024

Conversation

rtyley
Copy link
Member

@rtyley rtyley commented Aug 6, 2024

As preparation for Scala 2.13, this updates all dependencies so that they are at versions that are available for Scala 2.13 as well as Scala 2.12.

As ScalaTest is updated to ScalaTest v3.2, we had to do some code updates to cope with class/package changes. We did these manually, though later we remembered that maybe we could have used Scalafix, as in this example here:

The steps would have been:

  • add sbt-scalafix plugin to user-level sbt plugins file
    • addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.12.1")
  • checked out main branch, still scala 2.12 (and so already compiled successfully)
  • launch sbt
  • run scalafixEnable
  • run scalafixAll dependency:[email protected]:autofix:3.1.0.1
  • increment scalatest dependency

@rtyley rtyley added the Scala 2.13 See https://github.com/guardian/maintaining-scala-projects/issues/2 label Aug 7, 2024
@rtyley rtyley force-pushed the pre-scala-2.13-upgrade-dependencies branch 2 times, most recently from 2e93657 to b548f05 Compare August 7, 2024 09:52
@rtyley rtyley marked this pull request as ready for review August 7, 2024 09:54
…cala 2.13

As preparation for Scala 2.13, this updates all dependencies so that they
are at versions that are available for Scala 2.13 as well as Scala 2.12.

As ScalaTest is updated to ScalaTest v3.2, we had to do some code updates
to cope with class/package changes. We did these manually, though later
we remembered that maybe we could have used Scalafix, as in this example here:

* guardian/content-api#2893

The steps would have been:

- add sbt-scalafix plugin to user-level sbt plugins file
  - addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.12.1")
- checked out main branch, still scala 2.12 (and so already compiled successfully)
- launch sbt
- run `scalafixEnable`
- run `scalafixAll dependency:[email protected]:autofix:3.1.0.1`
- increment scalatest dependency
@rtyley rtyley force-pushed the pre-scala-2.13-upgrade-dependencies branch from b548f05 to d13cec2 Compare September 10, 2024 15:56
@rtyley rtyley requested a review from JamieB-gu September 10, 2024 15:56
@rtyley rtyley merged commit baef40a into main Sep 10, 2024
3 checks passed
@rtyley rtyley deleted the pre-scala-2.13-upgrade-dependencies branch September 10, 2024 16:20
@prout-bot
Copy link

Overdue on PROD (merged by @rtyley 30 minutes and 3 seconds ago) What's gone wrong?

@prout-bot
Copy link

Seen on PROD (merged by @rtyley 45 minutes and 25 seconds ago) Please check your changes!

@rtyley
Copy link
Member Author

rtyley commented Sep 10, 2024

We reverted this with #531 because it stopped servers from starting - we were able to find this error by ssm-ing to the machine:

Sep 10 17:05:22 ip-10-248-202-215 systemd[1]: Starting tag manager...
Sep 10 17:05:23 ip-10-248-202-215 systemd[1]: Started tag manager.
Sep 10 17:05:23 ip-10-248-202-215 tag-manager[1869]: Picked up JAVA_TOOL_OPTIONS: -javaagent:/usr/local/log4j-hotpatch/Log4jHotPatch.jar=log4jFixerVerbose=false
Sep 10 17:05:24 ip-10-248-202-215 tag-manager[1869]: SLF4J(W): No SLF4J providers were found.
Sep 10 17:05:24 ip-10-248-202-215 tag-manager[1869]: SLF4J(W): Defaulting to no-operation (NOP) logger implementation
Sep 10 17:05:24 ip-10-248-202-215 tag-manager[1869]: SLF4J(W): See https://www.slf4j.org/codes.html#noProviders for further details.
Sep 10 17:05:24 ip-10-248-202-215 tag-manager[1869]: SLF4J(W): Class path contains SLF4J bindings targeting slf4j-api versions 1.7.x or earlier.
Sep 10 17:05:24 ip-10-248-202-215 tag-manager[1869]: SLF4J(W): Ignoring binding found at [jar:file:/usr/share/tag-manager/lib/ch.qos.logback.logback-classic-1.2.11.jar!/org>
Sep 10 17:05:24 ip-10-248-202-215 tag-manager[1869]: SLF4J(W): See https://www.slf4j.org/codes.html#ignoredBindings for an explanation.
Sep 10 17:05:24 ip-10-248-202-215 tag-manager[1869]: Oops, cannot start the server.
Sep 10 17:05:24 ip-10-248-202-215 tag-manager[1869]: java.lang.ClassCastException: org.slf4j.helpers.NOPLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext
Sep 10 17:05:24 ip-10-248-202-215 tag-manager[1869]:         at play.api.libs.logback.LogbackLoggerConfigurator.configure(LogbackLoggerConfigurator.scala:91)
Sep 10 17:05:24 ip-10-248-202-215 tag-manager[1869]:         at play.api.libs.logback.LogbackLoggerConfigurator.configure(LogbackLoggerConfigurator.scala:73)
Sep 10 17:05:24 ip-10-248-202-215 tag-manager[1869]:         at play.api.libs.logback.LogbackLoggerConfigurator.configure(LogbackLoggerConfigurator.scala:35)
Sep 10 17:05:24 ip-10-248-202-215 tag-manager[1869]:         at AppLoader.$anonfun$load$1(AppLoader.scala:9)
Sep 10 17:05:24 ip-10-248-202-215 tag-manager[1869]:         at AppLoader.$anonfun$load$1$adapted(AppLoader.scala:9)
Sep 10 17:05:24 ip-10-248-202-215 tag-manager[1869]:         at scala.Option.foreach(Option.scala:407)
Sep 10 17:05:24 ip-10-248-202-215 tag-manager[1869]:         at AppLoader.load(AppLoader.scala:9)
Sep 10 17:05:24 ip-10-248-202-215 tag-manager[1869]:         at play.core.server.ProdServerStart$.start(ProdServerStart.scala:53)
Sep 10 17:05:24 ip-10-248-202-215 tag-manager[1869]:         at play.core.server.ProdServerStart$.main(ProdServerStart.scala:29)
Sep 10 17:05:24 ip-10-248-202-215 tag-manager[1869]:         at play.core.server.ProdServerStart.main(ProdServerStart.scala)
Sep 10 17:05:24 ip-10-248-202-215 systemd[1]: tag-manager.service: Main process exited, code=exited, status=255/EXCEPTION
Sep 10 17:05:24 ip-10-248-202-215 systemd[1]: tag-manager.service: Failed with result 'exit-code'.

This has been fixed with #532.

rtyley added a commit that referenced this pull request Sep 11, 2024
…cala 2.13

This is a repeat of the work in #522,
which was reverted with #531 due to
a runtime exception on startup:

As preparation for Scala 2.13, this updates all dependencies so that they
are at versions that are available for Scala 2.13 as well as Scala 2.12.

As ScalaTest is updated to ScalaTest v3.2, we had to do some code updates
to cope with class/package changes. We did these manually, though later
we remembered that maybe we could have used Scalafix, as in this example here:

* guardian/content-api#2893

The steps would have been:

- add sbt-scalafix plugin to user-level sbt plugins file
  - addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.12.1")
- checked out main branch, still scala 2.12 (and so already compiled successfully)
- launch sbt
- run `scalafixEnable`
- run `scalafixAll dependency:[email protected]:autofix:3.1.0.1`
- increment scalatest dependency
rtyley added a commit that referenced this pull request Sep 11, 2024
…cala 2.13

This is a repeat of the work in #522,
previously reverted with #531 due to
a runtime SLF4J error on startup:

```
java.lang.ClassCastException: org.slf4j.helpers.NOPLoggerFactory cannot be cast to ch.qos.logback.classic.LoggerContext:
```

This error occurred because we were including an update to `content-api-client-default`
that took it past version v28.0.0 (https://github.com/guardian/content-api-scala-client/releases/tag/v28.0.0),
which upgraded `slf4j-api` to v2, which no longer honours the old static binder
mechanism for finding logging providers (https://www.slf4j.org/codes.html#ignoredBindings).
Logback v1.3+ copes with this, and is used by Play v2.9. However, upgrading Play
is another chunk of work, so I'm going to avoid that with this change, and stick to
CAPI client v27.0.0.

### Description of original work

As preparation for Scala 2.13, this updates all dependencies so that they
are at versions that are available for Scala 2.13 as well as Scala 2.12.

As ScalaTest is updated to ScalaTest v3.2, we had to do some code updates
to cope with class/package changes. We did these manually, though later
we remembered that maybe we could have used Scalafix, as in this example here:

* guardian/content-api#2893

The steps would have been:

- add sbt-scalafix plugin to user-level sbt plugins file
  - addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.12.1")
- checked out main branch, still scala 2.12 (and so already compiled successfully)
- launch sbt
- run `scalafixEnable`
- run `scalafixAll dependency:[email protected]:autofix:3.1.0.1`
- increment scalatest dependency
@rtyley rtyley mentioned this pull request Oct 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Scala 2.13 See https://github.com/guardian/maintaining-scala-projects/issues/2 Seen-on-PROD
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants