Skip to content

Commit

Permalink
Drop Scala 2.12 and Play 2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
rtyley committed Jul 24, 2024
1 parent c3ad72d commit 001eb33
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
java corretto-21.0.3.9.1
java corretto-11.0.23.9.1
59 changes: 28 additions & 31 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@ import Dependencies.*
import sbtrelease.ReleaseStateTransformations.*
import sbtversionpolicy.withsbtrelease.ReleaseVersion.fromAggregatedAssessedCompatibilityWithLatestRelease

organization := "com.gu"

name := "facia-api-client"

description := "Scala client for The Guardian's Facia JSON API"

val sonatypeReleaseSettings = Seq(
licenses := Seq("Apache V2" -> url("https://www.apache.org/licenses/LICENSE-2.0.html")),
releaseVersion := fromAggregatedAssessedCompatibilityWithLatestRelease().value,
releaseCrossBuild := true, // true if you cross-build the project for multiple Scala versions
releaseProcess := Seq[ReleaseStep](
Expand All @@ -24,12 +21,24 @@ val sonatypeReleaseSettings = Seq(
)
)

def artifactProducingSettings(supportScala3: Boolean) = Seq(
organization := "com.gu",
resolvers ++= Resolver.sonatypeOssRepos("releases"),
crossScalaVersions := Seq(scalaVersion.value) ++ (if (supportScala3) Seq("3.3.3") else Seq.empty),
scalaVersion := "2.13.14",
scalacOptions := Seq(
"-release:8",
"-feature",
"-deprecation",
"-Xfatal-warnings"
),
libraryDependencies += scalaTest
)

lazy val root = (project in file(".")).aggregate(
faciaJson_play27,
faciaJson_play28,
faciaJson_play29,
faciaJson_play30,
fapiClient_play27,
fapiClient_play28,
fapiClient_play29,
fapiClient_play30
Expand All @@ -38,54 +47,42 @@ lazy val root = (project in file(".")).aggregate(
sonatypeReleaseSettings
)

def baseProject(module: String, playJsonVersion: PlayJsonVersion) = Project(s"$module-${playJsonVersion.projectId}", file(s"$module-${playJsonVersion.projectId}"))
def playJsonSpecificProject(module: String, playJsonVersion: PlayJsonVersion) = Project(s"$module-${playJsonVersion.projectId}", file(s"$module-${playJsonVersion.projectId}"))
.settings(
sourceDirectory := baseDirectory.value / s"../$module/src",
organization := "com.gu",
resolvers ++= Resolver.sonatypeOssRepos("releases"),
scalaVersion := "2.13.13",
crossScalaVersions := Seq(scalaVersion.value, "2.12.19"), // ++ (if (playJsonVersion.supportsScala3) Seq("3.3.1") else Seq.empty),
scalacOptions := Seq(
"-release:11",
"-feature",
"-deprecation",
"-Xfatal-warnings"
),
libraryDependencies += scalaTest,
sonatypeReleaseSettings
sourceDirectory := baseDirectory.value / s"../$module/src"
)

def faciaJson_playJsonVersion(playJsonVersion: PlayJsonVersion) = baseProject("facia-json", playJsonVersion)
def faciaJson(playJsonVersion: PlayJsonVersion) = playJsonSpecificProject("facia-json", playJsonVersion)
.settings(
libraryDependencies ++= Seq(
awsSdk,
commonsIo,
playJsonVersion.lib,
"org.scala-lang.modules" %% "scala-collection-compat" % "2.11.0",
scalaLogging
)
),
artifactProducingSettings(supportScala3 = playJsonVersion.supportsScala3)
)

def fapiClient_playJsonVersion(playJsonVersion: PlayJsonVersion) = baseProject("fapi-client", playJsonVersion)
def fapiClient(playJsonVersion: PlayJsonVersion) = playJsonSpecificProject("fapi-client", playJsonVersion)
.settings(
libraryDependencies ++= Seq(
contentApi,
contentApiDefault,
commercialShared,
scalaTestMockito,
mockito
)
),
artifactProducingSettings(supportScala3 = false) // currently blocked by contentApi & commercialShared clients
)

lazy val faciaJson_play27 = faciaJson_playJsonVersion(PlayJsonVersion.V27)
lazy val faciaJson_play28 = faciaJson_playJsonVersion(PlayJsonVersion.V28)
lazy val faciaJson_play29 = faciaJson_playJsonVersion(PlayJsonVersion.V29)
lazy val faciaJson_play30 = faciaJson_playJsonVersion(PlayJsonVersion.V30)
lazy val faciaJson_play28 = faciaJson(PlayJsonVersion.V28)
lazy val faciaJson_play29 = faciaJson(PlayJsonVersion.V29)
lazy val faciaJson_play30 = faciaJson(PlayJsonVersion.V30)

lazy val fapiClient_play27 = fapiClient_playJsonVersion(PlayJsonVersion.V27).dependsOn(faciaJson_play27)
lazy val fapiClient_play28 = fapiClient_playJsonVersion(PlayJsonVersion.V28).dependsOn(faciaJson_play28)
lazy val fapiClient_play29 = fapiClient_playJsonVersion(PlayJsonVersion.V29).dependsOn(faciaJson_play29)
lazy val fapiClient_play30 = fapiClient_playJsonVersion(PlayJsonVersion.V30).dependsOn(faciaJson_play30)
lazy val fapiClient_play28 = fapiClient(PlayJsonVersion.V28).dependsOn(faciaJson_play28)
lazy val fapiClient_play29 = fapiClient(PlayJsonVersion.V29).dependsOn(faciaJson_play29)
lazy val fapiClient_play30 = fapiClient(PlayJsonVersion.V30).dependsOn(faciaJson_play30)

Test/testOptions += Tests.Argument(
TestFrameworks.ScalaTest,
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.9.9
sbt.version=1.10.1
1 change: 0 additions & 1 deletion project/dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ object Dependencies {
}

object PlayJsonVersion {
val V27 = PlayJsonVersion("27", "com.typesafe.play", "2.7.4")
val V28 = PlayJsonVersion("28", "com.typesafe.play", "2.8.2")
val V29 = PlayJsonVersion("29", "com.typesafe.play", "2.10.4", supportsScala3 = true)
val V30 = PlayJsonVersion("30", "org.playframework", "3.0.2", supportsScala3 = true)
Expand Down

0 comments on commit 001eb33

Please sign in to comment.