diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8ca0283eac..3798d4f497 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -360,7 +360,7 @@ jobs: - name: Submit Dependencies uses: scalacenter/sbt-dependency-submission@v2 with: - modules-ignore: rootjs_2.12 rootjs_2.13 rootjs_3 docs_2.12 docs_2.13 docs_3 cats-tests_sjs1_2.12 cats-tests_sjs1_2.13 cats-tests_sjs1_3 rootjvm_2.12 rootjvm_2.13 rootjvm_3 rootnative_2.12 rootnative_2.13 rootnative_3 cats-tests_2.12 cats-tests_2.13 cats-tests_3 bincompattest_2.12 bincompattest_2.13 bincompattest_3 cats-tests_native0.4_2.12 cats-tests_native0.4_2.13 cats-tests_native0.4_3 cats-bench_2.12 cats-bench_2.13 cats-bench_3 + modules-ignore: rootjs_2.12 rootjs_2.13 rootjs_3 docs_2.12 docs_2.13 docs_3 cats-tests_sjs1_2.12 cats-tests_sjs1_2.13 cats-tests_sjs1_3 rootjvm_2.12 rootjvm_2.13 rootjvm_3 rootnative_2.12 rootnative_2.13 rootnative_3 cats-tests_2.12 cats-tests_2.13 cats-tests_3 bincompattest_2.12 bincompattest_2.13 bincompattest_3 cats-tests_native0.5_2.12 cats-tests_native0.5_2.13 cats-tests_native0.5_3 cats-bench_2.12 cats-bench_2.13 cats-bench_3 configs-ignore: test scala-tool scala-doc-tool test-internal validate-steward: diff --git a/build.sbt b/build.sbt index e7ac6c9166..12f2b76e59 100644 --- a/build.sbt +++ b/build.sbt @@ -1,10 +1,10 @@ ThisBuild / tlBaseVersion := "2.11" -val scalaCheckVersion = "1.17.1" +val scalaCheckVersion = "1.18.0" -val disciplineVersion = "1.6.0" +val disciplineVersion = "1.7.0" -val disciplineMunitVersion = "2.0.0-M3" +val disciplineMunitVersion = "2.0.0-M4" val munitVersion = "1.0.0" @@ -65,9 +65,14 @@ lazy val commonJsSettings = Seq( ) Global / concurrentRestrictions += Tags.limit(NativeTags.Link, 1) -lazy val commonNativeSettings = Seq( + +// Cats 2.11.0 switches to Scala Native 0.5. +// Therefore `tlVersionIntroduced` should be reset to 2.11.0 for all scala versions in all native cross-projects. +val commonNativeTlVersionIntroduced = List("2.12", "2.13", "3").map(_ -> "2.11.0").toMap + +lazy val commonNativeSettings = Seq[Setting[?]]( doctestGenTests := Seq.empty, - tlVersionIntroduced ++= List("2.12", "2.13").map(_ -> "2.4.0").toMap + ("3" -> "2.8.0") + tlVersionIntroduced := commonNativeTlVersionIntroduced ) lazy val disciplineDependencies = Seq( @@ -127,8 +132,10 @@ lazy val algebraSettings = Seq[Setting[?]]( ) lazy val algebraNativeSettings = Seq[Setting[?]]( - tlMimaPreviousVersions ~= (_ - "2.2.3"), - tlVersionIntroduced += ("3" -> "2.8.0") + // Reset to auto-populate from `tlVersionIntroduced` below. + tlMimaPreviousVersions := Set.empty, + // Should be reset to the common setting value, because `algebraSettings` re-defines it. + tlVersionIntroduced := commonNativeTlVersionIntroduced ) lazy val algebra = crossProject(JSPlatform, JVMPlatform, NativePlatform) diff --git a/project/plugins.sbt b/project/plugins.sbt index 31e9ea45f6..a5b2fdf8bc 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -4,5 +4,5 @@ addSbtPlugin("org.typelevel" % "sbt-typelevel-site" % sbtTypelevelVersion) addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.7") addSbtPlugin("com.github.tkawachi" % "sbt-doctest" % "0.10.0") addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.16.0") -addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.17") +addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.1") addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.12.0") diff --git a/tests/jvm/src/test/scala/cats/tests/FutureSuite.scala b/tests/jvm-native/src/test/scala/cats/tests/FutureSuite.scala similarity index 100% rename from tests/jvm/src/test/scala/cats/tests/FutureSuite.scala rename to tests/jvm-native/src/test/scala/cats/tests/FutureSuite.scala diff --git a/tests/native/src/test/scala/cats/native/tests/FutureSuite.scala b/tests/native/src/test/scala/cats/native/tests/FutureSuite.scala deleted file mode 100644 index 205ec7a205..0000000000 --- a/tests/native/src/test/scala/cats/native/tests/FutureSuite.scala +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2015 Typelevel - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of - * this software and associated documentation files (the "Software"), to deal in - * the Software without restriction, including without limitation the rights to - * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of - * the Software, and to permit persons to whom the Software is furnished to do so, - * subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS - * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR - * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -package cats.native.tests - -import cats.kernel.laws.discipline.{MonoidTests => MonoidLawTests, SemigroupTests => SemigroupLawTests} -import cats.kernel.{Eq, Semigroup} -import cats.laws.discipline._ -import cats.laws.discipline.arbitrary._ -import cats.syntax.either._ -import cats.tests.{CatsSuite, ListWrapper} -import org.scalacheck.Arbitrary.arbitrary -import org.scalacheck.rng.Seed -import org.scalacheck.{Arbitrary, Cogen} - -import scala.concurrent.{Await, ExecutionContextExecutor, Future} -import scala.concurrent.duration._ - -class FutureSuite extends CatsSuite { - val timeout = 3.seconds - - // TODO: We shouldn't do this! See: https://github.com/scala-js/scala-js/issues/2102 - implicit private object SynchronousExecutor extends ExecutionContextExecutor { - def execute(runnable: Runnable): Unit = - try { - runnable.run() - } catch { - case t: Throwable => reportFailure(t) - } - - def reportFailure(t: Throwable): Unit = - t.printStackTrace() - } - - def futureEither[A](f: Future[A]): Future[Either[Throwable, A]] = - f.map(Either.right[Throwable, A]).recover { case t => Either.left(t) } - - implicit def eqfa[A: Eq]: Eq[Future[A]] = { (fx, fy) => - val fz = futureEither(fx).zip(futureEither(fy)) - Await.result(fz.map { case (tx, ty) => tx === ty }, timeout) - } - - implicit def cogen[A: Cogen]: Cogen[Future[A]] = - Cogen[Future[A]] { (seed: Seed, t: Future[A]) => - Cogen[A].perturb(seed, Await.result(t, timeout)) - } - - implicit val throwableEq: Eq[Throwable] = - Eq.by[Throwable, String](_.toString) - - // Need non-fatal Throwables for Future recoverWith/handleError - implicit val nonFatalArbitrary: Arbitrary[Throwable] = - Arbitrary(arbitrary[Exception].map(identity)) - - checkAll("Future with Throwable", MonadErrorTests[Future, Throwable].monadError[Int, Int, Int]) - checkAll("Future", MonadTests[Future].monad[Int, Int, Int]) - checkAll("Future", CoflatMapTests[Future].coflatMap[Int, Int, Int]) - - { - implicit val F: Semigroup[ListWrapper[Int]] = ListWrapper.semigroup[Int] - checkAll("Future[ListWrapper[Int]]", SemigroupLawTests[Future[ListWrapper[Int]]].semigroup) - } - - checkAll("Future[Int]", MonoidLawTests[Future[Int]].monoid) -}