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

Upgrade to Play 2.9, fix Scala Steward #464

Merged
merged 1 commit into from
Mar 20, 2024

Conversation

rtyley
Copy link
Member

@rtyley rtyley commented Mar 20, 2024

This upgrade to Play 2.9 was prompted by guardian/scala-steward-public-repos#67 which requires that all projects that want to have Scala Steward updates (like this one) need to be able to build under Java 21 (even if the projects are still running in production on Java 11).

Building under Java 21 requires a recent version of sbt, and that leads to a version bump for scala-xml that gives version-compatibility errors:

[error] 	* org.scala-lang.modules:scala-xml_2.12:2.1.0 (early-semver) is selected over {1.2.0, 1.1.1}
[error] 	    +- org.scala-lang:scala-compiler:2.12.18              (depends on 2.1.0)
[error] 	    +- com.typesafe.sbt:sbt-native-packager:1.5.2 (scalaVersion=2.12, sbtVersion=1.0) (depends on 1.1.1)
[error] 	    +- com.typesafe.play:twirl-api_2.12:1.5.1             (depends on 1.2.0)

...the nicest way to fix these errors is to upgrade to Play 2.9 or above, so here we are!

https://github.com/guardian/pan-domain-authentication didn't get Play 2.9 artifacts until relatively recently, so upgrading the Panda version was also necessary.

See also:

(unfortunately the Scala Steward run failing affects everyone, see guardian/scala-steward-public-repos#60 - so I've removed typerighter from Scala Steward until this PR is merged)

Comment on lines -129 to -137
initialize := {
val _ = initialize.value
val expectedJavaVersion = parseJavaVersionNumber(javaVersionNumber)
val actualJavaVersion = removeStartingOne(sys.props("java.specification.version"))
assert(
expectedJavaVersion.equals(actualJavaVersion),
s"Java $expectedJavaVersion is required for this project. You are using Java $actualJavaVersion."
)
},
Copy link
Member Author

Choose a reason for hiding this comment

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

We now require that projects be able to build with Java 21 if they're using Scala Steward, even if they aren't using Java 21, so this strict rule here of requiring exactly Java 11 for the build is not helpful. We could have changed it to a greater-than-or-equals condition, but that's already accomplished by the -release:11 config already present:

"-release:11",

This upgrade to Play 2.9 was prompted by guardian/scala-steward-public-repos#67
which means that all projects that want to have Scala Steward updates (like this one)
need to be able to _build_ under Java 21 (even if the projects are still _running_ in
production on Java 11).

Building under Java 21 requires a recent version of sbt, and that leads to a version
bump for `scala-xml` that gives version-compatibility errors:

```
[error] 	* org.scala-lang.modules:scala-xml_2.12:2.1.0 (early-semver) is selected over {1.2.0, 1.1.1}
[error] 	    +- org.scala-lang:scala-compiler:2.12.18              (depends on 2.1.0)
[error] 	    +- com.typesafe.sbt:sbt-native-packager:1.5.2 (scalaVersion=2.12, sbtVersion=1.0) (depends on 1.1.1)
[error] 	    +- com.typesafe.play:twirl-api_2.12:1.5.1             (depends on 1.2.0)
```

...the nicest way to fix these errors is to upgrade to Play 2.9 or above, so here we are!

https://github.com/guardian/pan-domain-authentication didn't get Play 2.9 artifacts until
relatively recently, so upgrading the Panda version was also necessary.

See also:
* guardian/maintaining-scala-projects#1
@rtyley rtyley force-pushed the upgrade-to-play-29-and-fix-scala-steward branch from b12225d to e290496 Compare March 20, 2024 14:58
@rtyley rtyley marked this pull request as ready for review March 20, 2024 15:09
@rtyley rtyley requested a review from a team as a code owner March 20, 2024 15:09
Copy link
Member

@davidfurey davidfurey left a comment

Choose a reason for hiding this comment

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

LGTM. Any reason not to go straight to Play 3.0?

@rtyley
Copy link
Member Author

rtyley commented Mar 20, 2024

Any reason not to go straight to Play 3.0?

I'm just minimising what I need to check before fixing Scala Steward!

@rtyley rtyley merged commit b69b899 into main Mar 20, 2024
1 check passed
@rtyley rtyley deleted the upgrade-to-play-29-and-fix-scala-steward branch March 20, 2024 16:42
@prout-bot
Copy link

Overdue on Checker (merged by @rtyley 1 hour, 44 minutes and 57 seconds ago) What's gone wrong?

@prout-bot
Copy link

Seen on Rule Manager (merged by @rtyley 1 hour, 44 minutes and 57 seconds ago) Please check your changes!

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

Successfully merging this pull request may close these issues.

3 participants