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

Update scala 3 version, drop support for scala 2 #527

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
30 changes: 1 addition & 29 deletions .github/workflows/scala.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,6 @@ on:
branches: [ master ]

jobs:
scala_2_12:

runs-on: ubuntu-latest

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

scala_2_13:

runs-on: ubuntu-latest

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

scala_3:

runs-on: ubuntu-latest
Expand All @@ -47,4 +19,4 @@ jobs:
java-version: 11
distribution: 'adopt'
- 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
35 changes: 2 additions & 33 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,36 +25,10 @@ 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(
scalatest.value % Test,
specs2.value % Test
)
) 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
}
}
)
}

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading