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

Upgrade to sbt 1.5.0 #344

Merged
merged 9 commits into from
Apr 6, 2021
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
steps:
- uses: actions/checkout@v2
- uses: olafurpg/setup-scala@v10
- run: csbt +testsJVM/test
- run: sbt +testsJVM/test
shell: bash
env:
GOOGLE_APPLICATION_CREDENTIALS:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ src_managed/
project/boot/
project/plugins/project/
.bloop
.bsp

_site/

Expand Down
54 changes: 22 additions & 32 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,11 @@ inThisBuild(
)
),
scalaVersion := scala213,
testFrameworks := List(
new TestFramework("munit.Framework")
),
useSuperShell := false
)
)

skip in publish := true
publish / skip := true
mimaPreviousArtifacts := Set.empty
crossScalaVersions := List()
addCommandAlias(
Expand All @@ -68,7 +65,8 @@ val isScala3Setting = Def.setting {
def isScala3(v: Option[(Long, Long)]): Boolean = v.exists(_._1 != 2)

// NOTE(olafur): disable Scala.js and Native settings for IntelliJ.
lazy val skipIdeaSettings = SettingKey[Boolean]("ide-skip-project") := true
lazy val skipIdeaSettings =
SettingKey[Boolean]("ide-skip-project").withRank(KeyRanks.Invisible) := true
lazy val mimaEnable: List[Def.Setting[_]] = List(
mimaBinaryIssueFilters ++= List(
ProblemFilters.exclude[DirectMissingMethodProblem](
Expand Down Expand Up @@ -138,9 +136,7 @@ val sharedSettings = List(
"-Ywarn-unused:imports"
)
}
},
// see <https://github.com/sbt/sbt/issues/5934>
Test / scalacOptions := (Compile / scalacOptions).value
}
)

lazy val junit = project
Expand All @@ -157,15 +153,15 @@ lazy val junit = project
"junit" % "junit" % junitVersion,
"org.scala-sbt" % "test-interface" % "1.0"
),
javacOptions in Compile ++= List("-target", "1.8", "-source", "1.8"),
javacOptions in (Compile, doc) --= List("-target", "1.8")
Compile / javacOptions ++= List("-target", "1.8", "-source", "1.8"),
Compile / doc / javacOptions --= List("-target", "1.8")
)

lazy val munit = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.settings(
sharedSettings,
unmanagedSourceDirectories.in(Compile) ++= {
val root = baseDirectory.in(ThisBuild).value / "munit"
Compile / unmanagedSourceDirectories ++= {
val root = (ThisBuild / baseDirectory).value / "munit"
val base = root / "shared" / "src" / "main"
val result = mutable.ListBuffer.empty[File]
val partialVersion = CrossVersion.partialVersion(scalaVersion.value)
Expand Down Expand Up @@ -196,22 +192,20 @@ lazy val munit = crossProject(JSPlatform, JVMPlatform, NativePlatform)
libraryDependencies ++= List(
"org.scala-native" %%% "test-interface" % scalaNativeVersion
),
unmanagedSourceDirectories.in(Compile) += baseDirectory
.in(ThisBuild)
.value / "munit" / "non-jvm" / "src" / "main"
Compile / unmanagedSourceDirectories +=
(ThisBuild / baseDirectory).value / "munit" / "non-jvm" / "src" / "main"
)
.jsConfigure(sharedJSConfigure)
.jsSettings(
sharedJSSettings,
libraryDependencies ++= List(
("org.scala-js" %% "scalajs-test-interface" % scalaJSVersion)
.withDottyCompat(scalaVersion.value),
.cross(CrossVersion.for3Use2_13),
("org.scala-js" %% "scalajs-junit-test-runtime" % scalaJSVersion)
.withDottyCompat(scalaVersion.value)
.cross(CrossVersion.for3Use2_13)
),
unmanagedSourceDirectories.in(Compile) += baseDirectory
.in(ThisBuild)
.value / "munit" / "non-jvm" / "src" / "main"
Compile / unmanagedSourceDirectories +=
(ThisBuild / baseDirectory).value / "munit" / "non-jvm" / "src" / "main"
)
.jvmSettings(
sharedJVMSettings,
Expand Down Expand Up @@ -279,10 +273,10 @@ lazy val tests = crossProject(JSPlatform, JVMPlatform, NativePlatform)
buildInfoPackage := "munit",
buildInfoKeys := Seq[BuildInfoKey](
"sourceDirectory" ->
baseDirectory.in(ThisBuild).value / "tests" / "shared" / "src" / "main",
(ThisBuild / baseDirectory).value / "tests" / "shared" / "src" / "main",
scalaVersion
),
skip in publish := true
publish / skip := true
)
.nativeConfigure(sharedNativeConfigure)
.nativeSettings(sharedNativeSettings)
Expand All @@ -300,23 +294,15 @@ lazy val testsNative = tests.native
lazy val docs = project
.in(file("munit-docs"))
.dependsOn(munitJVM, munitScalacheckJVM)
.enablePlugins(MdocPlugin, MUnitReportPlugin, DocusaurusPlugin)
.enablePlugins(MdocPlugin, DocusaurusPlugin)
.disablePlugins(MimaPlugin)
.settings(
sharedSettings,
moduleName := "munit-docs",
crossScalaVersions := List(scala213, scala212),
unmanagedSources.in(Compile) += sourceDirectory
.in(plugin, Compile)
.value / "scala" / "munit" / "sbtmunit" / "MUnitTestReport.scala",
libraryDependencies ++= List(
"org.scala-lang.modules" %% "scala-xml" % "2.0.0-RC1",
gcp
),
test := {},
munitRepository := Some("scalameta/munit"),
mdocOut :=
baseDirectory.in(ThisBuild).value / "website" / "target" / "docs",
(ThisBuild / baseDirectory).value / "website" / "target" / "docs",
mdocExtraArguments := List("--no-link-hygiene"),
mdocVariables := Map(
"VERSION" -> version.value.replaceFirst("\\+.*", ""),
Expand All @@ -326,3 +312,7 @@ lazy val docs = project
),
fork := false
)

Global / excludeLintKeys ++= Set(
mimaPreviousArtifacts
)
5 changes: 5 additions & 0 deletions docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ MUnit is a Scala testing library with the following goals:
```scala
libraryDependencies += "org.scalameta" %% "munit" % "@VERSION@" % Test
// Use %%% for non-JVM projects.
```

If you are using a version of sbt lower than 1.5.0, you will also need to add:

```scala
testFrameworks += new TestFramework("munit.Framework")
```

Expand Down
12 changes: 0 additions & 12 deletions munit-docs/src/main/java/munit/docs/StorageProxy.java

This file was deleted.

This file was deleted.

200 changes: 0 additions & 200 deletions munit-docs/src/main/scala/docs/MUnitModifier.scala

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ object MUnitReportPlugin extends AutoPlugin {
if ("unknown" == BuildInfo.munitVersion) Nil
else List("org.scalameta" %% "munit-docs" % BuildInfo.munitVersion)
},
resourceGenerators.in(Compile) += Def.task[List[File]] {
Compile / resourceGenerators += Def.task[List[File]] {
val out =
managedResourceDirectories.in(Compile).value.head / "munit.properties"
(Compile / managedResourceDirectories).value.head / "munit.properties"
val props = new java.util.Properties()
munitRepository.value.foreach { repo =>
props.put("munitRepository", repo)
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.4.9
sbt.version=1.5.0
Loading