Skip to content

Commit b0d8a14

Browse files
committed
Generated scalatest-diagrams module for js.
1 parent 20811d8 commit b0d8a14

File tree

3 files changed

+37
-5
lines changed

3 files changed

+37
-5
lines changed

build.sbt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,5 @@ lazy val scalatestFlatSpecJS = ScalatestBuild.scalatestFlatSpecJS
6666
lazy val scalatestFreeSpecJS = ScalatestBuild.scalatestFreeSpecJS
6767
lazy val scalatestFunSuiteJS = ScalatestBuild.scalatestFunSuiteJS
6868
lazy val scalatestPropSpecJS = ScalatestBuild.scalatestPropSpecJS
69-
lazy val scalatestWordSpecJS = ScalatestBuild.scalatestWordSpecJS
69+
lazy val scalatestWordSpecJS = ScalatestBuild.scalatestWordSpecJS
70+
lazy val scalatestDiagramsJS = ScalatestBuild.scalatestDiagramsJS

project/GenModulesJS.scala

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ object GenModulesJS {
101101
def genScalaTestWordSpec(targetDir: File, version: String, scalaVersion: String): Seq[File] =
102102
copyDir("scalatest/src/main/scala/org/scalatest/wordspec", "org/scalatest/wordspec", targetDir, List.empty)
103103

104-
/*
105-
106104
def genScalaTestDiagrams(targetDir: File, version: String, scalaVersion: String): Seq[File] =
107105
copyDir("scalatest/src/main/scala/org/scalatest/diagrams", "org/scalatest/diagrams", targetDir, List.empty)
108106

@@ -111,5 +109,5 @@ object GenModulesJS {
111109
copyDir("scalatest/src/main/scala/org/scalatest/matchers/dsl", "org/scalatest/matchers/dsl", targetDir, List.empty)
112110

113111
def genScalaTestShouldMatchers(targetDir: File, version: String, scalaVersion: String): Seq[File] =
114-
copyDir("scalatest/src/main/scala/org/scalatest/matchers/should", "org/scalatest/matchers/should", targetDir, List.empty)*/
112+
copyDir("scalatest/src/main/scala/org/scalatest/matchers/should", "org/scalatest/matchers/should", targetDir, List.empty)
115113
}

project/JsBuild.scala

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,39 @@ trait JsBuild { this: BuildCommons =>
679679
"Bundle-Vendor" -> "Artima, Inc.",
680680
"Main-Class" -> "org.scalatest.tools.Runner"
681681
)
682-
).dependsOn(scalatestCoreJS).enablePlugins(ScalaJSPlugin)
682+
).dependsOn(scalatestCoreJS).enablePlugins(ScalaJSPlugin)
683+
684+
lazy val scalatestDiagramsJS = Project("scalatestDiagramsJS", file("modules/js/scalatest-diagrams.js"))
685+
.enablePlugins(SbtOsgi)
686+
.settings(sharedSettings: _*)
687+
.settings(
688+
projectTitle := "ScalaTest Diagrams JS",
689+
organization := "org.scalatest",
690+
name := "scalatest-diagrams",
691+
scalacOptions ++= Seq("-P:scalajs:mapSourceURI:" + rootProject.base.toURI + "->https://raw.githubusercontent.com/scalatest/scalatest/v" + version.value + "/"),
692+
Compile / sourceGenerators += {
693+
Def.task {
694+
GenModulesJS.genScalaTestDiagrams((sourceManaged in Compile).value / "scala", version.value, scalaVersion.value)
695+
}
696+
},
697+
scalacOptions ++= (if (scalaBinaryVersion.value == "2.10" || scalaVersion.value.startsWith("2.13")) Seq.empty[String] else Seq("-Ypartial-unification")),
698+
mimaPreviousArtifacts := Set(organization.value %%% moduleName.value % previousReleaseVersion),
699+
mimaCurrentClassfiles := (classDirectory in Compile).value.getParentFile / (moduleName.value + "_" + "sjs0.6_" + scalaBinaryVersion.value + "-" + releaseVersion + ".jar")
700+
).settings(osgiSettings: _*).settings(
701+
OsgiKeys.exportPackage := Seq(
702+
"org.scalatest.diagrams"
703+
),
704+
OsgiKeys.importPackage := Seq(
705+
"org.scalatest.*",
706+
"*;resolution:=optional"
707+
),
708+
OsgiKeys.additionalHeaders:= Map(
709+
"Bundle-Name" -> "ScalaTest Diagrams JS",
710+
"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.",
711+
"Bundle-DocURL" -> "http://www.scalatest.org/",
712+
"Bundle-Vendor" -> "Artima, Inc.",
713+
"Main-Class" -> "org.scalatest.tools.Runner"
714+
)
715+
).dependsOn(scalacticMacroJS % "compile-internal, test-internal", scalatestCoreJS).enablePlugins(ScalaJSPlugin)
683716

684717
}

0 commit comments

Comments
 (0)