Skip to content

Commit

Permalink
Merge pull request #54 from hmrc/GG-7872
Browse files Browse the repository at this point in the history
GG-7872: domain : provide additional Scala 3.x lib build
  • Loading branch information
ShaneTN authored Jun 17, 2024
2 parents b266653 + 0c3be30 commit 4d87499
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 34 deletions.
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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").
Expand Down
8 changes: 4 additions & 4 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -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

Expand All @@ -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
Expand All @@ -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
)
Expand Down
13 changes: 6 additions & 7 deletions project/LibDependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
2 changes: 1 addition & 1 deletion project/ScalariformSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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)
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.7
sbt.version=1.9.9
4 changes: 2 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -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"))
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4d87499

Please sign in to comment.