From 0c3be30f544f34f7e19e90a57c7364b4176c37c1 Mon Sep 17 00:00:00 2001 From: John Kelly <60345872+jhkldev@users.noreply.github.com> Date: Fri, 14 Jun 2024 14:31:23 +0100 Subject: [PATCH] GG-7872: domain : provide additional Scala 3.x lib build --- README.md | 25 ++++++++++--------- build.sbt | 8 +++--- project/LibDependencies.scala | 13 +++++----- project/ScalariformSettings.scala | 2 +- project/build.properties | 2 +- project/plugins.sbt | 4 +-- .../referencechecker/ReferenceChecker.scala | 14 +++++------ 7 files changed, 34 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index f31f012..5980d7d 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,10 @@ domain Micro-library for typing and validating UK tax identifiers. #### Change History +v10.0 - 17 Jun 24 +- add Scala 3.0 support. Remove Scala 2.12 support, noting Scala 2.13 is still supported. +- update library dependencies + v9.0 - 05 Dec 23 - add support for Play 2.9 & Play 3.0, noting Play 2.8 is still supported - update Scala 2.13 version @@ -17,6 +21,14 @@ v8.3.0 - 23 May 22 v8.1.0 - 06 May 22 - update library dependencies +v8.0.0 - 14 Mar 22 +- add Scala 2.13 support + +v7.0.0 - 21 Jan 22 +- drop Play 2.6 and Play 2.7 support + +v6.0.0 - 24 Jun 21 +- Scala 2.12 only and add Play 2.8 support #### Identifier Types @@ -79,20 +91,9 @@ libraryDependencies += "uk.gov.hmrc" %% "domain-play-[PLAY VERSION]" % "[LIB VER ``` for example ```scala -libraryDependencies += "uk.gov.hmrc" %% "domain-play-30" % "9.0.0" +libraryDependencies += "uk.gov.hmrc" %% "domain-play-30" % "10.0.0" ``` -## Version - -Version 9.x.x add Play 2.9 and Play 3.0 support. - -Version 8.x.x add Scala 2.13 support. - -Version 7.x.x drop Play 2.6 and Play 2.7 support. - -Version 6.x.x is Scala 2.12 only and add Play 2.8 support. - - ## License ## This code is open source software licensed under the [Apache 2.0 License]("http://www.apache.org/licenses/LICENSE-2.0.html"). diff --git a/build.sbt b/build.sbt index d3b7fb0..ebeb810 100644 --- a/build.sbt +++ b/build.sbt @@ -1,8 +1,8 @@ -val scala2_12 = "2.12.15" val scala2_13 = "2.13.12" +val scala3 = "3.3.3" ThisBuild / scalaVersion := scala2_13 -ThisBuild / majorVersion := 9 +ThisBuild / majorVersion := 10 ThisBuild / isPublicArtefact := true ThisBuild / scalacOptions += "-Wconf:src=src_managed/.*:s" // silence all warnings on autogenerated files @@ -19,7 +19,7 @@ lazy val commonSettings = lazy val play28 = Project("domain-play-28", file("play-28")) .settings( - crossScalaVersions := Seq(scala2_12, scala2_13), + crossScalaVersions := Seq(scala2_13), libraryDependencies ++= LibDependencies.play28 ++ LibDependencies.test, libraryDependencySchemes += "org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always, sharedSources @@ -36,7 +36,7 @@ lazy val play29 = Project("domain-play-29", file("play-29")) lazy val play30 = Project("domain-play-30", file("play-30")) .settings( - crossScalaVersions := Seq(scala2_13), + crossScalaVersions := Seq(scala2_13, scala3), libraryDependencies ++= LibDependencies.play30 ++ LibDependencies.test, sharedSources ) diff --git a/project/LibDependencies.scala b/project/LibDependencies.scala index 0590efb..8d1b27c 100644 --- a/project/LibDependencies.scala +++ b/project/LibDependencies.scala @@ -2,21 +2,20 @@ import sbt._ object LibDependencies { val play28 = Seq( - "com.typesafe.play" %% "play" % "2.8.21" + "com.typesafe.play" %% "play" % "2.8.22" ) val play29 = Seq( - "com.typesafe.play" %% s"play" % "2.9.0" + "com.typesafe.play" %% s"play" % "2.9.3" ) val play30 = Seq( - "org.playframework" %% s"play" % "3.0.0" + "org.playframework" %% s"play" % "3.0.3" ) val test = Seq( - "org.scalatest" %% "scalatest" % "3.2.11", - "org.scalatestplus" %% "scalacheck-1-15" % "3.2.11.0", - "org.pegdown" % "pegdown" % "1.6.0", - "com.vladsch.flexmark" % "flexmark-all" % "0.62.2" + "org.scalatest" %% "scalatest" % "3.2.18", + "org.scalatestplus" %% "scalacheck-1-17" % "3.2.18.0", + "com.vladsch.flexmark" % "flexmark-all" % "0.64.8" ).map(_ % Test) } \ No newline at end of file diff --git a/project/ScalariformSettings.scala b/project/ScalariformSettings.scala index 9b49e90..f9f25f8 100644 --- a/project/ScalariformSettings.scala +++ b/project/ScalariformSettings.scala @@ -15,7 +15,7 @@ object ScalariformSettings { .setPreference(FirstArgumentOnNewline, Preserve) .setPreference(FirstParameterOnNewline, Preserve) .setPreference(FormatXml, true) - .setPreference(IndentLocalDefs, true) + .setPreference(IndentLocalDefs, false) // incompatible with Scala3 .setPreference(IndentPackageBlocks, true) .setPreference(IndentSpaces, 2) .setPreference(IndentWithTabs, false) diff --git a/project/build.properties b/project/build.properties index e8a1e24..04267b1 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.9.7 +sbt.version=1.9.9 diff --git a/project/plugins.sbt b/project/plugins.sbt index 13c1b5f..d076043 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,8 +1,8 @@ resolvers += MavenRepository("HMRC-open-artefacts-maven2", "https://open.artefacts.tax.service.gov.uk/maven2") resolvers += Resolver.url("HMRC-open-artefacts-ivy2", url("https://open.artefacts.tax.service.gov.uk/ivy2"))(Resolver.ivyStylePatterns) -addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "3.15.0") +addSbtPlugin("uk.gov.hmrc" % "sbt-auto-build" % "3.22.0") -addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.9") +addSbtPlugin("org.scoverage" % "sbt-scoverage" % "2.0.12") addSbtPlugin("org.scalariform" % "sbt-scalariform" % "1.8.3" exclude("org.scala-lang.modules", "scala-xml_2.12")) diff --git a/shared/src/main/scala/uk/gov/hmrc/referencechecker/ReferenceChecker.scala b/shared/src/main/scala/uk/gov/hmrc/referencechecker/ReferenceChecker.scala index e183bc2..ff1479c 100644 --- a/shared/src/main/scala/uk/gov/hmrc/referencechecker/ReferenceChecker.scala +++ b/shared/src/main/scala/uk/gov/hmrc/referencechecker/ReferenceChecker.scala @@ -80,14 +80,14 @@ trait ModulusReferenceChecker extends ReferenceChecker { trait DifferenceReferenceChecker extends ReferenceChecker { def mainCheck(reference: String, weightedSum: Int) = { - def checkVatReference(sum: Int, expected: Int): Boolean = { - var sumLessThan97 = sum - while (sumLessThan97 > 97) { - sumLessThan97 -= 97 - } - val calculatedDigits = 97 - sumLessThan97 - calculatedDigits == expected + def checkVatReference(sum: Int, expected: Int): Boolean = { + var sumLessThan97 = sum + while (sumLessThan97 > 97) { + sumLessThan97 -= 97 } + val calculatedDigits = 97 - sumLessThan97 + calculatedDigits == expected + } val expected = reference.takeRight(2).toInt checkVatReference(weightedSum, expected) || checkVatReference(weightedSum + 55, expected)