Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/specs2-4.x-maintenance' into spe…
Browse files Browse the repository at this point in the history
…cs2-cross
  • Loading branch information
etorreborre committed Mar 19, 2022
2 parents c7e9656 + d428305 commit dfc63c8
Show file tree
Hide file tree
Showing 37 changed files with 589 additions and 312 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.14]
scala: [2.12.15]
java: [[email protected]]
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -49,10 +49,10 @@ jobs:
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Check that workflows are up to date
run: sbt --client '++${{ matrix.scala }}; githubWorkflowCheck'
run: sbt ++${{ matrix.scala }} githubWorkflowCheck

- name: Build project
run: sbt --client '++${{ matrix.scala }}; testOnly -- xonly exclude ci'
run: sbt ++${{ matrix.scala }} 'testOnly -- xonly exclude ci'

publish:
name: Publish Artifacts
Expand All @@ -61,7 +61,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.12.14]
scala: [2.12.15]
java: [[email protected]]
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -88,4 +88,4 @@ jobs:
key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }}

- name: Publish project
run: sbt --client '++${{ matrix.scala }}; +publish'
run: sbt ++${{ matrix.scala }} +publish
93 changes: 32 additions & 61 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ lazy val specs2 = project.in(file(".")).
name := "specs2",
packagedArtifacts := Map.empty,
ThisBuild / githubWorkflowArtifactUpload := false,
ThisBuild / githubWorkflowUseSbtThinClient := false,
ThisBuild / githubWorkflowBuild := Seq(WorkflowStep.Sbt(List("testOnly -- xonly exclude ci"), name = Some("Build project"))),
Global / onChangedBuildSource := ReloadOnSourceChanges,
test := {}
Expand All @@ -31,8 +32,7 @@ lazy val specs2Settings = Seq(
GlobalScope / scalazVersion := "7.2.34",
specs2ShellPrompt,
scalaVersion := "3.1.1",
SettingKey[Boolean]("ide-skip-project").withRank(KeyRanks.Invisible) := platformDepsCrossVersion.value == ScalaNativeCrossVersion.binary,
crossScalaVersions := Seq(scalaVersion.value, "2.13.7"))
crossScalaVersions := Seq(scalaVersion.value, "2.12.15", "2.13.8"))

lazy val tagName = Def.setting {
s"specs2-${version.value}"
Expand All @@ -42,17 +42,6 @@ lazy val commonJsSettings = Seq(
Test / parallelExecution := false
) ++ depends.jsMacrotaskExecutor

lazy val commonNativeSettings = Seq(
scalaVersion := "2.13",
crossScalaVersions := Seq("2.13"),
nativeLinkStubs := true
)

lazy val commonJsNativeSettings = Seq(
Compile / unmanagedSourceDirectories += baseDirectory.value.getParentFile / "js-native" / "src" / "main" / "scala"
)


lazy val specs2Version = settingKey[String]("defines the current specs2 version")
lazy val scalazVersion = settingKey[String]("defines the current scalaz version")
lazy val catsVersion = "2.6.1"
Expand Down Expand Up @@ -86,86 +75,70 @@ lazy val cats = crossProject(JSPlatform, JVMPlatform).in(file("cats")).
lazy val catsJS = cats.js
lazy val catsJVM = cats.jvm

lazy val common = crossProject(JSPlatform, JVMPlatform, NativePlatform).in(file("common")).
lazy val common = crossProject(JSPlatform, JVMPlatform).in(file("common")).
settings(
libraryDependencies += depends.scalacheck.value % Test,
commonSettings,
name := "specs2-common"
).
jsSettings(depends.jsTest, commonJsSettings).
jvmSettings(depends.jvmTest, commonJvmSettings).
nativeSettings(
commonNativeSettings,
depends.nativeTest
).
platformsSettings(JSPlatform, NativePlatform)(
commonJsNativeSettings
).
dependsOn(fp)

lazy val commonJS = common.js
lazy val commonJVM = common.jvm
lazy val commonNative = common.native

lazy val core = crossProject(JSPlatform, JVMPlatform, NativePlatform).in(file("core")).
lazy val core = crossProject(JSPlatform, JVMPlatform).in(file("core")).
settings(
commonSettings,
name := "specs2-core",
libraryDependencies ++=
Seq(depends.junit % Test)
).
jsSettings(depends.jsTest, commonJsSettings).
platformsSettings(JSPlatform)(
commonJsSettings
).
jvmSettings(
depends.jvmTest,
commonJvmSettings).
nativeSettings(commonNativeSettings).
platformsSettings(JSPlatform, NativePlatform)(
commonJsNativeSettings
).
dependsOn(matcher, common, common % "test->test")

lazy val coreJVM = core.jvm
lazy val coreJS = core.js
lazy val coreNative = core.native

lazy val examples = crossProject(JSPlatform, JVMPlatform, NativePlatform).in(file("examples")).
lazy val examples = crossProject(JSPlatform, JVMPlatform).in(file("examples")).
settings(
commonSettings,
name := "specs2-examples").
jsSettings(depends.jsTest, commonJsSettings).
jvmSettings(depends.jvmTest, commonJvmSettings).
nativeSettings(commonNativeSettings).
dependsOn(common, matcher, core, matcherExtra, junit, scalacheck)

lazy val examplesJVM = examples.jvm.dependsOn(formJVM, html, markdownJVM)
lazy val examplesJS = examples.js
lazy val examplesNative = examples.native

lazy val fp = crossProject(JSPlatform, JVMPlatform, NativePlatform).in(file("fp")).
lazy val fp = crossProject(JSPlatform, JVMPlatform).in(file("fp")).
settings(commonSettings:_*).
settings(name := "specs2-fp").
jvmSettings(commonJvmSettings).
jsSettings(depends.jsTest, commonJsSettings).
nativeSettings(depends.nativeTest, commonNativeSettings)
jsSettings(depends.jsTest, commonJsSettings)

lazy val fpJVM = fp.jvm
lazy val fpJS = fp.js
lazy val fpNative = fp.native

lazy val form = crossProject(JSPlatform, JVMPlatform, NativePlatform).
lazy val form = crossProject(JSPlatform, JVMPlatform).
crossType(CrossType.Pure).
in(file("form")).
settings(
commonSettings,
name := "specs2-form").
jvmSettings(depends.jvmTest, commonJvmSettings).
jsSettings(depends.jsTest, commonJsSettings).
nativeSettings(depends.nativeTest, commonNativeSettings).
dependsOn(core, markdown, matcherExtra, scalacheck % "test->test", xml)

lazy val formJVM = form.jvm
lazy val formJS = form.js
lazy val formNative = form.native

lazy val guide = project.in(file("guide")).
enablePlugins(BuildInfoPlugin).
Expand All @@ -184,22 +157,20 @@ lazy val html = project.in(file("html")).
settings(depends.jvmTest, commonJvmSettings).
dependsOn(formJVM, matcherExtraJVM % Test, scalacheckJVM % Test, xmlJVM)

lazy val junit = crossProject(JSPlatform, JVMPlatform, NativePlatform).in(file("junit")).
lazy val junit = crossProject(JSPlatform, JVMPlatform).in(file("junit")).
settings(
libraryDependencies ++= Seq(
depends.junit,
depends.scalaXml),
commonSettings,
name := "specs2-junit").
jvmSettings(depends.jvmTest, commonJvmSettings).
nativeSettings(depends.nativeTest, commonNativeSettings).
dependsOn(core, matcherExtra % Test)

lazy val junitJVM = junit.jvm
lazy val junitJS = junit.js
lazy val junitNative = junit.native

lazy val markdown = crossProject(JSPlatform, JVMPlatform, NativePlatform).
lazy val markdown = crossProject(JSPlatform, JVMPlatform).
crossType(CrossType.Pure).
in(file("markdown")).
settings(
Expand All @@ -210,47 +181,41 @@ lazy val markdown = crossProject(JSPlatform, JVMPlatform, NativePlatform).
name := "specs2-markdown").
jvmSettings(depends.jvmTest, commonJvmSettings).
jsSettings(depends.jsTest, commonJsSettings).
nativeSettings(depends.nativeTest, commonNativeSettings).
dependsOn(common, core % "compile->test")

lazy val markdownJVM = markdown.jvm
lazy val markdownJS = markdown.js
lazy val markdownNative = markdown.native

lazy val matcher = crossProject(JSPlatform, JVMPlatform, NativePlatform).in(file("matcher")).
lazy val matcher = crossProject(JSPlatform, JVMPlatform).in(file("matcher")).
settings(
commonSettings,
name := "specs2-matcher").
jsSettings(depends.jsTest, commonJsSettings).
jvmSettings(commonJvmSettings).
nativeSettings(depends.nativeTest, commonNativeSettings).
dependsOn(common)

lazy val matcherJS = matcher.js
lazy val matcherJVM = matcher.jvm
lazy val matcherNative = matcher.native

lazy val matcherExtra = crossProject(JSPlatform, JVMPlatform, NativePlatform).in(file("matcher-extra")).
lazy val matcherExtra = crossProject(JSPlatform, JVMPlatform).in(file("matcher-extra")).
settings(
commonSettings,
depends.scalaParser,
name := "specs2-matcher-extra"
).
jsSettings(depends.jsTest, commonJsSettings).
jvmSettings(depends.jvmTest, commonJvmSettings).
nativeSettings(depends.nativeTest, commonNativeSettings).
dependsOn(matcher, xml, core % "test->test")

lazy val matcherExtraJS = matcherExtra.js
lazy val matcherExtraJVM = matcherExtra.jvm
lazy val matcherExtraNative = matcherExtra.native

lazy val pom = Project(id = "pom", base = file("pom")).
settings(commonSettings).
dependsOn(catsJVM, commonJVM, matcherJVM, matcherExtraJVM, coreJVM, scalazJVM, html,
formJVM, markdownJVM, junitJVM, scalacheckJVM)

lazy val scalaz = crossProject(JSPlatform, JVMPlatform, NativePlatform).in(file("scalaz")).
lazy val scalaz = crossProject(JSPlatform, JVMPlatform).in(file("scalaz")).
settings(
commonSettings,
libraryDependencies ++=
Expand All @@ -259,14 +224,12 @@ lazy val scalaz = crossProject(JSPlatform, JVMPlatform, NativePlatform).in(file(
name := "specs2-scalaz").
jsSettings(depends.jsTest, commonJsSettings).
jvmSettings(depends.jvmTest, commonJvmSettings).
nativeSettings(depends.nativeTest, commonNativeSettings).
dependsOn(matcher, core % "test->test")

lazy val scalazJS = scalaz.js
lazy val scalazJVM = scalaz.jvm
lazy val scalazNative = scalaz.native

lazy val scalacheck = crossProject(JSPlatform, JVMPlatform, NativePlatform)
lazy val scalacheck = crossProject(JSPlatform, JVMPlatform)
.in(file("scalacheck")).
settings(
commonSettings,
Expand All @@ -275,14 +238,10 @@ lazy val scalacheck = crossProject(JSPlatform, JVMPlatform, NativePlatform)
).
jsSettings(depends.jsTest, commonJsSettings).
jvmSettings(depends.jvmTest, commonJvmSettings).
platformsSettings(JSPlatform, NativePlatform)(
commonJsNativeSettings
).
dependsOn(core)

lazy val scalacheckJS = scalacheck.js
lazy val scalacheckJVM = scalacheck.jvm
lazy val scalacheckNative = scalacheck.native

lazy val tests = Project(id = "tests", base = file("tests")).
settings(
Expand All @@ -299,16 +258,14 @@ lazy val tests = Project(id = "tests", base = file("tests")).
scalazJVM,
catsJVM)

lazy val xml = crossProject(JSPlatform, JVMPlatform, NativePlatform).in(file("xml")).
lazy val xml = crossProject(JSPlatform, JVMPlatform).in(file("xml")).
settings(
libraryDependencies += depends.scalaXml,
commonSettings,
name := "xml"
).
jsSettings(depends.jsTest, commonJsSettings).
jvmSettings(depends.jvmTest, commonJvmSettings).
nativeSettings(commonNativeSettings, depends.nativeTest).
platformsSettings(JSPlatform, NativePlatform)(commonJsNativeSettings).
dependsOn(core)

lazy val xmlJVM = xml.jvm
Expand All @@ -335,6 +292,13 @@ lazy val compilationSettings: Seq[Def.Setting[_]] = Seq(
"-language:implicitConversions",
"-language:_",
"-Ykind-projector:underscores")
case Some((2, v)) if v <= 12 =>
Seq(
"-Ypartial-unification",
"-language:_",
"-Xsource:3",
"-P:kind-projector:underscore-placeholders"
)
case _ => Seq(
"-Xlint",
"-Ywarn-numeric-widen",
Expand All @@ -354,6 +318,13 @@ lazy val compilationSettings: Seq[Def.Setting[_]] = Seq(
case _ => Seq("-Yrangepos")
}
},
libraryDependencies ++= {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((3, _)) => Seq()
case _ => List(compilerPlugin("org.typelevel" % "kind-projector" % "0.13.2" cross CrossVersion.full))
}
},
Test / scalacOptions += "-Yrangepos",
Compile / doc / scalacOptions ++= Seq("-feature", "-language:_"),
Compile / console / scalacOptions := Seq("-Yrangepos", "-feature", "-language:_"),
Test / console / scalacOptions := Seq("-Yrangepos", "-feature", "-language:_"),
Expand Down
7 changes: 7 additions & 0 deletions common/js/src/main/scala/org/specs2/Platform.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.specs2

private[specs2] object Platform {
final val isJVM = false
final val isJS = true
final val isNative = false
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package org.specs2.concurrent

/**
* add implicit conversions between the execution environment and execution context / executor service
*/
trait ImplicitExecutionContexts extends
ImplicitExecutionContextFromExecutionEnv


12 changes: 12 additions & 0 deletions common/js/src/main/scala/org/specs2/concurrent/package.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.specs2

import scala.concurrent.{ Await, Awaitable }
import scala.concurrent.duration.Duration

package object concurrent {

private[specs2] def awaitResult[A](a: Awaitable[A], d: Duration) = {
Await.result(a, d)
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package org.specs2.reflect

trait ClassLoading {
def setContextClassLoader(classLoader: ClassLoader): Unit =
()
}
Loading

0 comments on commit dfc63c8

Please sign in to comment.