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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 6 additions & 23 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ val languageToolVersion = "6.0"
val awsSdkVersion = "1.12.576"
val capiModelsVersion = "17.5.1"
val capiClientVersion = "19.2.1"
val pandaVersion = "3.0.1"
val circeVersion = "0.14.1"
val scalikejdbcVersion = scalikejdbc.ScalikejdbcBuildInfo.version
val scalikejdbcPlayVersion = "2.8.0-scalikejdbc-3.5"
Expand All @@ -37,15 +38,6 @@ def javaVersionNumber = {
IO.read(new File(".java-version"))
}

def removeStartingOne(javaVersionString: String): String = {
val startsWithOne = "^1\\.".r
startsWithOne.replaceAllIn(javaVersionString, "")
}

def parseJavaVersionNumber(javaVersionString: String): String = {
removeStartingOne(javaVersionString).split('.').head
}

val jackson = {
val version = "2.14.2"
Seq(
Expand Down Expand Up @@ -77,11 +69,11 @@ val commonSettings = Seq(
libraryDependencies ++= Seq(
"com.amazonaws" % "aws-java-sdk-secretsmanager" % awsSdkVersion,
"net.logstash.logback" % "logstash-logback-encoder" % "7.2",
"org.scalatestplus.play" %% "scalatestplus-play" % "5.1.0" % Test,
"org.scalatestplus.play" %% "scalatestplus-play" % "6.0.1" % Test,
"com.softwaremill.diffx" %% "diffx-scalatest-should" % "0.8.2" % Test,
"org.mockito" %% "mockito-scala-scalatest" % "1.17.12",
"org.mockito" %% "mockito-scala-scalatest" % "1.17.30",
"com.gu" %% "simple-configuration-ssm" % "1.6.4",
"com.gu" %% "pan-domain-auth-play_2-8" % "1.2.1",
"com.gu" %% "pan-domain-auth-play_2-9" % pandaVersion,
"com.google.api-client" % "google-api-client" % "2.0.1",
"com.google.apis" % "google-api-services-sheets" % "v4-rev20221216-2.0.0",
"org.languagetool" % "languagetool-core" % languageToolVersion,
Expand All @@ -90,7 +82,7 @@ val commonSettings = Seq(
"com.gu" %% "content-api-models-json" % capiModelsVersion,
"com.gu" %% "content-api-client-aws" % "0.7",
"com.gu" %% "content-api-client-default" % capiClientVersion,
"com.gu" %% "panda-hmac-play_2-8" % "2.2.0",
"com.gu" %% "panda-hmac-play_2-9" % pandaVersion,
"net.sourceforge.htmlcleaner" % "htmlcleaner" % "2.29",
"com.scalawilliam" %% "xs4s-core" % "0.9.1",
"ch.qos.logback" % "logback-classic" % "1.4.4", // manually overwriting logback-classic to resolve issue in Play framework: https://github.com/playframework/playframework/issues/11499
Expand All @@ -105,7 +97,7 @@ val commonLib = (project in file(s"$appsFolder/common-lib"))
libraryDependencies ++= Seq(
ws,
// @todo – we're repeating ourselves. Can we derive this from the plugin?
"com.typesafe.play" %% "play" % "2.8.19",
"com.typesafe.play" %% "play" % "2.9.2",
)
)

Expand All @@ -126,15 +118,6 @@ def playProject(label: String, projectName: String, domainPrefix: String, devHtt
s"-J-Xloggc:/var/log/${packageName.value}/gc.log"
),
commonSettings,
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."
)
},
Comment on lines -129 to -137
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",

)

val checker = playProject(
Expand Down
3 changes: 2 additions & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
sbt.version=1.7.1
sbt.version=1.9.9

2 changes: 1 addition & 1 deletion project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.19")
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.9.2")
addSbtPlugin("com.gu" % "sbt-riffraff-artifact" % "1.1.18")
addSbtPlugin("io.gatling" % "gatling-sbt" % "3.0.0")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0")
Expand Down
Loading