Skip to content

Commit 0e9029c

Browse files
committed
Generated scalatest-shouldmatchers module for js.
1 parent 7930429 commit 0e9029c

File tree

4 files changed

+45
-9
lines changed

4 files changed

+45
-9
lines changed

build.sbt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,5 @@ lazy val scalatestFunSuiteJS = ScalatestBuild.scalatestFunSuiteJS
6868
lazy val scalatestPropSpecJS = ScalatestBuild.scalatestPropSpecJS
6969
lazy val scalatestWordSpecJS = ScalatestBuild.scalatestWordSpecJS
7070
lazy val scalatestDiagramsJS = ScalatestBuild.scalatestDiagramsJS
71-
lazy val scalatestMatchersCoreJS = ScalatestBuild.scalatestMatchersCoreJS
71+
lazy val scalatestMatchersCoreJS = ScalatestBuild.scalatestMatchersCoreJS
72+
lazy val scalatestShouldMatchersJS = ScalatestBuild.scalatestShouldMatchersJS

project/GenModulesJS.scala

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,15 @@ object GenModulesJS {
111111
"org/scalatest/matchers/dsl"
112112
).contains(packagePath)
113113
}.flatMap { case (packagePath, skipList) =>
114-
copyDir("scalatest/src/main/scala/" + packagePath, packagePath, targetDir,
115-
if (packagePath == "org/scalatest" || packagePath == "org/scalatest/fixture") skipList ++ List("package.scala") else skipList)
114+
copyDir("scalatest/src/main/scala/" + packagePath, packagePath, targetDir, skipList)
116115
}.toList
117-
118-
//copyDir("scalatest/src/main/scala/org/scalatest/matchers", "org/scalatest/matchers", targetDir, List.empty) ++
119-
//copyDir("scalatest/src/main/scala/org/scalatest/matchers/dsl", "org/scalatest/matchers/dsl", targetDir, List.empty)
120116

121117
def genScalaTestShouldMatchers(targetDir: File, version: String, scalaVersion: String): Seq[File] =
122-
copyDir("scalatest/src/main/scala/org/scalatest/matchers/should", "org/scalatest/matchers/should", targetDir, List.empty)
118+
GenScalaTestJS.genScalaPackages.filter { case (packagePath, skipList) =>
119+
List(
120+
"org/scalatest/matchers/should"
121+
).contains(packagePath)
122+
}.flatMap { case (packagePath, skipList) =>
123+
copyDir("scalatest/src/main/scala/" + packagePath, packagePath, targetDir, skipList)
124+
}.toList
123125
}

project/JsBuild.scala

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -747,6 +747,39 @@ trait JsBuild { this: BuildCommons =>
747747
"Bundle-Vendor" -> "Artima, Inc.",
748748
"Main-Class" -> "org.scalatest.tools.Runner"
749749
)
750-
).dependsOn(scalacticMacroJS % "compile-internal, test-internal", scalatestCoreJS).enablePlugins(ScalaJSPlugin)
750+
).dependsOn(scalacticMacroJS % "compile-internal, test-internal", scalatestCoreJS).enablePlugins(ScalaJSPlugin)
751+
752+
lazy val scalatestShouldMatchersJS = Project("scalatestShouldMatchersJS", file("modules/js/scalatest-shouldmatchers.js"))
753+
.enablePlugins(SbtOsgi)
754+
.settings(sharedSettings: _*)
755+
.settings(
756+
projectTitle := "ScalaTest Should Matchers JS",
757+
organization := "org.scalatest",
758+
name := "scalatest-shouldmatchers",
759+
scalacOptions ++= Seq("-P:scalajs:mapSourceURI:" + rootProject.base.toURI + "->https://raw.githubusercontent.com/scalatest/scalatest/v" + version.value + "/"),
760+
Compile / sourceGenerators += {
761+
Def.task {
762+
GenModulesJS.genScalaTestShouldMatchers((sourceManaged in Compile).value / "scala", version.value, scalaVersion.value)
763+
}
764+
},
765+
scalacOptions ++= (if (scalaBinaryVersion.value == "2.10" || scalaVersion.value.startsWith("2.13")) Seq.empty[String] else Seq("-Ypartial-unification")),
766+
mimaPreviousArtifacts := Set(organization.value %%% moduleName.value % previousReleaseVersion),
767+
mimaCurrentClassfiles := (classDirectory in Compile).value.getParentFile / (moduleName.value + "_" + "sjs0.6_" + scalaBinaryVersion.value + "-" + releaseVersion + ".jar")
768+
).settings(osgiSettings: _*).settings(
769+
OsgiKeys.exportPackage := Seq(
770+
"org.scalatest.matchers.should"
771+
),
772+
OsgiKeys.importPackage := Seq(
773+
"org.scalatest.*",
774+
"*;resolution:=optional"
775+
),
776+
OsgiKeys.additionalHeaders:= Map(
777+
"Bundle-Name" -> "ScalaTest Should Matchers",
778+
"Bundle-Description" -> "ScalaTest.js is an open-source test framework for the Javascript Platform designed to increase your productivity by letting you write fewer lines of test code that more clearly reveal your intent.",
779+
"Bundle-DocURL" -> "http://www.scalatest.org/",
780+
"Bundle-Vendor" -> "Artima, Inc.",
781+
"Main-Class" -> "org.scalatest.tools.Runner"
782+
)
783+
).dependsOn(scalacticMacroJS % "compile-internal, test-internal", scalatestMatchersCoreJS).enablePlugins(ScalaJSPlugin)
751784

752785
}

scalatest/src/main/scala/org/scalatest/matchers/should/Matchers.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import org.scalatest.Suite
2323
import org.scalatest.UnquotedString
2424
import org.scalatest.CompileMacro
2525

26-
import org.scalactic.{FailureMessages => _, UnquotedString => _, Resources => _, _}
26+
import org.scalactic._
2727
import org.scalatest.enablers._
2828
import org.scalatest.matchers._
2929

0 commit comments

Comments
 (0)