Skip to content

Commit

Permalink
Merge pull request #527 from hughsimpson/master
Browse files Browse the repository at this point in the history
Update scala 3 version, drop support for scala 2
  • Loading branch information
goshacodes authored Jan 2, 2025
2 parents 3c91835 + 9805d2d commit e60f740
Show file tree
Hide file tree
Showing 29 changed files with 8 additions and 1,138 deletions.
34 changes: 1 addition & 33 deletions .github/workflows/scala.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,8 @@ on:
branches: [ master ]

jobs:
scala_2_12:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'adopt'
- uses: sbt/setup-sbt@v1
- name: Run tests
run: sbt ++2.12.18 test

scala_2_13:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'adopt'
- uses: sbt/setup-sbt@v1
- name: Run tests
run: sbt ++2.13.12 test

scala_3:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up JDK
Expand All @@ -50,4 +18,4 @@ jobs:
distribution: 'adopt'
- uses: sbt/setup-sbt@v1
- name: Run tests
run: sbt ++3.3.0 test
run: sbt ++3.4.2 test
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ class JavaClassExtended extends JavaClass
val mm = mock[JavaClassExtended] // should be used instead
```

3.
* Mockito makes use of Symbol.newClass which is marked as experimental; to avoid having to add the `@experimental`
attribute everywhere in tests, you can add the `Test / scalacOptions += "-experimental"` to your build. Note
that this option is only available in scala 3.4.0+


## Documentation
Expand Down
37 changes: 3 additions & 34 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,12 @@ lazy val scalatest = Def.setting("org.scalatest" %%% "scalatest" % "3.2.19")
lazy val specs2 = Def.setting("org.specs2" %%% "specs2-core" % "4.20.8")

val commonSettings = Defaults.coreDefaultSettings ++ Seq(
/**
* Symbol.newClass is marked experimental, so we should use @experimental annotation in every test suite.
* 3.3.0 has a bug so we can omit this annotation
*/
scalaVersion := "3.3.0",
scalacOptions ++= Seq("-deprecation", "-unchecked", "-feature", "-release:8")
scalaVersion := "3.4.2",
scalacOptions ++= Seq("-deprecation", "-unchecked", "-feature", "-release:8", "-experimental")
)

lazy val scalamock = crossProject(JSPlatform, JVMPlatform) in file(".") settings(
commonSettings,
crossScalaSettings,
name := "scalamock",
Compile / packageBin / publishArtifact := true,
Compile / packageDoc / publishArtifact := true,
Expand All @@ -30,7 +25,6 @@ lazy val scalamock = crossProject(JSPlatform, JVMPlatform) in file(".") settings

lazy val examples = project in file("examples") settings(
commonSettings,
crossScalaSettings,
name := "ScalaMock Examples",
publish / skip := true,
libraryDependencies ++= Seq(
Expand All @@ -39,31 +33,6 @@ lazy val examples = project in file("examples") settings(
)
) dependsOn scalamock.jvm

def crossScalaSettings = {
def addDirsByScalaVersion(path: String): Def.Initialize[Seq[sbt.File]] =
scalaVersion.zip(baseDirectory) { case (v, base) =>
CrossVersion.partialVersion(v) match {
case Some((v, _)) if Set(2L, 3L).contains(v) =>
Seq(base / path / s"scala-$v")
case _ =>
Seq.empty
}
}
Seq(
crossScalaVersions := Seq("2.12.20", "2.13.14", scalaVersion.value),
Compile / unmanagedSourceDirectories ++= addDirsByScalaVersion("src/main").value,
Test / unmanagedSourceDirectories ++= addDirsByScalaVersion("src/test").value,
libraryDependencies ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, _)) =>
Seq("org.scala-lang" % "scala-reflect" % scalaVersion.value)
case _ =>
Seq.empty
}
}
)
}

inThisBuild(
List(
organization := "org.scalamock",
Expand All @@ -77,4 +46,4 @@ inThisBuild(
Developer("goshacodes", "Georgii Kovalev", "", url("https://github.com/goshacodes"))
)
)
)
)

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit e60f740

Please sign in to comment.