From 64c7ed38ef8bcccea135f61804120914b40adc42 Mon Sep 17 00:00:00 2001 From: Andrew Valencik Date: Tue, 9 Jan 2024 07:38:55 -0500 Subject: [PATCH 01/38] Initial WIP sbt-typelevel build, new dir structure --- build.sbt | 322 ++----------- .../main/scala}/weaver/codecs/LogEntry.scala | 0 .../weaver/codecs/SerialisableThrowable.scala | 0 .../scala}/weaver/codecs/SuiteEvent.scala | 0 .../src/main/scala}/weaver/codecs/oneOf.scala | 0 .../main/scala}/weaver/codecs/package.scala | 0 .../src}/test/resources/golden.json | 0 .../scala}/weaver/codecs/CodecsTest.scala | 0 .../weaver/CatsUnsafeRunPlatformCompat.scala | 0 .../weaver/CatsUnsafeRunPlatformCompat.scala | 0 .../weaver/CatsUnsafeRunPlatformCompat.scala | 0 .../src/main/scala}/weaver/BaseIOSuite.scala | 0 .../main/scala}/weaver/CatsUnsafeRun.scala | 0 .../main/scala}/weaver/IOGlobalResource.scala | 0 .../src/main/scala}/weaver/Suites.scala | 0 .../src/main/scala}/weaver/package.scala | 0 .../scala}/org/junit/runner/RunWith.scala | 0 .../main/scala}/weaver/PlatformCompat.scala | 0 .../scala}/weaver/internals/Timestamp.scala | 0 .../scala}/weaver/junit/WeaverRunner.scala | 0 .../main/scala}/weaver/PlatformCompat.scala | 0 .../scala}/weaver/internals/Timestamp.scala | 0 .../scala}/weaver/junit/WeaverRunner.scala | 0 .../scala}/org/junit/runner/RunWith.scala | 0 .../main/scala}/weaver/PlatformCompat.scala | 0 .../scala}/weaver/internals/Timestamp.scala | 0 .../scala}/weaver/junit/WeaverRunner.scala | 0 .../src/main/scala-2/weaver}/Expect.scala | 0 .../main/scala-2/weaver}/ScalaCompat.scala | 0 .../scala-2/weaver}/SourceLocationMacro.scala | 0 .../src/main/scala-3/weaver}/Expect.scala | 0 .../main/scala-3/weaver}/ScalaCompat.scala | 0 .../scala-3/weaver}/SourceLocationMacro.scala | 0 .../src/main/scala}/weaver/Blocking.scala | 0 .../src/main/scala}/weaver/Colours.scala | 0 .../src/main/scala}/weaver/Expectations.scala | 0 .../src/main/scala}/weaver/Filters.scala | 0 .../src/main/scala}/weaver/Formatter.scala | 0 .../main/scala}/weaver/GlobalResourceF.scala | 0 .../src/main/scala}/weaver/Log.scala | 0 .../src/main/scala}/weaver/LogFormatter.scala | 0 .../main/scala}/weaver/MemoisedResource.scala | 0 .../src/main/scala}/weaver/Platform.scala | 0 .../src/main/scala}/weaver/Result.scala | 0 .../src/main/scala}/weaver/Runner.scala | 0 .../main/scala}/weaver/SourceLocation.scala | 0 .../src/main/scala}/weaver/Test.scala | 0 .../scala}/weaver/TestErrorFormatter.scala | 0 .../src/main/scala}/weaver/TestName.scala | 0 .../src/main/scala}/weaver/TestOutcome.scala | 0 .../src/main/scala}/weaver/TestStatus.scala | 0 .../src/main/scala}/weaver/UnsafeRun.scala | 0 .../src/main/scala}/weaver/discard.scala | 0 .../src/main/scala}/weaver/exceptions.scala | 0 .../scala}/weaver/internals/ExpectSame.scala | 0 .../weaver/internals/ExpectyListener.scala | 0 .../scala}/weaver/internals/Reflection.scala | 0 .../src/main/scala}/weaver/suites.scala | 0 .../scala}/weaver/discipline/Discipline.scala | 0 .../DisciplineFSuiteIntegrationTest.scala | 0 .../scala}/DisciplineIntegrationTest.scala | 0 .../src/test/scala}/RickRollLaws.scala | 0 .../main/scala/weaver/MatrixRendering.scala | 0 .../scala}/main/scala/weaver/Output.scala | 0 .../jvm/src/test/scala}/DogFoodTestsJVM.scala | 0 .../jvm/src/test/scala}/MetaJVM.scala | 0 .../test/scala}/junit/JUnitRunnerTests.scala | 0 .../jvm/src/test/scala}/junit/Meta.scala | 0 .../weaver/framework/CatsFramework.scala | 0 .../shared/src/test/scala}/DogFoodTests.scala | 0 .../src/test/scala}/ExpectationsTests.scala | 0 .../src/test/scala}/FormatterTests.scala | 0 .../shared/src/test/scala}/FunSuiteTest.scala | 0 .../shared/src/test/scala}/Global.scala | 0 .../test/scala}/MemoisedResourceTests.scala | 0 .../shared/src/test/scala}/Meta.scala | 0 .../src/test/scala}/MutableSuiteTest.scala | 0 .../src/test/scala}/SharedResourceTests.scala | 0 .../src/test/scala}/SourceLocationTest.scala | 0 .../shared/src/test/scala}/TracingTests.scala | 0 .../src/main/scala}/AsyncTask.scala | 0 .../src/main/scala}/DogFoodCompat.scala | 0 .../src/main/scala}/RunnerCompat.scala | 0 .../src/main/scala}/TaskCompat.scala | 0 .../src/main/scala}/PlatformTask.scala | 0 .../src/main/scala}/DogFoodCompat.scala | 0 .../src/main/scala}/RunnerCompat.scala | 0 .../src/main/scala}/SbtTask.scala | 0 .../src/main/scala}/TaskCompat.scala | 0 .../src/main/scala}/PlatformTask.scala | 0 .../scala}/weaver/framework/DogFood.scala | 0 .../weaver/framework/Fingerprints.scala | 0 .../scala}/weaver/framework/Reporter.scala | 0 .../scala}/weaver/framework/SbtEvent.scala | 0 .../scala}/weaver/framework/SuiteEvent.scala | 0 .../scala}/weaver/framework/SuiteLoader.scala | 0 .../weaver/framework/WeaverFramework.scala | 0 .../weaver/framework/WeaverRunner.scala | 0 .../weaver/scalacheck/CheckConfig.scala | 0 .../scala}/weaver/scalacheck/Checkers.scala | 0 .../scalacheck/CheckersConcurrencyTest.scala | 0 .../weaver/scalacheck/CheckersTest.scala | 0 .../scalacheck/PropertyDogFoodTest.scala | 0 project/WeaverPlugin.scala | 425 ------------------ project/plugins.sbt | 6 +- 105 files changed, 41 insertions(+), 712 deletions(-) rename modules/codecs/{src => shared/src/main/scala}/weaver/codecs/LogEntry.scala (100%) rename modules/codecs/{src => shared/src/main/scala}/weaver/codecs/SerialisableThrowable.scala (100%) rename modules/codecs/{src => shared/src/main/scala}/weaver/codecs/SuiteEvent.scala (100%) rename modules/codecs/{src => shared/src/main/scala}/weaver/codecs/oneOf.scala (100%) rename modules/codecs/{src => shared/src/main/scala}/weaver/codecs/package.scala (100%) rename modules/codecs/{ => shared/src}/test/resources/golden.json (100%) rename modules/codecs/{test/src => shared/src/test/scala}/weaver/codecs/CodecsTest.scala (100%) rename modules/{core/cats/src-js => core-cats/js/src/main/scala}/weaver/CatsUnsafeRunPlatformCompat.scala (100%) rename modules/{core/cats/src-jvm => core-cats/jvm/src/main/scala}/weaver/CatsUnsafeRunPlatformCompat.scala (100%) rename modules/{core/cats/src-native => core-cats/native/src/main/scala}/weaver/CatsUnsafeRunPlatformCompat.scala (100%) rename modules/{core/cats/src => core-cats/shared/src/main/scala}/weaver/BaseIOSuite.scala (100%) rename modules/{core/cats/src => core-cats/shared/src/main/scala}/weaver/CatsUnsafeRun.scala (100%) rename modules/{core/cats/src => core-cats/shared/src/main/scala}/weaver/IOGlobalResource.scala (100%) rename modules/{core/cats/src => core-cats/shared/src/main/scala}/weaver/Suites.scala (100%) rename modules/{core/cats/src => core-cats/shared/src/main/scala}/weaver/package.scala (100%) rename modules/core/{src-js => js/src/main/scala}/org/junit/runner/RunWith.scala (100%) rename modules/core/{src-js => js/src/main/scala}/weaver/PlatformCompat.scala (100%) rename modules/core/{src-js => js/src/main/scala}/weaver/internals/Timestamp.scala (100%) rename modules/core/{src-js => js/src/main/scala}/weaver/junit/WeaverRunner.scala (100%) rename modules/core/{src-jvm => jvm/src/main/scala}/weaver/PlatformCompat.scala (100%) rename modules/core/{src-jvm => jvm/src/main/scala}/weaver/internals/Timestamp.scala (100%) rename modules/core/{src-jvm => jvm/src/main/scala}/weaver/junit/WeaverRunner.scala (100%) rename modules/core/{src-native => native/src/main/scala}/org/junit/runner/RunWith.scala (100%) rename modules/core/{src-native => native/src/main/scala}/weaver/PlatformCompat.scala (100%) rename modules/core/{src-native => native/src/main/scala}/weaver/internals/Timestamp.scala (100%) rename modules/core/{src-native => native/src/main/scala}/weaver/junit/WeaverRunner.scala (100%) rename modules/core/{src-scala-2 => shared/src/main/scala-2/weaver}/Expect.scala (100%) rename modules/core/{src-scala-2 => shared/src/main/scala-2/weaver}/ScalaCompat.scala (100%) rename modules/core/{src-scala-2 => shared/src/main/scala-2/weaver}/SourceLocationMacro.scala (100%) rename modules/core/{src-scala-3 => shared/src/main/scala-3/weaver}/Expect.scala (100%) rename modules/core/{src-scala-3 => shared/src/main/scala-3/weaver}/ScalaCompat.scala (100%) rename modules/core/{src-scala-3 => shared/src/main/scala-3/weaver}/SourceLocationMacro.scala (100%) rename modules/core/{src => shared/src/main/scala}/weaver/Blocking.scala (100%) rename modules/core/{src => shared/src/main/scala}/weaver/Colours.scala (100%) rename modules/core/{src => shared/src/main/scala}/weaver/Expectations.scala (100%) rename modules/core/{src => shared/src/main/scala}/weaver/Filters.scala (100%) rename modules/core/{src => shared/src/main/scala}/weaver/Formatter.scala (100%) rename modules/core/{src => shared/src/main/scala}/weaver/GlobalResourceF.scala (100%) rename modules/core/{src => shared/src/main/scala}/weaver/Log.scala (100%) rename modules/core/{src => shared/src/main/scala}/weaver/LogFormatter.scala (100%) rename modules/core/{src => shared/src/main/scala}/weaver/MemoisedResource.scala (100%) rename modules/core/{src => shared/src/main/scala}/weaver/Platform.scala (100%) rename modules/core/{src => shared/src/main/scala}/weaver/Result.scala (100%) rename modules/core/{src => shared/src/main/scala}/weaver/Runner.scala (100%) rename modules/core/{src => shared/src/main/scala}/weaver/SourceLocation.scala (100%) rename modules/core/{src => shared/src/main/scala}/weaver/Test.scala (100%) rename modules/core/{src => shared/src/main/scala}/weaver/TestErrorFormatter.scala (100%) rename modules/core/{src => shared/src/main/scala}/weaver/TestName.scala (100%) rename modules/core/{src => shared/src/main/scala}/weaver/TestOutcome.scala (100%) rename modules/core/{src => shared/src/main/scala}/weaver/TestStatus.scala (100%) rename modules/core/{src => shared/src/main/scala}/weaver/UnsafeRun.scala (100%) rename modules/core/{src => shared/src/main/scala}/weaver/discard.scala (100%) rename modules/core/{src => shared/src/main/scala}/weaver/exceptions.scala (100%) rename modules/core/{src => shared/src/main/scala}/weaver/internals/ExpectSame.scala (100%) rename modules/core/{src => shared/src/main/scala}/weaver/internals/ExpectyListener.scala (100%) rename modules/core/{src => shared/src/main/scala}/weaver/internals/Reflection.scala (100%) rename modules/core/{src => shared/src/main/scala}/weaver/suites.scala (100%) rename modules/discipline/{src => shared/src/main/scala}/weaver/discipline/Discipline.scala (100%) rename modules/discipline/{test/src => shared/src/test/scala}/DisciplineFSuiteIntegrationTest.scala (100%) rename modules/discipline/{test/src => shared/src/test/scala}/DisciplineIntegrationTest.scala (100%) rename modules/discipline/{test/src => shared/src/test/scala}/RickRollLaws.scala (100%) rename modules/docs/{src => shared/src/main/scala}/main/scala/weaver/MatrixRendering.scala (100%) rename modules/docs/{src => shared/src/main/scala}/main/scala/weaver/Output.scala (100%) rename modules/{framework/cats/test/src-jvm => framework-cats/jvm/src/test/scala}/DogFoodTestsJVM.scala (100%) rename modules/{framework/cats/test/src-jvm => framework-cats/jvm/src/test/scala}/MetaJVM.scala (100%) rename modules/{framework/cats/test/src-jvm => framework-cats/jvm/src/test/scala}/junit/JUnitRunnerTests.scala (100%) rename modules/{framework/cats/test/src-jvm => framework-cats/jvm/src/test/scala}/junit/Meta.scala (100%) rename modules/{framework/cats/src => framework-cats/shared/src/main/scala}/weaver/framework/CatsFramework.scala (100%) rename modules/{framework/cats/test/src => framework-cats/shared/src/test/scala}/DogFoodTests.scala (100%) rename modules/{framework/cats/test/src => framework-cats/shared/src/test/scala}/ExpectationsTests.scala (100%) rename modules/{framework/cats/test/src => framework-cats/shared/src/test/scala}/FormatterTests.scala (100%) rename modules/{framework/cats/test/src => framework-cats/shared/src/test/scala}/FunSuiteTest.scala (100%) rename modules/{framework/cats/test/src => framework-cats/shared/src/test/scala}/Global.scala (100%) rename modules/{framework/cats/test/src => framework-cats/shared/src/test/scala}/MemoisedResourceTests.scala (100%) rename modules/{framework/cats/test/src => framework-cats/shared/src/test/scala}/Meta.scala (100%) rename modules/{framework/cats/test/src => framework-cats/shared/src/test/scala}/MutableSuiteTest.scala (100%) rename modules/{framework/cats/test/src => framework-cats/shared/src/test/scala}/SharedResourceTests.scala (100%) rename modules/{framework/cats/test/src => framework-cats/shared/src/test/scala}/SourceLocationTest.scala (100%) rename modules/{framework/cats/test/src => framework-cats/shared/src/test/scala}/TracingTests.scala (100%) rename modules/framework/{src-js-native => js-native/src/main/scala}/AsyncTask.scala (100%) rename modules/framework/{src-js-native => js-native/src/main/scala}/DogFoodCompat.scala (100%) rename modules/framework/{src-js-native => js-native/src/main/scala}/RunnerCompat.scala (100%) rename modules/framework/{src-js-native => js-native/src/main/scala}/TaskCompat.scala (100%) rename modules/framework/{src-js => js/src/main/scala}/PlatformTask.scala (100%) rename modules/framework/{src-jvm => jvm/src/main/scala}/DogFoodCompat.scala (100%) rename modules/framework/{src-jvm => jvm/src/main/scala}/RunnerCompat.scala (100%) rename modules/framework/{src-jvm => jvm/src/main/scala}/SbtTask.scala (100%) rename modules/framework/{src-jvm => jvm/src/main/scala}/TaskCompat.scala (100%) rename modules/framework/{src-native => native/src/main/scala}/PlatformTask.scala (100%) rename modules/framework/{src => shared/src/main/scala}/weaver/framework/DogFood.scala (100%) rename modules/framework/{src => shared/src/main/scala}/weaver/framework/Fingerprints.scala (100%) rename modules/framework/{src => shared/src/main/scala}/weaver/framework/Reporter.scala (100%) rename modules/framework/{src => shared/src/main/scala}/weaver/framework/SbtEvent.scala (100%) rename modules/framework/{src => shared/src/main/scala}/weaver/framework/SuiteEvent.scala (100%) rename modules/framework/{src => shared/src/main/scala}/weaver/framework/SuiteLoader.scala (100%) rename modules/framework/{src => shared/src/main/scala}/weaver/framework/WeaverFramework.scala (100%) rename modules/framework/{src => shared/src/main/scala}/weaver/framework/WeaverRunner.scala (100%) rename modules/scalacheck/{src => shared/src/main/scala}/weaver/scalacheck/CheckConfig.scala (100%) rename modules/scalacheck/{src => shared/src/main/scala}/weaver/scalacheck/Checkers.scala (100%) rename modules/scalacheck/{test/src-ce3 => shared/src/test/scala}/weaver/scalacheck/CheckersConcurrencyTest.scala (100%) rename modules/scalacheck/{test/src => shared/src/test/scala}/weaver/scalacheck/CheckersTest.scala (100%) rename modules/scalacheck/{test/src => shared/src/test/scala}/weaver/scalacheck/PropertyDogFoodTest.scala (100%) delete mode 100644 project/WeaverPlugin.scala diff --git a/build.sbt b/build.sbt index a9fa3b5e..2c9cbc29 100644 --- a/build.sbt +++ b/build.sbt @@ -1,301 +1,59 @@ -import WeaverPlugin._ - -ThisBuild / commands += Command.command("ci") { state => - "versionDump" :: - "scalafmtCheckAll" :: - "scalafix --check" :: - "Test/scalafix --check" :: - "clean" :: - "Test/compile" :: - "Test/fastLinkJS" :: // do this separately as it's memory intensive - "test" :: - "docs/docusaurusCreateSite" :: - "core/publishLocal" :: state -} - -ThisBuild / commands += Command.command("fix") { state => - "scalafix" :: - "Test/scalafix" :: - "scalafmtAll" :: - "scalafmtSbt" :: state -} - -ThisBuild / commands += Command.command("release") { state => - "publishSigned" :: - "sonatypeBundleRelease" :: state -} - -ThisBuild / commands ++= createBuildCommands(allModules) - -ThisBuild / scalaVersion := WeaverPlugin.scala213 +// https://typelevel.org/sbt-typelevel/faq.html#what-is-a-base-version-anyway +ThisBuild / tlBaseVersion := "0.0" // your current series x.y + +ThisBuild / organization := "weaver" +ThisBuild / organizationName := "Typelevel" +ThisBuild / startYear := Some(2019) +ThisBuild / licenses := Seq(License.Apache2) +ThisBuild / developers := List( + tlGitHubDev("baccata", "Olivier Mélois"), + tlGitHubDev("keynmol", "Anton Sviridov"), + tlGitHubDev("valencik", "Andrew Valencik"), +) -ThisBuild / scalafixDependencies += "com.github.liancheng" %% "organize-imports" % "0.5.0" +// publish to s01.oss.sonatype.org (set to true to publish to oss.sonatype.org instead) +ThisBuild / tlSonatypeUseLegacyHost := false -Global / (Test / fork) := true -Global / (Test / testOptions) += Tests.Argument("--quickstart") +// use JDK 11 +ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec.temurin("11")) -sonatypeCredentialHost := "s01.oss.sonatype.org" +val scala212 = "2.12.17" +val scala213 = "2.13.10" +ThisBuild / crossScalaVersions := Seq(scala212, scala213, "3.3.1") +ThisBuild / scalaVersion := scala213 // the default Scala val Version = new { - object CE3 { - val fs2 = "3.5.0" - val ce = "3.5.2" - } - + val catsEffect = "3.5.2" + val catsLaws = "2.9.0" + val discipline = "1.5.1" val expecty = "0.16.0" - val portableReflect = "1.1.2" + val fs2 = "3.5.0" val junit = "4.13.2" - val scalajsStubs = "1.1.0" - val discipline = "1.5.1" - val catsLaws = "2.9.0" - val scalacheck = "1.17.0" - val testInterface = "1.0" + val portableReflect = "1.1.2" val scalaJavaTime = "2.4.0" + val scalacheck = "1.17.0" val scalajsMacroTask = "1.1.1" + val scalajsStubs = "1.1.0" + val testInterface = "1.0" } -lazy val root = project - .in(file(".")) - .aggregate(allModules: _*) - .settings(WeaverPlugin.doNotPublishArtifact) - -lazy val allModules = Seq( - core.projectRefs, - framework.projectRefs, - scalacheck.projectRefs, - discipline.projectRefs, - effectCores, - effectFrameworks -).flatten +lazy val root = tlCrossRootProject.aggregate(core) -def catsEffectDependencies(proj: Project): Project = { - proj.settings( - libraryDependencies ++= - Seq( - "co.fs2" %%% "fs2-core" % Version.CE3.fs2, - "org.typelevel" %%% "cats-effect" % Version.CE3.ce - ) - ) -} - -lazy val core = projectMatrix +lazy val core = crossProject(JVMPlatform) .in(file("modules/core")) - .settings(WeaverPlugin.simpleLayout) - .full - .configure(catsEffectDependencies) .settings( + name := "core", libraryDependencies ++= Seq( + "co.fs2" %%% "fs2-core" % Version.fs2, + "org.typelevel" %%% "cats-effect" % Version.catsEffect, "com.eed3si9n.expecty" %%% "expecty" % Version.expecty, // https://github.com/portable-scala/portable-scala-reflect/issues/23 - "org.portable-scala" %%% "portable-scala-reflect" % Version.portableReflect cross CrossVersion.for3Use2_13 - ), - libraryDependencies ++= { - if (virtualAxes.value.contains(VirtualAxis.jvm)) - Seq( - "org.scala-js" %%% "scalajs-stubs" % Version.scalajsStubs % "provided" cross CrossVersion.for3Use2_13, - "junit" % "junit" % Version.junit % Optional - ) - else Seq.empty - }, - libraryDependencies ++= { - if (virtualAxes.value.contains(VirtualAxis.jvm)) { - if (scalaVersion.value.startsWith("3.")) - Seq("org.scala-lang" % "scala-reflect" % scala213) - else - Seq("org.scala-lang" % "scala-reflect" % scalaVersion.value) - } else Seq.empty - } - ) - -lazy val projectsWithAxes = Def.task { - (name.value, virtualAxes.value, version.value) -} - -val allEffectCoresFilter: ScopeFilter = - ScopeFilter( - inProjects(effectFrameworks: _*), - inConfigurations(Compile) - ) - -val allIntegrationsCoresFilter: ScopeFilter = - ScopeFilter( - inProjects( - (scalacheck.projectRefs ++ discipline.projectRefs): _*), - inConfigurations(Compile) - ) - -lazy val docs = projectMatrix - .in(file("modules/docs")) - .jvmPlatform(Seq(WeaverPlugin.scala213)) - .enablePlugins(DocusaurusPlugin, MdocPlugin) - .dependsOn(core, scalacheck, cats, discipline) - .settings( - moduleName := "docs", - watchSources += (ThisBuild / baseDirectory).value / "docs", - mdocVariables := Map( - "VERSION" -> version.value + "org.portable-scala" %%% "portable-scala-reflect" % Version.portableReflect cross CrossVersion.for3Use2_13, + "org.scala-js" %%% "scalajs-stubs" % Version.scalajsStubs % "provided" cross CrossVersion.for3Use2_13, + "junit" % "junit" % Version.junit % Optional, + if (scalaVersion.value.startsWith("3.")) + "org.scala-lang" % "scala-reflect" % scala213 + else + "org.scala-lang" % "scala-reflect" % scalaVersion.value ), - libraryDependencies ++= Seq( - "org.http4s" %% "http4s-dsl" % "0.23.12", - "org.http4s" %% "http4s-blaze-server" % "0.23.12", - "org.http4s" %% "http4s-blaze-client" % "0.23.12", - "com.lihaoyi" %% "fansi" % "0.2.7", - "org.typelevel" %% "cats-kernel-laws" % "2.8.0" - ), - Compile / sourceGenerators += Def.taskDyn { - val filePath = - (Compile / sourceManaged).value / "BuildMatrix.scala" - - def q(s: String) = '"' + s + '"' - - def process(f: Iterable[(String, Seq[VirtualAxis], String)]) = f.map { - case (name, axes, ver) => - val isJVM = axes.contains(VirtualAxis.jvm) - val isJS = axes.contains(VirtualAxis.js) - val scalaVersion = axes.collectFirst { - case a: VirtualAxis.ScalaVersionAxis => a - }.get.scalaVersion - - List( - s"name = ${q(name)}", - s"jvm = $isJVM", - s"js = $isJS", - s"scalaVersion = ${q(scalaVersion)}", - s"version = ${q(ver)}" - ).mkString("Artifact(", ",", ")") - }.mkString("List(", ",\n", ")") - - val effects = process(projectsWithAxes.all(allEffectCoresFilter).value) - val integrations = - process(projectsWithAxes.all(allIntegrationsCoresFilter).value) - - val artifactsCE3Version = (cats.jvm(scala213) / version).value - - IO.write( - filePath, - s""" - | package weaver.docs - | - | object BuildMatrix { - | val catsEffect3Version = ${q(Version.CE3.ce)} - | val artifactsCE3Version = ${q(artifactsCE3Version)} - | val effects = $effects - | val integrations = $integrations - | } - """.stripMargin - ) - - Def.task(Seq(filePath)) - } - ) - -lazy val framework = projectMatrix - .in(file("modules/framework")) - .dependsOn(core) - .full - .settings( - libraryDependencies ++= { - if (virtualAxes.value.contains(VirtualAxis.jvm)) - Seq( - "org.scala-sbt" % "test-interface" % Version.testInterface, - "org.scala-js" %%% "scalajs-stubs" % Version.scalajsStubs % "provided" cross CrossVersion.for3Use2_13 - ) - else if (virtualAxes.value.contains(VirtualAxis.js)) - Seq( - "org.scala-js" %% "scalajs-test-interface" % scalaJSVersion cross CrossVersion.for3Use2_13 - ) - else if (virtualAxes.value.contains(VirtualAxis.native)) - Seq( - "org.scala-native" %%% "test-interface" % nativeVersion - ) - else Seq.empty - } ++ Seq("junit" % "junit" % Version.junit) - ) - .settings(WeaverPlugin.simpleLayout) - -lazy val scalacheck = projectMatrix - .in(file("modules/scalacheck")) - .full - .dependsOn(core, cats % "test->compile") - .settings(WeaverPlugin.simpleLayout) - .settings( - testFrameworks := Seq(new TestFramework("weaver.framework.CatsEffect")), - libraryDependencies ++= Seq( - "org.scalacheck" %%% "scalacheck" % Version.scalacheck, - "org.typelevel" %%% "cats-effect-testkit" % Version.CE3.ce % Test) - ) - -lazy val discipline = projectMatrix - .in(file("modules/discipline")) - .full - .dependsOn(core, cats) - .settings( - name := "discipline", - testFrameworks := Seq(new TestFramework("weaver.framework.CatsEffect")), - libraryDependencies ++= Seq( - "org.typelevel" %%% "discipline-core" % Version.discipline, - "org.typelevel" %%% "cats-laws" % Version.catsLaws % Test - ) - ) - .settings(WeaverPlugin.simpleLayout) - -// ################################################################################################# -// Effect-specific cores -// ################################################################################################# - -lazy val effectCores: Seq[ProjectReference] = - coreCats.projectRefs - -lazy val coreCats = projectMatrix - .in(file("modules/core/cats")) - .full - .dependsOn(core) - .settings(WeaverPlugin.simpleLayout) - .settings(scalaJSMacroTask) - .settings(name := "cats-core") - -// ################################################################################################# -// Effect-specific frameworks -// ################################################################################################# - -lazy val effectFrameworks: Seq[ProjectReference] = cats.projectRefs - -lazy val cats = projectMatrix - .in(file("modules/framework/cats")) - .dependsOn(framework, coreCats) - .full - .settings(WeaverPlugin.simpleLayout) - .settings( - name := "cats", - testFrameworks := Seq(new TestFramework("weaver.framework.CatsEffect")) ) - -// ################################################################################################# -// Misc -// ################################################################################################# - -lazy val versionDump = - taskKey[Unit]("Dumps the version in a file named version") - -versionDump := { - val file = (ThisBuild / baseDirectory).value / "version" - IO.write(file, (Compile / version).value) -} - -ThisBuild / concurrentRestrictions ++= { - if (!sys.env.contains("CI")) { - Seq( - Tags.limitAll(4), - Tags.limit(ScalaJSPlugin.autoImport.ScalaJSTags.Link, 1) - ) - } else Seq.empty -} - -lazy val scalaJSMacroTask: Seq[Def.Setting[_]] = Seq( - libraryDependencies ++= { - if (virtualAxes.value.contains(VirtualAxis.js)) - Seq("org.scala-js" %%% "scala-js-macrotask-executor" % Version.scalajsMacroTask) - else - Seq.empty - } -) diff --git a/modules/codecs/src/weaver/codecs/LogEntry.scala b/modules/codecs/shared/src/main/scala/weaver/codecs/LogEntry.scala similarity index 100% rename from modules/codecs/src/weaver/codecs/LogEntry.scala rename to modules/codecs/shared/src/main/scala/weaver/codecs/LogEntry.scala diff --git a/modules/codecs/src/weaver/codecs/SerialisableThrowable.scala b/modules/codecs/shared/src/main/scala/weaver/codecs/SerialisableThrowable.scala similarity index 100% rename from modules/codecs/src/weaver/codecs/SerialisableThrowable.scala rename to modules/codecs/shared/src/main/scala/weaver/codecs/SerialisableThrowable.scala diff --git a/modules/codecs/src/weaver/codecs/SuiteEvent.scala b/modules/codecs/shared/src/main/scala/weaver/codecs/SuiteEvent.scala similarity index 100% rename from modules/codecs/src/weaver/codecs/SuiteEvent.scala rename to modules/codecs/shared/src/main/scala/weaver/codecs/SuiteEvent.scala diff --git a/modules/codecs/src/weaver/codecs/oneOf.scala b/modules/codecs/shared/src/main/scala/weaver/codecs/oneOf.scala similarity index 100% rename from modules/codecs/src/weaver/codecs/oneOf.scala rename to modules/codecs/shared/src/main/scala/weaver/codecs/oneOf.scala diff --git a/modules/codecs/src/weaver/codecs/package.scala b/modules/codecs/shared/src/main/scala/weaver/codecs/package.scala similarity index 100% rename from modules/codecs/src/weaver/codecs/package.scala rename to modules/codecs/shared/src/main/scala/weaver/codecs/package.scala diff --git a/modules/codecs/test/resources/golden.json b/modules/codecs/shared/src/test/resources/golden.json similarity index 100% rename from modules/codecs/test/resources/golden.json rename to modules/codecs/shared/src/test/resources/golden.json diff --git a/modules/codecs/test/src/weaver/codecs/CodecsTest.scala b/modules/codecs/shared/src/test/scala/weaver/codecs/CodecsTest.scala similarity index 100% rename from modules/codecs/test/src/weaver/codecs/CodecsTest.scala rename to modules/codecs/shared/src/test/scala/weaver/codecs/CodecsTest.scala diff --git a/modules/core/cats/src-js/weaver/CatsUnsafeRunPlatformCompat.scala b/modules/core-cats/js/src/main/scala/weaver/CatsUnsafeRunPlatformCompat.scala similarity index 100% rename from modules/core/cats/src-js/weaver/CatsUnsafeRunPlatformCompat.scala rename to modules/core-cats/js/src/main/scala/weaver/CatsUnsafeRunPlatformCompat.scala diff --git a/modules/core/cats/src-jvm/weaver/CatsUnsafeRunPlatformCompat.scala b/modules/core-cats/jvm/src/main/scala/weaver/CatsUnsafeRunPlatformCompat.scala similarity index 100% rename from modules/core/cats/src-jvm/weaver/CatsUnsafeRunPlatformCompat.scala rename to modules/core-cats/jvm/src/main/scala/weaver/CatsUnsafeRunPlatformCompat.scala diff --git a/modules/core/cats/src-native/weaver/CatsUnsafeRunPlatformCompat.scala b/modules/core-cats/native/src/main/scala/weaver/CatsUnsafeRunPlatformCompat.scala similarity index 100% rename from modules/core/cats/src-native/weaver/CatsUnsafeRunPlatformCompat.scala rename to modules/core-cats/native/src/main/scala/weaver/CatsUnsafeRunPlatformCompat.scala diff --git a/modules/core/cats/src/weaver/BaseIOSuite.scala b/modules/core-cats/shared/src/main/scala/weaver/BaseIOSuite.scala similarity index 100% rename from modules/core/cats/src/weaver/BaseIOSuite.scala rename to modules/core-cats/shared/src/main/scala/weaver/BaseIOSuite.scala diff --git a/modules/core/cats/src/weaver/CatsUnsafeRun.scala b/modules/core-cats/shared/src/main/scala/weaver/CatsUnsafeRun.scala similarity index 100% rename from modules/core/cats/src/weaver/CatsUnsafeRun.scala rename to modules/core-cats/shared/src/main/scala/weaver/CatsUnsafeRun.scala diff --git a/modules/core/cats/src/weaver/IOGlobalResource.scala b/modules/core-cats/shared/src/main/scala/weaver/IOGlobalResource.scala similarity index 100% rename from modules/core/cats/src/weaver/IOGlobalResource.scala rename to modules/core-cats/shared/src/main/scala/weaver/IOGlobalResource.scala diff --git a/modules/core/cats/src/weaver/Suites.scala b/modules/core-cats/shared/src/main/scala/weaver/Suites.scala similarity index 100% rename from modules/core/cats/src/weaver/Suites.scala rename to modules/core-cats/shared/src/main/scala/weaver/Suites.scala diff --git a/modules/core/cats/src/weaver/package.scala b/modules/core-cats/shared/src/main/scala/weaver/package.scala similarity index 100% rename from modules/core/cats/src/weaver/package.scala rename to modules/core-cats/shared/src/main/scala/weaver/package.scala diff --git a/modules/core/src-js/org/junit/runner/RunWith.scala b/modules/core/js/src/main/scala/org/junit/runner/RunWith.scala similarity index 100% rename from modules/core/src-js/org/junit/runner/RunWith.scala rename to modules/core/js/src/main/scala/org/junit/runner/RunWith.scala diff --git a/modules/core/src-js/weaver/PlatformCompat.scala b/modules/core/js/src/main/scala/weaver/PlatformCompat.scala similarity index 100% rename from modules/core/src-js/weaver/PlatformCompat.scala rename to modules/core/js/src/main/scala/weaver/PlatformCompat.scala diff --git a/modules/core/src-js/weaver/internals/Timestamp.scala b/modules/core/js/src/main/scala/weaver/internals/Timestamp.scala similarity index 100% rename from modules/core/src-js/weaver/internals/Timestamp.scala rename to modules/core/js/src/main/scala/weaver/internals/Timestamp.scala diff --git a/modules/core/src-js/weaver/junit/WeaverRunner.scala b/modules/core/js/src/main/scala/weaver/junit/WeaverRunner.scala similarity index 100% rename from modules/core/src-js/weaver/junit/WeaverRunner.scala rename to modules/core/js/src/main/scala/weaver/junit/WeaverRunner.scala diff --git a/modules/core/src-jvm/weaver/PlatformCompat.scala b/modules/core/jvm/src/main/scala/weaver/PlatformCompat.scala similarity index 100% rename from modules/core/src-jvm/weaver/PlatformCompat.scala rename to modules/core/jvm/src/main/scala/weaver/PlatformCompat.scala diff --git a/modules/core/src-jvm/weaver/internals/Timestamp.scala b/modules/core/jvm/src/main/scala/weaver/internals/Timestamp.scala similarity index 100% rename from modules/core/src-jvm/weaver/internals/Timestamp.scala rename to modules/core/jvm/src/main/scala/weaver/internals/Timestamp.scala diff --git a/modules/core/src-jvm/weaver/junit/WeaverRunner.scala b/modules/core/jvm/src/main/scala/weaver/junit/WeaverRunner.scala similarity index 100% rename from modules/core/src-jvm/weaver/junit/WeaverRunner.scala rename to modules/core/jvm/src/main/scala/weaver/junit/WeaverRunner.scala diff --git a/modules/core/src-native/org/junit/runner/RunWith.scala b/modules/core/native/src/main/scala/org/junit/runner/RunWith.scala similarity index 100% rename from modules/core/src-native/org/junit/runner/RunWith.scala rename to modules/core/native/src/main/scala/org/junit/runner/RunWith.scala diff --git a/modules/core/src-native/weaver/PlatformCompat.scala b/modules/core/native/src/main/scala/weaver/PlatformCompat.scala similarity index 100% rename from modules/core/src-native/weaver/PlatformCompat.scala rename to modules/core/native/src/main/scala/weaver/PlatformCompat.scala diff --git a/modules/core/src-native/weaver/internals/Timestamp.scala b/modules/core/native/src/main/scala/weaver/internals/Timestamp.scala similarity index 100% rename from modules/core/src-native/weaver/internals/Timestamp.scala rename to modules/core/native/src/main/scala/weaver/internals/Timestamp.scala diff --git a/modules/core/src-native/weaver/junit/WeaverRunner.scala b/modules/core/native/src/main/scala/weaver/junit/WeaverRunner.scala similarity index 100% rename from modules/core/src-native/weaver/junit/WeaverRunner.scala rename to modules/core/native/src/main/scala/weaver/junit/WeaverRunner.scala diff --git a/modules/core/src-scala-2/Expect.scala b/modules/core/shared/src/main/scala-2/weaver/Expect.scala similarity index 100% rename from modules/core/src-scala-2/Expect.scala rename to modules/core/shared/src/main/scala-2/weaver/Expect.scala diff --git a/modules/core/src-scala-2/ScalaCompat.scala b/modules/core/shared/src/main/scala-2/weaver/ScalaCompat.scala similarity index 100% rename from modules/core/src-scala-2/ScalaCompat.scala rename to modules/core/shared/src/main/scala-2/weaver/ScalaCompat.scala diff --git a/modules/core/src-scala-2/SourceLocationMacro.scala b/modules/core/shared/src/main/scala-2/weaver/SourceLocationMacro.scala similarity index 100% rename from modules/core/src-scala-2/SourceLocationMacro.scala rename to modules/core/shared/src/main/scala-2/weaver/SourceLocationMacro.scala diff --git a/modules/core/src-scala-3/Expect.scala b/modules/core/shared/src/main/scala-3/weaver/Expect.scala similarity index 100% rename from modules/core/src-scala-3/Expect.scala rename to modules/core/shared/src/main/scala-3/weaver/Expect.scala diff --git a/modules/core/src-scala-3/ScalaCompat.scala b/modules/core/shared/src/main/scala-3/weaver/ScalaCompat.scala similarity index 100% rename from modules/core/src-scala-3/ScalaCompat.scala rename to modules/core/shared/src/main/scala-3/weaver/ScalaCompat.scala diff --git a/modules/core/src-scala-3/SourceLocationMacro.scala b/modules/core/shared/src/main/scala-3/weaver/SourceLocationMacro.scala similarity index 100% rename from modules/core/src-scala-3/SourceLocationMacro.scala rename to modules/core/shared/src/main/scala-3/weaver/SourceLocationMacro.scala diff --git a/modules/core/src/weaver/Blocking.scala b/modules/core/shared/src/main/scala/weaver/Blocking.scala similarity index 100% rename from modules/core/src/weaver/Blocking.scala rename to modules/core/shared/src/main/scala/weaver/Blocking.scala diff --git a/modules/core/src/weaver/Colours.scala b/modules/core/shared/src/main/scala/weaver/Colours.scala similarity index 100% rename from modules/core/src/weaver/Colours.scala rename to modules/core/shared/src/main/scala/weaver/Colours.scala diff --git a/modules/core/src/weaver/Expectations.scala b/modules/core/shared/src/main/scala/weaver/Expectations.scala similarity index 100% rename from modules/core/src/weaver/Expectations.scala rename to modules/core/shared/src/main/scala/weaver/Expectations.scala diff --git a/modules/core/src/weaver/Filters.scala b/modules/core/shared/src/main/scala/weaver/Filters.scala similarity index 100% rename from modules/core/src/weaver/Filters.scala rename to modules/core/shared/src/main/scala/weaver/Filters.scala diff --git a/modules/core/src/weaver/Formatter.scala b/modules/core/shared/src/main/scala/weaver/Formatter.scala similarity index 100% rename from modules/core/src/weaver/Formatter.scala rename to modules/core/shared/src/main/scala/weaver/Formatter.scala diff --git a/modules/core/src/weaver/GlobalResourceF.scala b/modules/core/shared/src/main/scala/weaver/GlobalResourceF.scala similarity index 100% rename from modules/core/src/weaver/GlobalResourceF.scala rename to modules/core/shared/src/main/scala/weaver/GlobalResourceF.scala diff --git a/modules/core/src/weaver/Log.scala b/modules/core/shared/src/main/scala/weaver/Log.scala similarity index 100% rename from modules/core/src/weaver/Log.scala rename to modules/core/shared/src/main/scala/weaver/Log.scala diff --git a/modules/core/src/weaver/LogFormatter.scala b/modules/core/shared/src/main/scala/weaver/LogFormatter.scala similarity index 100% rename from modules/core/src/weaver/LogFormatter.scala rename to modules/core/shared/src/main/scala/weaver/LogFormatter.scala diff --git a/modules/core/src/weaver/MemoisedResource.scala b/modules/core/shared/src/main/scala/weaver/MemoisedResource.scala similarity index 100% rename from modules/core/src/weaver/MemoisedResource.scala rename to modules/core/shared/src/main/scala/weaver/MemoisedResource.scala diff --git a/modules/core/src/weaver/Platform.scala b/modules/core/shared/src/main/scala/weaver/Platform.scala similarity index 100% rename from modules/core/src/weaver/Platform.scala rename to modules/core/shared/src/main/scala/weaver/Platform.scala diff --git a/modules/core/src/weaver/Result.scala b/modules/core/shared/src/main/scala/weaver/Result.scala similarity index 100% rename from modules/core/src/weaver/Result.scala rename to modules/core/shared/src/main/scala/weaver/Result.scala diff --git a/modules/core/src/weaver/Runner.scala b/modules/core/shared/src/main/scala/weaver/Runner.scala similarity index 100% rename from modules/core/src/weaver/Runner.scala rename to modules/core/shared/src/main/scala/weaver/Runner.scala diff --git a/modules/core/src/weaver/SourceLocation.scala b/modules/core/shared/src/main/scala/weaver/SourceLocation.scala similarity index 100% rename from modules/core/src/weaver/SourceLocation.scala rename to modules/core/shared/src/main/scala/weaver/SourceLocation.scala diff --git a/modules/core/src/weaver/Test.scala b/modules/core/shared/src/main/scala/weaver/Test.scala similarity index 100% rename from modules/core/src/weaver/Test.scala rename to modules/core/shared/src/main/scala/weaver/Test.scala diff --git a/modules/core/src/weaver/TestErrorFormatter.scala b/modules/core/shared/src/main/scala/weaver/TestErrorFormatter.scala similarity index 100% rename from modules/core/src/weaver/TestErrorFormatter.scala rename to modules/core/shared/src/main/scala/weaver/TestErrorFormatter.scala diff --git a/modules/core/src/weaver/TestName.scala b/modules/core/shared/src/main/scala/weaver/TestName.scala similarity index 100% rename from modules/core/src/weaver/TestName.scala rename to modules/core/shared/src/main/scala/weaver/TestName.scala diff --git a/modules/core/src/weaver/TestOutcome.scala b/modules/core/shared/src/main/scala/weaver/TestOutcome.scala similarity index 100% rename from modules/core/src/weaver/TestOutcome.scala rename to modules/core/shared/src/main/scala/weaver/TestOutcome.scala diff --git a/modules/core/src/weaver/TestStatus.scala b/modules/core/shared/src/main/scala/weaver/TestStatus.scala similarity index 100% rename from modules/core/src/weaver/TestStatus.scala rename to modules/core/shared/src/main/scala/weaver/TestStatus.scala diff --git a/modules/core/src/weaver/UnsafeRun.scala b/modules/core/shared/src/main/scala/weaver/UnsafeRun.scala similarity index 100% rename from modules/core/src/weaver/UnsafeRun.scala rename to modules/core/shared/src/main/scala/weaver/UnsafeRun.scala diff --git a/modules/core/src/weaver/discard.scala b/modules/core/shared/src/main/scala/weaver/discard.scala similarity index 100% rename from modules/core/src/weaver/discard.scala rename to modules/core/shared/src/main/scala/weaver/discard.scala diff --git a/modules/core/src/weaver/exceptions.scala b/modules/core/shared/src/main/scala/weaver/exceptions.scala similarity index 100% rename from modules/core/src/weaver/exceptions.scala rename to modules/core/shared/src/main/scala/weaver/exceptions.scala diff --git a/modules/core/src/weaver/internals/ExpectSame.scala b/modules/core/shared/src/main/scala/weaver/internals/ExpectSame.scala similarity index 100% rename from modules/core/src/weaver/internals/ExpectSame.scala rename to modules/core/shared/src/main/scala/weaver/internals/ExpectSame.scala diff --git a/modules/core/src/weaver/internals/ExpectyListener.scala b/modules/core/shared/src/main/scala/weaver/internals/ExpectyListener.scala similarity index 100% rename from modules/core/src/weaver/internals/ExpectyListener.scala rename to modules/core/shared/src/main/scala/weaver/internals/ExpectyListener.scala diff --git a/modules/core/src/weaver/internals/Reflection.scala b/modules/core/shared/src/main/scala/weaver/internals/Reflection.scala similarity index 100% rename from modules/core/src/weaver/internals/Reflection.scala rename to modules/core/shared/src/main/scala/weaver/internals/Reflection.scala diff --git a/modules/core/src/weaver/suites.scala b/modules/core/shared/src/main/scala/weaver/suites.scala similarity index 100% rename from modules/core/src/weaver/suites.scala rename to modules/core/shared/src/main/scala/weaver/suites.scala diff --git a/modules/discipline/src/weaver/discipline/Discipline.scala b/modules/discipline/shared/src/main/scala/weaver/discipline/Discipline.scala similarity index 100% rename from modules/discipline/src/weaver/discipline/Discipline.scala rename to modules/discipline/shared/src/main/scala/weaver/discipline/Discipline.scala diff --git a/modules/discipline/test/src/DisciplineFSuiteIntegrationTest.scala b/modules/discipline/shared/src/test/scala/DisciplineFSuiteIntegrationTest.scala similarity index 100% rename from modules/discipline/test/src/DisciplineFSuiteIntegrationTest.scala rename to modules/discipline/shared/src/test/scala/DisciplineFSuiteIntegrationTest.scala diff --git a/modules/discipline/test/src/DisciplineIntegrationTest.scala b/modules/discipline/shared/src/test/scala/DisciplineIntegrationTest.scala similarity index 100% rename from modules/discipline/test/src/DisciplineIntegrationTest.scala rename to modules/discipline/shared/src/test/scala/DisciplineIntegrationTest.scala diff --git a/modules/discipline/test/src/RickRollLaws.scala b/modules/discipline/shared/src/test/scala/RickRollLaws.scala similarity index 100% rename from modules/discipline/test/src/RickRollLaws.scala rename to modules/discipline/shared/src/test/scala/RickRollLaws.scala diff --git a/modules/docs/src/main/scala/weaver/MatrixRendering.scala b/modules/docs/shared/src/main/scala/main/scala/weaver/MatrixRendering.scala similarity index 100% rename from modules/docs/src/main/scala/weaver/MatrixRendering.scala rename to modules/docs/shared/src/main/scala/main/scala/weaver/MatrixRendering.scala diff --git a/modules/docs/src/main/scala/weaver/Output.scala b/modules/docs/shared/src/main/scala/main/scala/weaver/Output.scala similarity index 100% rename from modules/docs/src/main/scala/weaver/Output.scala rename to modules/docs/shared/src/main/scala/main/scala/weaver/Output.scala diff --git a/modules/framework/cats/test/src-jvm/DogFoodTestsJVM.scala b/modules/framework-cats/jvm/src/test/scala/DogFoodTestsJVM.scala similarity index 100% rename from modules/framework/cats/test/src-jvm/DogFoodTestsJVM.scala rename to modules/framework-cats/jvm/src/test/scala/DogFoodTestsJVM.scala diff --git a/modules/framework/cats/test/src-jvm/MetaJVM.scala b/modules/framework-cats/jvm/src/test/scala/MetaJVM.scala similarity index 100% rename from modules/framework/cats/test/src-jvm/MetaJVM.scala rename to modules/framework-cats/jvm/src/test/scala/MetaJVM.scala diff --git a/modules/framework/cats/test/src-jvm/junit/JUnitRunnerTests.scala b/modules/framework-cats/jvm/src/test/scala/junit/JUnitRunnerTests.scala similarity index 100% rename from modules/framework/cats/test/src-jvm/junit/JUnitRunnerTests.scala rename to modules/framework-cats/jvm/src/test/scala/junit/JUnitRunnerTests.scala diff --git a/modules/framework/cats/test/src-jvm/junit/Meta.scala b/modules/framework-cats/jvm/src/test/scala/junit/Meta.scala similarity index 100% rename from modules/framework/cats/test/src-jvm/junit/Meta.scala rename to modules/framework-cats/jvm/src/test/scala/junit/Meta.scala diff --git a/modules/framework/cats/src/weaver/framework/CatsFramework.scala b/modules/framework-cats/shared/src/main/scala/weaver/framework/CatsFramework.scala similarity index 100% rename from modules/framework/cats/src/weaver/framework/CatsFramework.scala rename to modules/framework-cats/shared/src/main/scala/weaver/framework/CatsFramework.scala diff --git a/modules/framework/cats/test/src/DogFoodTests.scala b/modules/framework-cats/shared/src/test/scala/DogFoodTests.scala similarity index 100% rename from modules/framework/cats/test/src/DogFoodTests.scala rename to modules/framework-cats/shared/src/test/scala/DogFoodTests.scala diff --git a/modules/framework/cats/test/src/ExpectationsTests.scala b/modules/framework-cats/shared/src/test/scala/ExpectationsTests.scala similarity index 100% rename from modules/framework/cats/test/src/ExpectationsTests.scala rename to modules/framework-cats/shared/src/test/scala/ExpectationsTests.scala diff --git a/modules/framework/cats/test/src/FormatterTests.scala b/modules/framework-cats/shared/src/test/scala/FormatterTests.scala similarity index 100% rename from modules/framework/cats/test/src/FormatterTests.scala rename to modules/framework-cats/shared/src/test/scala/FormatterTests.scala diff --git a/modules/framework/cats/test/src/FunSuiteTest.scala b/modules/framework-cats/shared/src/test/scala/FunSuiteTest.scala similarity index 100% rename from modules/framework/cats/test/src/FunSuiteTest.scala rename to modules/framework-cats/shared/src/test/scala/FunSuiteTest.scala diff --git a/modules/framework/cats/test/src/Global.scala b/modules/framework-cats/shared/src/test/scala/Global.scala similarity index 100% rename from modules/framework/cats/test/src/Global.scala rename to modules/framework-cats/shared/src/test/scala/Global.scala diff --git a/modules/framework/cats/test/src/MemoisedResourceTests.scala b/modules/framework-cats/shared/src/test/scala/MemoisedResourceTests.scala similarity index 100% rename from modules/framework/cats/test/src/MemoisedResourceTests.scala rename to modules/framework-cats/shared/src/test/scala/MemoisedResourceTests.scala diff --git a/modules/framework/cats/test/src/Meta.scala b/modules/framework-cats/shared/src/test/scala/Meta.scala similarity index 100% rename from modules/framework/cats/test/src/Meta.scala rename to modules/framework-cats/shared/src/test/scala/Meta.scala diff --git a/modules/framework/cats/test/src/MutableSuiteTest.scala b/modules/framework-cats/shared/src/test/scala/MutableSuiteTest.scala similarity index 100% rename from modules/framework/cats/test/src/MutableSuiteTest.scala rename to modules/framework-cats/shared/src/test/scala/MutableSuiteTest.scala diff --git a/modules/framework/cats/test/src/SharedResourceTests.scala b/modules/framework-cats/shared/src/test/scala/SharedResourceTests.scala similarity index 100% rename from modules/framework/cats/test/src/SharedResourceTests.scala rename to modules/framework-cats/shared/src/test/scala/SharedResourceTests.scala diff --git a/modules/framework/cats/test/src/SourceLocationTest.scala b/modules/framework-cats/shared/src/test/scala/SourceLocationTest.scala similarity index 100% rename from modules/framework/cats/test/src/SourceLocationTest.scala rename to modules/framework-cats/shared/src/test/scala/SourceLocationTest.scala diff --git a/modules/framework/cats/test/src/TracingTests.scala b/modules/framework-cats/shared/src/test/scala/TracingTests.scala similarity index 100% rename from modules/framework/cats/test/src/TracingTests.scala rename to modules/framework-cats/shared/src/test/scala/TracingTests.scala diff --git a/modules/framework/src-js-native/AsyncTask.scala b/modules/framework/js-native/src/main/scala/AsyncTask.scala similarity index 100% rename from modules/framework/src-js-native/AsyncTask.scala rename to modules/framework/js-native/src/main/scala/AsyncTask.scala diff --git a/modules/framework/src-js-native/DogFoodCompat.scala b/modules/framework/js-native/src/main/scala/DogFoodCompat.scala similarity index 100% rename from modules/framework/src-js-native/DogFoodCompat.scala rename to modules/framework/js-native/src/main/scala/DogFoodCompat.scala diff --git a/modules/framework/src-js-native/RunnerCompat.scala b/modules/framework/js-native/src/main/scala/RunnerCompat.scala similarity index 100% rename from modules/framework/src-js-native/RunnerCompat.scala rename to modules/framework/js-native/src/main/scala/RunnerCompat.scala diff --git a/modules/framework/src-js-native/TaskCompat.scala b/modules/framework/js-native/src/main/scala/TaskCompat.scala similarity index 100% rename from modules/framework/src-js-native/TaskCompat.scala rename to modules/framework/js-native/src/main/scala/TaskCompat.scala diff --git a/modules/framework/src-js/PlatformTask.scala b/modules/framework/js/src/main/scala/PlatformTask.scala similarity index 100% rename from modules/framework/src-js/PlatformTask.scala rename to modules/framework/js/src/main/scala/PlatformTask.scala diff --git a/modules/framework/src-jvm/DogFoodCompat.scala b/modules/framework/jvm/src/main/scala/DogFoodCompat.scala similarity index 100% rename from modules/framework/src-jvm/DogFoodCompat.scala rename to modules/framework/jvm/src/main/scala/DogFoodCompat.scala diff --git a/modules/framework/src-jvm/RunnerCompat.scala b/modules/framework/jvm/src/main/scala/RunnerCompat.scala similarity index 100% rename from modules/framework/src-jvm/RunnerCompat.scala rename to modules/framework/jvm/src/main/scala/RunnerCompat.scala diff --git a/modules/framework/src-jvm/SbtTask.scala b/modules/framework/jvm/src/main/scala/SbtTask.scala similarity index 100% rename from modules/framework/src-jvm/SbtTask.scala rename to modules/framework/jvm/src/main/scala/SbtTask.scala diff --git a/modules/framework/src-jvm/TaskCompat.scala b/modules/framework/jvm/src/main/scala/TaskCompat.scala similarity index 100% rename from modules/framework/src-jvm/TaskCompat.scala rename to modules/framework/jvm/src/main/scala/TaskCompat.scala diff --git a/modules/framework/src-native/PlatformTask.scala b/modules/framework/native/src/main/scala/PlatformTask.scala similarity index 100% rename from modules/framework/src-native/PlatformTask.scala rename to modules/framework/native/src/main/scala/PlatformTask.scala diff --git a/modules/framework/src/weaver/framework/DogFood.scala b/modules/framework/shared/src/main/scala/weaver/framework/DogFood.scala similarity index 100% rename from modules/framework/src/weaver/framework/DogFood.scala rename to modules/framework/shared/src/main/scala/weaver/framework/DogFood.scala diff --git a/modules/framework/src/weaver/framework/Fingerprints.scala b/modules/framework/shared/src/main/scala/weaver/framework/Fingerprints.scala similarity index 100% rename from modules/framework/src/weaver/framework/Fingerprints.scala rename to modules/framework/shared/src/main/scala/weaver/framework/Fingerprints.scala diff --git a/modules/framework/src/weaver/framework/Reporter.scala b/modules/framework/shared/src/main/scala/weaver/framework/Reporter.scala similarity index 100% rename from modules/framework/src/weaver/framework/Reporter.scala rename to modules/framework/shared/src/main/scala/weaver/framework/Reporter.scala diff --git a/modules/framework/src/weaver/framework/SbtEvent.scala b/modules/framework/shared/src/main/scala/weaver/framework/SbtEvent.scala similarity index 100% rename from modules/framework/src/weaver/framework/SbtEvent.scala rename to modules/framework/shared/src/main/scala/weaver/framework/SbtEvent.scala diff --git a/modules/framework/src/weaver/framework/SuiteEvent.scala b/modules/framework/shared/src/main/scala/weaver/framework/SuiteEvent.scala similarity index 100% rename from modules/framework/src/weaver/framework/SuiteEvent.scala rename to modules/framework/shared/src/main/scala/weaver/framework/SuiteEvent.scala diff --git a/modules/framework/src/weaver/framework/SuiteLoader.scala b/modules/framework/shared/src/main/scala/weaver/framework/SuiteLoader.scala similarity index 100% rename from modules/framework/src/weaver/framework/SuiteLoader.scala rename to modules/framework/shared/src/main/scala/weaver/framework/SuiteLoader.scala diff --git a/modules/framework/src/weaver/framework/WeaverFramework.scala b/modules/framework/shared/src/main/scala/weaver/framework/WeaverFramework.scala similarity index 100% rename from modules/framework/src/weaver/framework/WeaverFramework.scala rename to modules/framework/shared/src/main/scala/weaver/framework/WeaverFramework.scala diff --git a/modules/framework/src/weaver/framework/WeaverRunner.scala b/modules/framework/shared/src/main/scala/weaver/framework/WeaverRunner.scala similarity index 100% rename from modules/framework/src/weaver/framework/WeaverRunner.scala rename to modules/framework/shared/src/main/scala/weaver/framework/WeaverRunner.scala diff --git a/modules/scalacheck/src/weaver/scalacheck/CheckConfig.scala b/modules/scalacheck/shared/src/main/scala/weaver/scalacheck/CheckConfig.scala similarity index 100% rename from modules/scalacheck/src/weaver/scalacheck/CheckConfig.scala rename to modules/scalacheck/shared/src/main/scala/weaver/scalacheck/CheckConfig.scala diff --git a/modules/scalacheck/src/weaver/scalacheck/Checkers.scala b/modules/scalacheck/shared/src/main/scala/weaver/scalacheck/Checkers.scala similarity index 100% rename from modules/scalacheck/src/weaver/scalacheck/Checkers.scala rename to modules/scalacheck/shared/src/main/scala/weaver/scalacheck/Checkers.scala diff --git a/modules/scalacheck/test/src-ce3/weaver/scalacheck/CheckersConcurrencyTest.scala b/modules/scalacheck/shared/src/test/scala/weaver/scalacheck/CheckersConcurrencyTest.scala similarity index 100% rename from modules/scalacheck/test/src-ce3/weaver/scalacheck/CheckersConcurrencyTest.scala rename to modules/scalacheck/shared/src/test/scala/weaver/scalacheck/CheckersConcurrencyTest.scala diff --git a/modules/scalacheck/test/src/weaver/scalacheck/CheckersTest.scala b/modules/scalacheck/shared/src/test/scala/weaver/scalacheck/CheckersTest.scala similarity index 100% rename from modules/scalacheck/test/src/weaver/scalacheck/CheckersTest.scala rename to modules/scalacheck/shared/src/test/scala/weaver/scalacheck/CheckersTest.scala diff --git a/modules/scalacheck/test/src/weaver/scalacheck/PropertyDogFoodTest.scala b/modules/scalacheck/shared/src/test/scala/weaver/scalacheck/PropertyDogFoodTest.scala similarity index 100% rename from modules/scalacheck/test/src/weaver/scalacheck/PropertyDogFoodTest.scala rename to modules/scalacheck/shared/src/test/scala/weaver/scalacheck/PropertyDogFoodTest.scala diff --git a/project/WeaverPlugin.scala b/project/WeaverPlugin.scala deleted file mode 100644 index 91f06d08..00000000 --- a/project/WeaverPlugin.scala +++ /dev/null @@ -1,425 +0,0 @@ -import scalafix.sbt.ScalafixPlugin.autoImport._ -import xerial.sbt.Sonatype.SonatypeKeys._ - -import sbt._ -import sbt.Keys._ -import com.jsuereth.sbtpgp.PgpKeys._ -import sbtprojectmatrix.ProjectMatrixKeys.virtualAxes -import sbt.internal.ProjectMatrix - -import org.scalajs.sbtplugin.ScalaJSPlugin.autoImport.scalaJSLinkerConfig -import scala.scalanative.sbtplugin.ScalaNativePlugin -import org.scalajs.linker.interface.ModuleKind -import org.scalajs.sbtplugin.ScalaJSPlugin -import scala.collection.immutable.Nil -import java.util.regex.MatchResult -import lmcoursier.definitions.Reconciliation.SemVer -import sbt.VirtualAxis.ScalaVersionAxis -import _root_.scalafix.sbt.ScalafixPlugin -import org.scalafmt.sbt.ScalafmtPlugin - -/** - * Common project settings. - */ -object WeaverPlugin extends AutoPlugin { - - implicit final class ProjectMatrixOps(pmx: ProjectMatrix) { - type ConfigureX = ProjectMatrix => ProjectMatrix - type Configure = Project => Project - - val defaults = Seq[VirtualAxis]( - VirtualAxis.jvm, - VirtualAxis.scalaVersionAxis(WeaverPlugin.scala213, "2.13")) - - def addOne( - scalaVersion: String, - platform: VirtualAxis.PlatformAxis - ): ConfigureX = { - projectMatrix => - val addScalafix: Configure = - if (scalaVersion == scala213) - (_: Project).enablePlugins(ScalafixPlugin) - else (_: Project).disablePlugins(ScalafixPlugin) - - val addScalafmt: Configure = - if (scalaVersion == scala213) - (_: Project).enablePlugins(ScalafmtPlugin) - else (_: Project).disablePlugins(ScalafmtPlugin) - - val scalaJSSettings: Configure = - if (platform == VirtualAxis.js) configureScalaJSProject else identity - - val scalaNativeSettings: Configure = - if (platform == VirtualAxis.native) configureScalaNativeProject - else identity - - val configureProject = - addScalafix andThen addScalafmt andThen scalaJSSettings andThen scalaNativeSettings - - projectMatrix.defaultAxes(defaults: _*).customRow( - scalaVersions = List(scalaVersion), - axisValues = Seq(platform), - configureProject - ) - } - - def add( - scalaVersions: Iterable[String], - platform: VirtualAxis.PlatformAxis - ): ConfigureX = { - scalaVersions.map(addOne(_, platform)).reduce(_ andThen _) - } - def full = sparse(true, true, true) - - def sparse( - withJS: Boolean = false, - withNative: Boolean = false, - withScala3: Boolean = false - ): ProjectMatrix = { - val defaultScalaVersions = supportedScala2Versions - val defaultPlatform = List(VirtualAxis.jvm) - - val addJs = if (withJS) List(VirtualAxis.js) else Nil - val addNative = if (withNative) List(VirtualAxis.native) else Nil - val addScala3 = if (withScala3) List(scala3) else Nil - - val configurators = for { - scalaVersion <- defaultScalaVersions ++ addScala3 - platform <- defaultPlatform ++ addJs ++ addNative - } yield addOne(scalaVersion, platform) - - val configure: ConfigureX = configurators.reduce(_ andThen _) - - configure(pmx) - } - - } - - def configureScalaJSProject(proj: Project): Project = { - - val linkerConfig = Seq(Test / scalaJSLinkerConfig ~= { - _.withModuleKind(ModuleKind.CommonJSModule) - }) - - // on CI, use linker's batch mode: - // https://github.com/scala-js/scala-js/blob/6622d0b8f99bec4dbe1b29c125d111fdea246d34/linker-interface/shared/src/main/scala/org/scalajs/linker/interface/StandardConfig.scala#L51 - // When you run a lot of linkers in parallel - // they will retain intermediate state (in case you want incremental compilation) - // on CI we don't want that - val batchOnCi = - if (sys.env.contains("CI")) Seq(scalaJSLinkerConfig ~= { - _.withBatchMode(true) - }) - else Seq.empty - - proj.enablePlugins(ScalaJSPlugin) - .settings((linkerConfig ++ batchOnCi): _*) - .settings( - Test / fork := false - ) - } - - def configureScalaNativeProject(proj: Project): Project = { - proj.enablePlugins(ScalaNativePlugin) - .settings( - Test / fork := false - ) - } - - override def requires = plugins.JvmPlugin - override def trigger = allRequirements - - lazy val scala212 = "2.12.17" - lazy val scala213 = "2.13.10" - lazy val scala3 = "3.2.2" - lazy val supportedScalaVersions = List(scala212, scala213, scala3) - - lazy val supportedScala2Versions = List(scala212, scala213) - - /** @see [[sbt.AutoPlugin]] */ - override val projectSettings = Seq( - moduleName := s"weaver-${name.value}", - scalacOptions ++= compilerOptions(scalaVersion.value), - Test / scalacOptions ~= (_ filterNot (_ == "-Xfatal-warnings")), - // Turning off fatal warnings for ScalaDoc, otherwise we can't release. - Compile / doc / scalacOptions ~= (_ filterNot (_ == "-Xfatal-warnings")), - // ScalaDoc settings - autoAPIMappings := true, - ThisBuild / scalacOptions ++= { - if (!(ThisBuild / scalacOptions).value.contains("-sourcepath")) - Seq( - // Note, this is used by the doc-source-url feature to determine the - // relative path of a given source file. If it's not a prefix of a the - // absolute path of the source file, the absolute path of that file - // will be put into the FILE_SOURCE variable, which is - // definitely not what we want. - "-sourcepath", - file(".").getAbsolutePath.replaceAll("[.]$", "") - ) - else Seq.empty - }, - // https://github.com/sbt/sbt/issues/2654 - incOptions := incOptions.value.withLogRecompileOnMacro(false), - // https://scalacenter.github.io/scalafix/docs/users/installation.html - semanticdbEnabled := !scalaVersion.value.startsWith("3.0"), - semanticdbVersion := scalafixSemanticdb.revision, - libraryDependencies ++= { - if (scalaVersion.value.startsWith("3.")) Seq.empty - else Seq( - compilerPlugin("com.olegpy" %% "better-monadic-for" % "0.3.1"), - compilerPlugin( - "org.typelevel" %% "kind-projector" % "0.13.2" cross CrossVersion.full - ) - ) - }, - pushRemoteCacheTo := Some(MavenCache("local-cache", - file("/tmp/remote-cache"))) - ) ++ publishSettings - - def artifactName(nm: String, axes: Seq[VirtualAxis]) = { - nm + axes.sortBy[Int] { - case _: VirtualAxis.ScalaVersionAxis => 0 - case _: VirtualAxis.PlatformAxis => 1 - case _: VirtualAxis.StrongAxis => 2 - case _: VirtualAxis.WeakAxis => 3 - }.map(_.idSuffix).mkString("-", "-", "") - } - - lazy val remoteCacheSettings = Seq( - Compile / packageCache / moduleName := artifactName( - moduleName.value, - virtualAxes.value) - ) - - def compilerOptions(scalaVersion: String) = { - val allowed = - if (scalaVersion.startsWith("3.")) - commonCompilerOptions.filterNot(flg => - flg.contains("explaintypes") || flg.contains( - "-Xlint") || flg.contains( - "-Ywarn-") || flg.contains("-Xcheckinit")) - else commonCompilerOptions - - allowed ++ { - if (priorTo2_13(scalaVersion)) compilerOptions2_12_Only - else Seq.empty - } - } - - def priorTo2_13(scalaVersion: String): Boolean = - CrossVersion.partialVersion(scalaVersion) match { - case Some((2, minor)) if minor < 13 => true - case _ => false - } - - lazy val commonCompilerOptions = Seq( - "-deprecation", // Emit warning and location for usages of deprecated APIs. - "-encoding", - "utf-8", // Specify character encoding used by source files. - "-explaintypes", // Explain type errors in more detail. - "-feature", // Emit warning and location for usages of features that should be imported explicitly. - "-language:existentials", // Existential types (besides wildcard types) can be written and inferred - "-language:experimental.macros", // Allow macro definition (besides implementation and application) - "-language:higherKinds", // Allow higher-kinded types - "-language:implicitConversions", // Allow definition of implicit functions called views - "-unchecked", // Enable additional warnings where generated code depends on assumptions. - "-Xcheckinit", // Wrap field accessors to throw an exception on uninitialized access. - "-Xlint:adapted-args", // Warn if an argument list is modified to match the receiver. - "-Xlint:constant", // Evaluation of a constant arithmetic expression results in an error. - "-Xlint:delayedinit-select", // Selecting member of DelayedInit. - "-Xlint:doc-detached", // A Scaladoc comment appears to be detached from its element. - "-Xlint:inaccessible", // Warn about inaccessible types in method signatures. - "-Xlint:infer-any", // Warn when a type argument is inferred to be `Any`. - "-Xlint:missing-interpolator", // A string literal appears to be missing an interpolator id. - "-Xlint:nullary-unit", // Warn when nullary methods return Unit. - "-Xlint:option-implicit", // Option.apply used implicit view. - "-Xlint:package-object-classes", // Class or object defined in package object. - "-Xlint:poly-implicit-overload", // Parameterized overloaded implicit methods are not visible as view bounds. - "-Xlint:private-shadow", // A private field (or class parameter) shadows a superclass field. - "-Xlint:stars-align", // Pattern sequence wildcard must align with sequence component. - "-Xlint:type-parameter-shadow", // A local type parameter shadows a type already in scope. - "-Ywarn-dead-code", // Warn when dead code is identified. - "-Ywarn-extra-implicit", // Warn when more than one implicit parameter section is defined. - "-Ywarn-numeric-widen", // Warn when numerics are widened. - "-Ywarn-unused:implicits", // Warn if an implicit parameter is unused. - "-Ywarn-unused:imports", // Warn if an import selector is not referenced. - "-Ywarn-unused:locals", // Warn if a local definition is unused. - "-Ywarn-unused:patvars", // Warn if a variable bound in a pattern is unused. - "-Ywarn-unused:privates", // Warn if a private member is unused. - "-Ywarn-value-discard", // Warn when non-Unit expression results are unused. - "-Xfatal-warnings" // Fail the compilation if there are any warnings. - ) - - lazy val compilerOptions2_12_Only = - // These are unrecognized for Scala 2.13. - Seq( - "-Xfuture", // Turn on future language features. - "-Xlint:by-name-right-associative", // By-name parameter of right associative operator. - "-Xlint:nullary-override", // Warn when non-nullary `def f()' overrides nullary `def f'. - "-Xlint:unsound-match", // Pattern match may not be typesafe. - "-Yno-adapted-args", // Do not adapt an argument list (either by inserting () or creating a tuple) to match the receiver. - "-Ypartial-unification", // Enable partial unification in type constructor inference - "-Ywarn-inaccessible", // Warn about inaccessible types in method signatures. - "-Ywarn-infer-any", // Warn when a type argument is inferred to be `Any`. - "-Ywarn-nullary-override", // Warn when non-nullary `def f()' overrides nullary `def f'. - "-Ywarn-nullary-unit" // Warn when nullary methods return Unit. - ) - - lazy val doNotPublishArtifact = Seq( - publishArtifact := false, - Compile / packageDoc / publishArtifact := false, - Compile / packageSrc / publishArtifact := false, - Compile / packageBin / publishArtifact := false - ) - - // Mill-like simple layout - val simpleLayout: Seq[Setting[_]] = { - /* - Project matrix will override baseDirectory, making it look like this: - /Users/velvetbaldmime/Personal/weaver-test/.sbt/matrix/src - - Which means we can't use it to identify sources layout. - - Instead, we're going to use `scalaSource` and go 3 levels up from it: - - sbt:root> show catsJS/scalaSource - [info] .../modules/framework/cats/src/main/scala - */ - val moduleBase = - Def.setting((Compile / scalaSource).value.getParentFile().getParentFile().getParentFile()) - - def suffixes(axes: Seq[VirtualAxis]) = axes.collect { - case VirtualAxis.js => - List("", "-js", "-jvm-js", "-js-native") - case VirtualAxis.jvm => - List("", "-jvm", "-jvm-js", "-jvm-native") - case VirtualAxis.native => - List("", "-native", "-jvm-native", "-js-native") - case ScalaVersionAxis(ver, _) => - if (ver.startsWith("3.")) List("", "-scala-3") - else List("", "-scala-2") - }.toList - - def sequence[A](ll: List[List[A]]): List[List[A]] = - ll.foldRight(List(List.empty[A])) { - case (listA, listListA) => - listA.flatMap(a => listListA.map(a :: _)) - } - - def combos(axes: Seq[VirtualAxis]): List[String] = - sequence(suffixes(axes)).map(_.mkString("src", "", "")) - - Seq( - Compile / unmanagedSourceDirectories := - combos(virtualAxes.value).map(moduleBase.value / _), - Test / unmanagedSourceDirectories := - combos(virtualAxes.value).map(moduleBase.value / "test" / _), - Test / unmanagedResourceDirectories := Seq( - moduleBase.value / "test" / "resources" - ), - Test / fork := (virtualAxes.value.contains(VirtualAxis.jvm)) - ) ++ remoteCacheSettings - } - - lazy val publishSettings = Seq( - organization := "com.disneystreaming", - version := sys.env.get("GITHUB_REF") - .filter(_.startsWith("refs/tags/v")) - .map(_.drop("refs/tags/v".length)) - .getOrElse(version.value), - publishTo := sonatypePublishToBundle.value, - sonatypeCredentialHost := "s01.oss.sonatype.org", - publishMavenStyle := true, - licenses := Seq( - "Apache" -> url("http://www.apache.org/licenses/LICENSE-2.0")), - homepage := Some(url("https://github.com/disneystreaming")), - scmInfo := Some( - ScmInfo( - url("https://github.com/disneystreaming/weaver-test"), - "scm:git@github.com:disneystreaming/weaver-test.git" - ) - ), - developers := List( - Developer( - id = "Olivier Mélois", - name = "Olivier Mélois", - email = "olivier.melois@disneystreaming.com", - url = url("https://github.com/baccata") - ), - Developer( - id = "Anton Sviridov", - name = "Anton Sviridov", - email = "anton.sviridov@disneystreaming.com", - url = url("https://github.com/keynmol") - ) - ) - ) - - def createBuildCommands(projects: Seq[ProjectReference]) = { - case class Duplet(scala: String, platform: String) - - val scala3Suffix = VirtualAxis.scalaABIVersion(scala3).idSuffix - val scala213Suffix = VirtualAxis.scalaABIVersion(scala213).idSuffix - val scala212Suffix = VirtualAxis.scalaABIVersion(scala212).idSuffix - val jsSuffix = VirtualAxis.js.idSuffix - val nativeSuffix = VirtualAxis.native.idSuffix - - val all: List[(Duplet, Seq[String])] = - projects.collect { - case lp: LocalProject => - var projectId = lp.project - - val scalaAxis = - if (projectId.endsWith(scala3Suffix)) { - projectId = projectId.dropRight(scala3Suffix.length) - "3" - } else if (projectId.endsWith(scala212Suffix)) { - projectId = projectId.dropRight(scala212Suffix.length) - "2_12" - } else - "2_13" - - val platformAxis = - if (projectId.endsWith(jsSuffix)) { - projectId = projectId.dropRight(jsSuffix.length) - "js" - } else if (projectId.endsWith(nativeSuffix)) { - projectId = projectId.dropRight(nativeSuffix.length) - "native" - } else "jvm" - - Duplet(scalaAxis, platformAxis) -> lp.project - }.groupBy(_._1).mapValues(_.map(_._2)).toList - - // some commands, like test and compile, are setup for all modules - val any = (t: Duplet) => true - // things like scalafix and scalafmt are only enabled on jvm 2.13 projects - val jvm2_13 = (t: Duplet) => t.scala == "2_13" && t.platform == "jvm" - - val desiredCommands: Map[String, (String, Duplet => Boolean)] = Map( - "test" -> ("test", any), - "compile" -> ("compile", any), - "publishLocal" -> ("publishLocal", any), - "pushRemoteCache" -> ("pushRemoteCache", any), - "scalafix" -> ("scalafix --check", jvm2_13), - "scalafixTests" -> ("Test/scalafix --check", jvm2_13), - "scalafmt" -> ("scalafmtCheckAll", jvm2_13) - ) - - val cmds = all.flatMap { - case (duplet, projects) => - desiredCommands.filter(_._2._2(duplet)).map { case (name, (cmd, _)) => - Command.command( - s"${name}_${duplet.scala}_${duplet.platform}") { - state => - projects.foldLeft(state) { case (st, proj) => - s"$proj/$cmd" :: st - } - } - } - } - - cmds - } - -} diff --git a/project/plugins.sbt b/project/plugins.sbt index bbba99aa..1ec8c98e 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -5,12 +5,8 @@ addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.14.0" addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.16") -addSbtPlugin("com.eed3si9n" % "sbt-projectmatrix" % "0.9.1") - -addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12") +addSbtPlugin("org.typelevel" % "sbt-typelevel" % "0.6.5") addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.8") - -addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0") From ced78a9e28f41022550e42849b1bd5087e3e9d7e Mon Sep 17 00:00:00 2001 From: Andrew Valencik Date: Thu, 11 Jan 2024 22:03:37 -0500 Subject: [PATCH 02/38] Add JSPlatform, NativePlatform, framework project --- build.sbt | 44 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/build.sbt b/build.sbt index 2c9cbc29..84f095e2 100644 --- a/build.sbt +++ b/build.sbt @@ -37,9 +37,9 @@ val Version = new { val testInterface = "1.0" } -lazy val root = tlCrossRootProject.aggregate(core) +lazy val root = tlCrossRootProject.aggregate(core, framework) -lazy val core = crossProject(JVMPlatform) +lazy val core = crossProject(JVMPlatform, JSPlatform, NativePlatform) .in(file("modules/core")) .settings( name := "core", @@ -49,11 +49,49 @@ lazy val core = crossProject(JVMPlatform) "com.eed3si9n.expecty" %%% "expecty" % Version.expecty, // https://github.com/portable-scala/portable-scala-reflect/issues/23 "org.portable-scala" %%% "portable-scala-reflect" % Version.portableReflect cross CrossVersion.for3Use2_13, + ), + ) + +lazy val coreJVM = core.jvm + .settings( + libraryDependencies ++= Seq( "org.scala-js" %%% "scalajs-stubs" % Version.scalajsStubs % "provided" cross CrossVersion.for3Use2_13, "junit" % "junit" % Version.junit % Optional, if (scalaVersion.value.startsWith("3.")) "org.scala-lang" % "scala-reflect" % scala213 else "org.scala-lang" % "scala-reflect" % scalaVersion.value - ), + ) + ) + +lazy val framework = crossProject(JVMPlatform, JSPlatform, NativePlatform) + .in(file("modules/framework")) + .dependsOn(core) + .settings( + name := "framework", + libraryDependencies ++= Seq( + "junit" % "junit" % Version.junit + ) + ) + +lazy val frameworkJVM = framework.jvm + .settings( + libraryDependencies ++= Seq( + "org.scala-sbt" % "test-interface" % Version.testInterface, + "org.scala-js" %%% "scalajs-stubs" % Version.scalajsStubs % "provided" cross CrossVersion.for3Use2_13 + ) + ) + +lazy val frameworkJS = framework.js + .settings( + libraryDependencies ++= Seq( + "org.scala-js" %% "scalajs-test-interface" % scalaJSVersion cross CrossVersion.for3Use2_13 + ) + ) + +lazy val frameworkNative = framework.native + .settings( + libraryDependencies ++= Seq( + "org.scala-native" %%% "test-interface" % nativeVersion + ) ) From c0412172867e4d0da65b1fea8ebead0a3c3845af Mon Sep 17 00:00:00 2001 From: Andrew Valencik Date: Fri, 12 Jan 2024 08:23:53 -0500 Subject: [PATCH 03/38] Add remaining modules to build.sbt --- build.sbt | 43 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 84f095e2..4917e663 100644 --- a/build.sbt +++ b/build.sbt @@ -37,7 +37,7 @@ val Version = new { val testInterface = "1.0" } -lazy val root = tlCrossRootProject.aggregate(core, framework) +lazy val root = tlCrossRootProject.aggregate(core, framework, coreCats, cats, scalacheck, discipline) lazy val core = crossProject(JVMPlatform, JSPlatform, NativePlatform) .in(file("modules/core")) @@ -95,3 +95,44 @@ lazy val frameworkNative = framework.native "org.scala-native" %%% "test-interface" % nativeVersion ) ) + +lazy val coreCats = crossProject(JVMPlatform, JSPlatform, NativePlatform) + .in(file("modules/core-cats")) + .dependsOn(core) + .settings(name := "cats-core") + +lazy val coreCatsJS = coreCats.js + .settings( + libraryDependencies ++= Seq("org.scala-js" %%% "scala-js-macrotask-executor" % Version.scalajsMacroTask) + ) + + +lazy val cats = crossProject(JVMPlatform, JSPlatform, NativePlatform) + .in(file("modules/framework-cats")) + .dependsOn(framework, coreCats) + .settings( + name := "cats", + testFrameworks := Seq(new TestFramework("weaver.framework.CatsEffect")) + ) + +lazy val scalacheck = crossProject(JVMPlatform, JSPlatform, NativePlatform) + .in(file("modules/scalacheck")) + .dependsOn(core, cats % "test->compile") + .settings( + testFrameworks := Seq(new TestFramework("weaver.framework.CatsEffect")), + libraryDependencies ++= Seq( + "org.scalacheck" %%% "scalacheck" % Version.scalacheck, + "org.typelevel" %%% "cats-effect-testkit" % Version.catsEffect % Test) + ) + +lazy val discipline = crossProject(JVMPlatform, JSPlatform, NativePlatform) + .in(file("modules/discipline")) + .dependsOn(core, cats) + .settings( + name := "discipline", + testFrameworks := Seq(new TestFramework("weaver.framework.CatsEffect")), + libraryDependencies ++= Seq( + "org.typelevel" %%% "discipline-core" % Version.discipline, + "org.typelevel" %%% "cats-laws" % Version.catsLaws % Test + ) + ) From ddb73d3216ed72869b3c5687e178d17569d27b92 Mon Sep 17 00:00:00 2001 From: Andrew Valencik Date: Fri, 12 Jan 2024 08:24:11 -0500 Subject: [PATCH 04/38] Format build.sbt --- build.sbt | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/build.sbt b/build.sbt index 4917e663..4e82ff46 100644 --- a/build.sbt +++ b/build.sbt @@ -1,14 +1,14 @@ // https://typelevel.org/sbt-typelevel/faq.html#what-is-a-base-version-anyway ThisBuild / tlBaseVersion := "0.0" // your current series x.y -ThisBuild / organization := "weaver" +ThisBuild / organization := "weaver" ThisBuild / organizationName := "Typelevel" -ThisBuild / startYear := Some(2019) -ThisBuild / licenses := Seq(License.Apache2) +ThisBuild / startYear := Some(2019) +ThisBuild / licenses := Seq(License.Apache2) ThisBuild / developers := List( tlGitHubDev("baccata", "Olivier Mélois"), tlGitHubDev("keynmol", "Anton Sviridov"), - tlGitHubDev("valencik", "Andrew Valencik"), + tlGitHubDev("valencik", "Andrew Valencik") ) // publish to s01.oss.sonatype.org (set to true to publish to oss.sonatype.org instead) @@ -20,7 +20,7 @@ ThisBuild / githubWorkflowJavaVersions := Seq(JavaSpec.temurin("11")) val scala212 = "2.12.17" val scala213 = "2.13.10" ThisBuild / crossScalaVersions := Seq(scala212, scala213, "3.3.1") -ThisBuild / scalaVersion := scala213 // the default Scala +ThisBuild / scalaVersion := scala213 // the default Scala val Version = new { val catsEffect = "3.5.2" @@ -37,19 +37,24 @@ val Version = new { val testInterface = "1.0" } -lazy val root = tlCrossRootProject.aggregate(core, framework, coreCats, cats, scalacheck, discipline) +lazy val root = tlCrossRootProject.aggregate(core, + framework, + coreCats, + cats, + scalacheck, + discipline) lazy val core = crossProject(JVMPlatform, JSPlatform, NativePlatform) .in(file("modules/core")) .settings( name := "core", libraryDependencies ++= Seq( - "co.fs2" %%% "fs2-core" % Version.fs2, - "org.typelevel" %%% "cats-effect" % Version.catsEffect, - "com.eed3si9n.expecty" %%% "expecty" % Version.expecty, + "co.fs2" %%% "fs2-core" % Version.fs2, + "org.typelevel" %%% "cats-effect" % Version.catsEffect, + "com.eed3si9n.expecty" %%% "expecty" % Version.expecty, // https://github.com/portable-scala/portable-scala-reflect/issues/23 - "org.portable-scala" %%% "portable-scala-reflect" % Version.portableReflect cross CrossVersion.for3Use2_13, - ), + "org.portable-scala" %%% "portable-scala-reflect" % Version.portableReflect cross CrossVersion.for3Use2_13 + ) ) lazy val coreJVM = core.jvm @@ -103,10 +108,10 @@ lazy val coreCats = crossProject(JVMPlatform, JSPlatform, NativePlatform) lazy val coreCatsJS = coreCats.js .settings( - libraryDependencies ++= Seq("org.scala-js" %%% "scala-js-macrotask-executor" % Version.scalajsMacroTask) + libraryDependencies ++= Seq( + "org.scala-js" %%% "scala-js-macrotask-executor" % Version.scalajsMacroTask) ) - lazy val cats = crossProject(JVMPlatform, JSPlatform, NativePlatform) .in(file("modules/framework-cats")) .dependsOn(framework, coreCats) From 770a0767e59ace3588fd80f3785af6ee90d65401 Mon Sep 17 00:00:00 2001 From: zetashift Date: Sun, 14 Jan 2024 17:50:57 +0000 Subject: [PATCH 05/38] tests(catsJVM): fix paths in cats tests --- .../jvm/src/test/scala/junit/JUnitRunnerTests.scala | 4 ++-- .../framework-cats/shared/src/test/scala/DogFoodTests.scala | 2 +- .../shared/src/test/scala/SourceLocationTest.scala | 2 +- .../framework-cats/shared/src/test/scala/TracingTests.scala | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/framework-cats/jvm/src/test/scala/junit/JUnitRunnerTests.scala b/modules/framework-cats/jvm/src/test/scala/junit/JUnitRunnerTests.scala index 59b93113..bf8b6fb5 100644 --- a/modules/framework-cats/jvm/src/test/scala/junit/JUnitRunnerTests.scala +++ b/modules/framework-cats/jvm/src/test/scala/junit/JUnitRunnerTests.scala @@ -57,7 +57,7 @@ object JUnitRunnerTests extends IOSuite { test("Tests tagged with only fail when ran on CI") { blocker => run(blocker, Meta.OnlyFailsOnCi).map { notifications => def testFailure(name: String, lineNumber: Int) = { - val srcPath = "modules/framework/cats/test/src-jvm/junit/Meta.scala" + val srcPath = "modules/framework-cats/jvm/src/test/scala/junit/Meta.scala" val msgLine1 = s"- $name 0ms" val msgLine2 = s" 'Only' tag is not allowed when `isCI=true` ($srcPath:$lineNumber)" @@ -134,7 +134,7 @@ object JUnitRunnerTests extends IOSuite { blocker => run(blocker, Meta.OnlyFailsOnCiEvenIfIgnored).map { notifications => def testFailure(name: String, lineNumber: Int) = { - val srcPath = "modules/framework/cats/test/src-jvm/junit/Meta.scala" + val srcPath = "modules/framework-cats/jvm/src/test/scala/junit/Meta.scala" val msgLine1 = s"- $name 0ms" val msgLine2 = s" 'Only' tag is not allowed when `isCI=true` ($srcPath:$lineNumber)" diff --git a/modules/framework-cats/shared/src/test/scala/DogFoodTests.scala b/modules/framework-cats/shared/src/test/scala/DogFoodTests.scala index 46f07737..db404b2f 100644 --- a/modules/framework-cats/shared/src/test/scala/DogFoodTests.scala +++ b/modules/framework-cats/shared/src/test/scala/DogFoodTests.scala @@ -137,7 +137,7 @@ object DogFoodTests extends IOSuite { | of | multiline | (failure) - | assertion failed (modules/framework/cats/test/src/Meta.scala:$location) + | assertion failed (modules/framework-cats/shared/src/test/scala/Meta.scala:$location) | | $capturedExpression | diff --git a/modules/framework-cats/shared/src/test/scala/SourceLocationTest.scala b/modules/framework-cats/shared/src/test/scala/SourceLocationTest.scala index 96ac6a55..69269168 100644 --- a/modules/framework-cats/shared/src/test/scala/SourceLocationTest.scala +++ b/modules/framework-cats/shared/src/test/scala/SourceLocationTest.scala @@ -14,7 +14,7 @@ object SourceLocationTest extends SimpleIOSuite { expect(name.contains("SourceLocationTest.scala")) && expect(relPath.contains( - "modules/framework/cats/test/src/SourceLocationTest.scala")) && + "modules/framework-cats/shared/src/test/scala/SourceLocationTest.scala")) && expect(line == 8) } diff --git a/modules/framework-cats/shared/src/test/scala/TracingTests.scala b/modules/framework-cats/shared/src/test/scala/TracingTests.scala index 04c2e741..e3cd04c2 100644 --- a/modules/framework-cats/shared/src/test/scala/TracingTests.scala +++ b/modules/framework-cats/shared/src/test/scala/TracingTests.scala @@ -17,7 +17,7 @@ object TracingTests extends SimpleIOSuite { result } - val thisFile = "/modules/framework/cats/test/src/TracingTests.scala" + val thisFile = "/modules/framework-cats/shared/src/test/scala/TracingTests.scala" pureTest("Traces work as expected") { val result = isOdd(2) From 3354acd15c4946fe6558331abf1ab6e8e88230de Mon Sep 17 00:00:00 2001 From: Andrew Valencik Date: Mon, 4 Mar 2024 09:42:07 -0500 Subject: [PATCH 06/38] Don't check headers yet, update workflows --- .github/workflows/ci.yml | 318 +++++++++++++++++++++++++----------- .github/workflows/clean.yml | 59 +++++++ build.sbt | 2 + 3 files changed, 281 insertions(+), 98 deletions(-) create mode 100644 .github/workflows/clean.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0a60fb58..2376f376 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,147 +1,269 @@ -name: CI +# This file was automatically generated by sbt-github-actions using the +# githubWorkflowGenerate task. You should add and commit this file to +# your git repository. It goes without saying that you shouldn't edit +# this file by hand! Instead, if you wish to make changes, you should +# change your sbt build configuration to revise the workflow description +# to meet your needs, then regenerate this file. + +name: Continuous Integration on: pull_request: - branches: ["main", "series/*"] + branches: ['**', '!update/**', '!pr/**'] push: - branches: ["main", "series/*"] - tags: ["v*"] + branches: ['**', '!update/**', '!pr/**'] + tags: [v*] + +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + concurrency: - group: ci-${{ github.ref }} + group: ${{ github.workflow }} @ ${{ github.ref }} cancel-in-progress: true jobs: build: - name: Test ${{matrix.scalaVersion}} (${{matrix.scalaPlatform}}) + name: Build and Test strategy: - fail-fast: false matrix: os: [ubuntu-latest] - java: [8] - scalaVersion: ["2_12", "2_13", "3"] - scalaPlatform: ["jvm", "js", "native"] + scala: [2.12, 2.13, 3] + java: [temurin@11] + project: [rootJS, rootJVM, rootNative] runs-on: ${{ matrix.os }} - env: - BUILD_KEY: ${{matrix.scalaVersion}}_${{matrix.scalaPlatform}} + timeout-minutes: 60 steps: - - name: Checkout current branch - uses: actions/checkout@v2 - - - name: Cache - uses: coursier/cache-action@v6 + - name: Checkout current branch (full) + uses: actions/checkout@v4 with: - extraKey: ${{ env.BUILD_KEY }} + fetch-depth: 0 - - uses: actions/setup-java@v3 + - name: Setup Java (temurin@11) + id: setup-java-temurin-11 + if: matrix.java == 'temurin@11' + uses: actions/setup-java@v4 with: - distribution: 'temurin' - java-version: ${{ matrix.java }} - cache: 'sbt' + distribution: temurin + java-version: 11 + cache: sbt - - name: Run tests - run: | - sbt test_$BUILD_KEY \ - pushRemoteCache_$BUILD_KEY + - name: sbt update + if: matrix.java == 'temurin@11' && steps.setup-java-temurin-11.outputs.cache-hit == 'false' + run: sbt +update - - name: Run checks - if: matrix.scalaVersion == '2_13' && matrix.scalaPlatform == 'jvm' - run: | - sbt scalafix_$BUILD_KEY \ - scalafixTests_$BUILD_KEY \ - scalafmt_$BUILD_KEY \ - "docs/mdoc --in $PWD/README.md" - - - name: Upload compilation cache - uses: actions/upload-artifact@v2 - with: - name: compilation-${{env.BUILD_KEY}}.zip - path: /tmp/remote-cache - - # This is dummy stage to configure github checks in a way - # that is agnostic to the build matrix - build-success-checkpoint: - runs-on: ubuntu-latest - needs: build - steps: - - name: Build matrix completed - run: echo "Build result is a ${{ needs.build.result }}" + - name: Check that workflows are up to date + run: sbt githubWorkflowCheck - documentation: - name: Documentation - runs-on: ubuntu-latest - steps: - - name: Checkout current branch - uses: actions/checkout@v3 + - name: Check formatting + if: matrix.java == 'temurin@11' && matrix.os == 'ubuntu-latest' + run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' scalafmtCheckAll 'project /' scalafmtSbtCheck - - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: '8' - cache: 'sbt' + - name: scalaJSLink + if: matrix.project == 'rootJS' + run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' Test/scalaJSLinkerResult + + - name: nativeLink + if: matrix.project == 'rootNative' + run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' Test/nativeLink + + - name: Test + run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' test + + - name: Check binary compatibility + if: matrix.java == 'temurin@11' && matrix.os == 'ubuntu-latest' + run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' mimaReportBinaryIssues - - name: Run mdoc - run: sbt "docs/mdoc" + - name: Generate API documentation + if: matrix.java == 'temurin@11' && matrix.os == 'ubuntu-latest' + run: sbt 'project ${{ matrix.project }}' '++ ${{ matrix.scala }}' doc + + - name: Make target directories + if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') + run: mkdir -p modules/scalacheck/native/target modules/framework-cats/native/target modules/framework/jvm/target modules/core/native/target modules/framework/native/target modules/core/js/target modules/framework/js/target modules/core/jvm/target modules/core-cats/native/target modules/discipline/native/target modules/core-cats/js/target modules/framework-cats/js/target modules/framework-cats/jvm/target modules/discipline/js/target modules/scalacheck/jvm/target modules/discipline/jvm/target modules/core-cats/jvm/target modules/scalacheck/js/target project/target + + - name: Compress target directories + if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') + run: tar cf targets.tar modules/scalacheck/native/target modules/framework-cats/native/target modules/framework/jvm/target modules/core/native/target modules/framework/native/target modules/core/js/target modules/framework/js/target modules/core/jvm/target modules/core-cats/native/target modules/discipline/native/target modules/core-cats/js/target modules/framework-cats/js/target modules/framework-cats/jvm/target modules/discipline/js/target modules/scalacheck/jvm/target modules/discipline/jvm/target modules/core-cats/jvm/target modules/scalacheck/js/target project/target + + - name: Upload target directories + if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') + uses: actions/upload-artifact@v4 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-${{ matrix.scala }}-${{ matrix.project }} + path: targets.tar publish: - name: Publish - needs: [documentation, build] - if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || (github.ref == 'refs/heads/main')) - runs-on: ubuntu-latest + name: Publish Artifacts + needs: [build] + if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') + strategy: + matrix: + os: [ubuntu-latest] + java: [temurin@11] + runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/setup-java@v3 + - name: Setup Java (temurin@11) + id: setup-java-temurin-11 + if: matrix.java == 'temurin@11' + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 11 + cache: sbt + + - name: sbt update + if: matrix.java == 'temurin@11' && steps.setup-java-temurin-11.outputs.cache-hit == 'false' + run: sbt +update + + - name: Download target directories (2.12, rootJS) + uses: actions/download-artifact@v4 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-2.12-rootJS + + - name: Inflate target directories (2.12, rootJS) + run: | + tar xf targets.tar + rm targets.tar + + - name: Download target directories (2.12, rootJVM) + uses: actions/download-artifact@v4 with: - distribution: 'temurin' - java-version: '8' - cache: 'sbt' + name: target-${{ matrix.os }}-${{ matrix.java }}-2.12-rootJVM - - name: Download compilation cache - uses: actions/download-artifact@v2 + - name: Inflate target directories (2.12, rootJVM) + run: | + tar xf targets.tar + rm targets.tar + + - name: Download target directories (2.12, rootNative) + uses: actions/download-artifact@v4 with: - path: /tmp/remote-cache + name: target-${{ matrix.os }}-${{ matrix.java }}-2.12-rootNative - - name: Unpack compilation cache - run: cd /tmp/remote-cache && (ls | xargs -I {} sh -c 'cp -r {}/* .') + - name: Inflate target directories (2.12, rootNative) + run: | + tar xf targets.tar + rm targets.tar - - name: Publish ${{ github.ref }} + - name: Download target directories (2.13, rootJS) + uses: actions/download-artifact@v4 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-2.13-rootJS + + - name: Inflate target directories (2.13, rootJS) run: | - sbt 'pullRemoteCache; ci-release' + tar xf targets.tar + rm targets.tar + + - name: Download target directories (2.13, rootJVM) + uses: actions/download-artifact@v4 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-2.13-rootJVM + + - name: Inflate target directories (2.13, rootJVM) + run: | + tar xf targets.tar + rm targets.tar + + - name: Download target directories (2.13, rootNative) + uses: actions/download-artifact@v4 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-2.13-rootNative + + - name: Inflate target directories (2.13, rootNative) + run: | + tar xf targets.tar + rm targets.tar + + - name: Download target directories (3, rootJS) + uses: actions/download-artifact@v4 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-3-rootJS + + - name: Inflate target directories (3, rootJS) + run: | + tar xf targets.tar + rm targets.tar + + - name: Download target directories (3, rootJVM) + uses: actions/download-artifact@v4 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-3-rootJVM + + - name: Inflate target directories (3, rootJVM) + run: | + tar xf targets.tar + rm targets.tar + + - name: Download target directories (3, rootNative) + uses: actions/download-artifact@v4 + with: + name: target-${{ matrix.os }}-${{ matrix.java }}-3-rootNative + + - name: Inflate target directories (3, rootNative) + run: | + tar xf targets.tar + rm targets.tar + + - name: Import signing key + if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE == '' env: + PGP_SECRET: ${{ secrets.PGP_SECRET }} PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} + run: echo $PGP_SECRET | base64 -d -i - | gpg --import + + - name: Import signing key and strip passphrase + if: env.PGP_SECRET != '' && env.PGP_PASSPHRASE != '' + env: PGP_SECRET: ${{ secrets.PGP_SECRET }} - SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} + run: | + echo "$PGP_SECRET" | base64 -d -i - > /tmp/signing-key.gpg + echo "$PGP_PASSPHRASE" | gpg --pinentry-mode loopback --passphrase-fd 0 --import /tmp/signing-key.gpg + (echo "$PGP_PASSPHRASE"; echo; echo) | gpg --command-fd 0 --pinentry-mode loopback --change-passphrase $(gpg --list-secret-keys --with-colons 2> /dev/null | grep '^sec:' | cut --delimiter ':' --fields 5 | tail -n 1) + + - name: Publish + env: SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_CREDENTIAL_HOST: ${{ secrets.SONATYPE_CREDENTIAL_HOST }} + run: sbt tlCiRelease - site: - name: Publish Site - needs: [publish] - if: startsWith(github.ref, 'refs/tags/v') - runs-on: ubuntu-latest + dependency-submission: + name: Submit Dependencies + if: github.event_name != 'pull_request' + strategy: + matrix: + os: [ubuntu-latest] + java: [temurin@11] + runs-on: ${{ matrix.os }} steps: - name: Checkout current branch (full) - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - lfs: true - - uses: laughedelic/coursier-setup@v1 + - name: Setup Java (temurin@11) + id: setup-java-temurin-11 + if: matrix.java == 'temurin@11' + uses: actions/setup-java@v4 with: - jvm: adopt:8 - apps: ammonite sbt + distribution: temurin + java-version: 11 + cache: sbt - - name: Cache - uses: coursier/cache-action@v3 + - name: sbt update + if: matrix.java == 'temurin@11' && steps.setup-java-temurin-11.outputs.cache-hit == 'false' + run: sbt +update - - name: Release site - run: | - mkdir -p $HOME/.ssh - ssh-keyscan -t rsa github.com >> $HOME/.ssh/known_hosts - sbt docs/docusaurusCreateSite - amm scripts/releaseSite.sc - env: - GITHUB_DEPLOY_KEY: ${{ secrets.GIT_DEPLOY_KEY }} + - name: Submit Dependencies + uses: scalacenter/sbt-dependency-submission@v2 + with: + modules-ignore: rootjs_2.12 rootjs_2.13 rootjs_3 rootjvm_2.12 rootjvm_2.13 rootjvm_3 rootnative_2.12 rootnative_2.13 rootnative_3 + configs-ignore: test scala-tool scala-doc-tool test-internal diff --git a/.github/workflows/clean.yml b/.github/workflows/clean.yml new file mode 100644 index 00000000..547aaa43 --- /dev/null +++ b/.github/workflows/clean.yml @@ -0,0 +1,59 @@ +# This file was automatically generated by sbt-github-actions using the +# githubWorkflowGenerate task. You should add and commit this file to +# your git repository. It goes without saying that you shouldn't edit +# this file by hand! Instead, if you wish to make changes, you should +# change your sbt build configuration to revise the workflow description +# to meet your needs, then regenerate this file. + +name: Clean + +on: push + +jobs: + delete-artifacts: + name: Delete Artifacts + runs-on: ubuntu-latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Delete artifacts + run: | + # Customize those three lines with your repository and credentials: + REPO=${GITHUB_API_URL}/repos/${{ github.repository }} + + # A shortcut to call GitHub API. + ghapi() { curl --silent --location --user _:$GITHUB_TOKEN "$@"; } + + # A temporary file which receives HTTP response headers. + TMPFILE=/tmp/tmp.$$ + + # An associative array, key: artifact name, value: number of artifacts of that name. + declare -A ARTCOUNT + + # Process all artifacts on this repository, loop on returned "pages". + URL=$REPO/actions/artifacts + while [[ -n "$URL" ]]; do + + # Get current page, get response headers in a temporary file. + JSON=$(ghapi --dump-header $TMPFILE "$URL") + + # Get URL of next page. Will be empty if we are at the last page. + URL=$(grep '^Link:' "$TMPFILE" | tr ',' '\n' | grep 'rel="next"' | head -1 | sed -e 's/.*.*//') + rm -f $TMPFILE + + # Number of artifacts on this page: + COUNT=$(( $(jq <<<$JSON -r '.artifacts | length') )) + + # Loop on all artifacts on this page. + for ((i=0; $i < $COUNT; i++)); do + + # Get name of artifact and count instances of this name. + name=$(jq <<<$JSON -r ".artifacts[$i].name?") + ARTCOUNT[$name]=$(( $(( ${ARTCOUNT[$name]} )) + 1)) + + id=$(jq <<<$JSON -r ".artifacts[$i].id?") + size=$(( $(jq <<<$JSON -r ".artifacts[$i].size_in_bytes?") )) + printf "Deleting '%s' #%d, %'d bytes\n" $name ${ARTCOUNT[$name]} $size + ghapi -X DELETE $REPO/actions/artifacts/$id + done + done diff --git a/build.sbt b/build.sbt index 4e82ff46..23524a28 100644 --- a/build.sbt +++ b/build.sbt @@ -11,6 +11,8 @@ ThisBuild / developers := List( tlGitHubDev("valencik", "Andrew Valencik") ) +ThisBuild / tlCiHeaderCheck := false + // publish to s01.oss.sonatype.org (set to true to publish to oss.sonatype.org instead) ThisBuild / tlSonatypeUseLegacyHost := false From 7d431a588321983c449f35cd936faa865f1c210b Mon Sep 17 00:00:00 2001 From: Andrew Valencik Date: Mon, 4 Mar 2024 09:43:10 -0500 Subject: [PATCH 07/38] Fix formatting --- .../jvm/src/test/scala/junit/JUnitRunnerTests.scala | 6 ++++-- .../framework-cats/shared/src/test/scala/TracingTests.scala | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/framework-cats/jvm/src/test/scala/junit/JUnitRunnerTests.scala b/modules/framework-cats/jvm/src/test/scala/junit/JUnitRunnerTests.scala index bf8b6fb5..db9a48c7 100644 --- a/modules/framework-cats/jvm/src/test/scala/junit/JUnitRunnerTests.scala +++ b/modules/framework-cats/jvm/src/test/scala/junit/JUnitRunnerTests.scala @@ -57,7 +57,8 @@ object JUnitRunnerTests extends IOSuite { test("Tests tagged with only fail when ran on CI") { blocker => run(blocker, Meta.OnlyFailsOnCi).map { notifications => def testFailure(name: String, lineNumber: Int) = { - val srcPath = "modules/framework-cats/jvm/src/test/scala/junit/Meta.scala" + val srcPath = + "modules/framework-cats/jvm/src/test/scala/junit/Meta.scala" val msgLine1 = s"- $name 0ms" val msgLine2 = s" 'Only' tag is not allowed when `isCI=true` ($srcPath:$lineNumber)" @@ -134,7 +135,8 @@ object JUnitRunnerTests extends IOSuite { blocker => run(blocker, Meta.OnlyFailsOnCiEvenIfIgnored).map { notifications => def testFailure(name: String, lineNumber: Int) = { - val srcPath = "modules/framework-cats/jvm/src/test/scala/junit/Meta.scala" + val srcPath = + "modules/framework-cats/jvm/src/test/scala/junit/Meta.scala" val msgLine1 = s"- $name 0ms" val msgLine2 = s" 'Only' tag is not allowed when `isCI=true` ($srcPath:$lineNumber)" diff --git a/modules/framework-cats/shared/src/test/scala/TracingTests.scala b/modules/framework-cats/shared/src/test/scala/TracingTests.scala index e3cd04c2..b5acb9b8 100644 --- a/modules/framework-cats/shared/src/test/scala/TracingTests.scala +++ b/modules/framework-cats/shared/src/test/scala/TracingTests.scala @@ -17,7 +17,8 @@ object TracingTests extends SimpleIOSuite { result } - val thisFile = "/modules/framework-cats/shared/src/test/scala/TracingTests.scala" + val thisFile = + "/modules/framework-cats/shared/src/test/scala/TracingTests.scala" pureTest("Traces work as expected") { val result = isOdd(2) From ed2f6a9a295ad6ccc475db88f46eb9e35a221bb5 Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Fri, 8 Mar 2024 15:49:52 +0000 Subject: [PATCH 08/38] Set scala-3 dialect to Scala 3. --- .scalafmt.conf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.scalafmt.conf b/.scalafmt.conf index 60771025..a164bdaa 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -31,3 +31,9 @@ project.git = true project.excludeFilters = [ ".*-scala-3.*" ] + +fileOverride { + "glob:**/scala-3/**" { + runner.dialect = scala3 + } +} \ No newline at end of file From 1d8fb1b27927b546479015b2706d1e7986d2cdba Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Fri, 8 Mar 2024 16:03:45 +0000 Subject: [PATCH 09/38] Remove unused imports. --- modules/core/shared/src/main/scala-3/weaver/Expect.scala | 3 --- 1 file changed, 3 deletions(-) diff --git a/modules/core/shared/src/main/scala-3/weaver/Expect.scala b/modules/core/shared/src/main/scala-3/weaver/Expect.scala index 6aa396a0..dfc9f4bb 100644 --- a/modules/core/shared/src/main/scala-3/weaver/Expect.scala +++ b/modules/core/shared/src/main/scala-3/weaver/Expect.scala @@ -1,8 +1,5 @@ package weaver -import cats.data.{ NonEmptyList, ValidatedNel } -import cats.syntax.all._ - import com.eed3si9n.expecty._ import internals._ From 6cd0eb1c163d5cc6fb0912a91e8d4c688d391b3c Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Fri, 8 Mar 2024 16:03:58 +0000 Subject: [PATCH 10/38] Remove unused dummy parameter. --- .../core/jvm/src/main/scala/weaver/junit/WeaverRunner.scala | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/core/jvm/src/main/scala/weaver/junit/WeaverRunner.scala b/modules/core/jvm/src/main/scala/weaver/junit/WeaverRunner.scala index f77fcbd9..9b82a6a2 100644 --- a/modules/core/jvm/src/main/scala/weaver/junit/WeaverRunner.scala +++ b/modules/core/jvm/src/main/scala/weaver/junit/WeaverRunner.scala @@ -7,13 +7,11 @@ import weaver.internals.Reflection import org.junit.runner.Description import org.junit.runner.notification.RunNotifier -class WeaverRunner(cls: Class[_], dummy: Boolean) +class WeaverRunner(cls: Class[_]) extends org.junit.runner.Runner { type F[A] = Any - def this(cls: Class[_]) = this(cls, true) - lazy val suite: RunnableSuite[F] = { Reflection.loadRunnableSuite(cls.getName(), getClass().getClassLoader()) } From f6eccd9f26c4524880c1b72cbc77bb3112a73c01 Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Fri, 8 Mar 2024 16:51:57 +0000 Subject: [PATCH 11/38] Remove unused code. --- .../shared/src/main/scala/weaver/framework/DogFood.scala | 6 +++--- .../src/main/scala/weaver/framework/Fingerprints.scala | 1 - .../src/main/scala/weaver/framework/WeaverFramework.scala | 2 -- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/modules/framework/shared/src/main/scala/weaver/framework/DogFood.scala b/modules/framework/shared/src/main/scala/weaver/framework/DogFood.scala index 67ae7d41..6b0ebbca 100644 --- a/modules/framework/shared/src/main/scala/weaver/framework/DogFood.scala +++ b/modules/framework/shared/src/main/scala/weaver/framework/DogFood.scala @@ -38,7 +38,7 @@ abstract class DogFood[F[_]]( for { eventHandler <- effect.delay(new MemoryEventHandler()) logger <- effect.delay(new MemoryLogger()) - _ <- getTasks(suites, logger).use { case (runner, tasks) => + _ <- getTasks(suites).use { case (runner, tasks) => runTasks(runner, eventHandler, logger, maxParallelism)(tasks.toList) } _ <- patience.fold(effect.unit)(framework.unsafeRun.sleep) @@ -71,8 +71,8 @@ abstract class DogFood[F[_]]( } private def getTasks( - suites: Seq[Fingerprinted], - logger: Logger): Resource[F, (WeaverRunner[F], Array[sbt.testing.Task])] = { + suites: Seq[Fingerprinted] + ): Resource[F, (WeaverRunner[F], Array[sbt.testing.Task])] = { val acquire = Sync[F].delay { val cl = PlatformCompat.getClassLoader(this.getClass()) framework.weaverRunner(Array(), Array(), cl, None) diff --git a/modules/framework/shared/src/main/scala/weaver/framework/Fingerprints.scala b/modules/framework/shared/src/main/scala/weaver/framework/Fingerprints.scala index 29bdf3fd..715dd65b 100644 --- a/modules/framework/shared/src/main/scala/weaver/framework/Fingerprints.scala +++ b/modules/framework/shared/src/main/scala/weaver/framework/Fingerprints.scala @@ -6,7 +6,6 @@ import scala.reflect.ClassTag import cats.effect.Sync import weaver.internals.Reflection._ -import weaver.{ EffectSuite, GlobalResourceF } import sbt.testing.{ Fingerprint, SubclassFingerprint, TaskDef } diff --git a/modules/framework/shared/src/main/scala/weaver/framework/WeaverFramework.scala b/modules/framework/shared/src/main/scala/weaver/framework/WeaverFramework.scala index 6335ab23..8a940668 100644 --- a/modules/framework/shared/src/main/scala/weaver/framework/WeaverFramework.scala +++ b/modules/framework/shared/src/main/scala/weaver/framework/WeaverFramework.scala @@ -3,8 +3,6 @@ package framework import java.io.PrintStream -import weaver.{ Platform, discard } - import sbt.testing.{ Framework => BaseFramework, Runner => BaseRunner, _ } class WeaverFramework[F[_]]( From 2b4f6aa46d85912b75a2f3284b0a64578f9c83a6 Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Fri, 8 Mar 2024 16:52:04 +0000 Subject: [PATCH 12/38] Refactor code to remove unreachable case warning. --- modules/framework/jvm/src/main/scala/RunnerCompat.scala | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/framework/jvm/src/main/scala/RunnerCompat.scala b/modules/framework/jvm/src/main/scala/RunnerCompat.scala index 8494d466..c84b8753 100644 --- a/modules/framework/jvm/src/main/scala/RunnerCompat.scala +++ b/modules/framework/jvm/src/main/scala/RunnerCompat.scala @@ -57,9 +57,9 @@ trait RunnerCompat[F[_]] { self: sbt.testing.Runner => val stillRunning = new AtomicInteger(0) val waitForResourcesShutdown = new java.util.concurrent.Semaphore(0) - val tasksAndSuites = taskDefs.toList.map { taskDef => - taskDef -> suiteLoader(taskDef) - }.collect { case (taskDef, Some(suite)) => (taskDef, suite) } + val tasksAndSuites = (taskDefs.toList.mapFilter { taskDef => + suiteLoader(taskDef).map(loader => (taskDef, loader)) + }) def makeTasks( taskDef: TaskDef, From 1a0ff999fd352dc11bda93bae84dd5cd0e98496d Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Fri, 8 Mar 2024 16:59:17 +0000 Subject: [PATCH 13/38] Remove unused imports for Scala 3 Test JVM. --- modules/framework-cats/shared/src/test/scala/Meta.scala | 2 +- .../test/scala/weaver/scalacheck/CheckersConcurrencyTest.scala | 3 --- .../shared/src/test/scala/weaver/scalacheck/CheckersTest.scala | 1 - .../src/test/scala/weaver/scalacheck/PropertyDogFoodTest.scala | 1 - 4 files changed, 1 insertion(+), 6 deletions(-) diff --git a/modules/framework-cats/shared/src/test/scala/Meta.scala b/modules/framework-cats/shared/src/test/scala/Meta.scala index e6079933..bbe095df 100644 --- a/modules/framework-cats/shared/src/test/scala/Meta.scala +++ b/modules/framework-cats/shared/src/test/scala/Meta.scala @@ -102,7 +102,7 @@ object Meta { override implicit protected def effectCompat: UnsafeRun[IO] = SetTimeUnsafeRun - loggedTest("erroring with causes") { log => + loggedTest("erroring with causes") { _ => throw CustomException( "surfaced error", CustomException("first cause", diff --git a/modules/scalacheck/shared/src/test/scala/weaver/scalacheck/CheckersConcurrencyTest.scala b/modules/scalacheck/shared/src/test/scala/weaver/scalacheck/CheckersConcurrencyTest.scala index 663c5144..733ce19c 100644 --- a/modules/scalacheck/shared/src/test/scala/weaver/scalacheck/CheckersConcurrencyTest.scala +++ b/modules/scalacheck/shared/src/test/scala/weaver/scalacheck/CheckersConcurrencyTest.scala @@ -9,9 +9,6 @@ import scala.concurrent.duration._ import cats.effect.Outcome._ import cats.effect.testkit.TestControl import cats.effect.{ IO, Ref } -import cats.syntax.all._ - -import weaver.TestStatus import org.scalacheck.Gen diff --git a/modules/scalacheck/shared/src/test/scala/weaver/scalacheck/CheckersTest.scala b/modules/scalacheck/shared/src/test/scala/weaver/scalacheck/CheckersTest.scala index ba6c5f2b..e7d9cb62 100644 --- a/modules/scalacheck/shared/src/test/scala/weaver/scalacheck/CheckersTest.scala +++ b/modules/scalacheck/shared/src/test/scala/weaver/scalacheck/CheckersTest.scala @@ -4,7 +4,6 @@ package scalacheck import scala.concurrent.duration._ import cats.effect.IO -import cats.syntax.all._ import org.scalacheck.Gen diff --git a/modules/scalacheck/shared/src/test/scala/weaver/scalacheck/PropertyDogFoodTest.scala b/modules/scalacheck/shared/src/test/scala/weaver/scalacheck/PropertyDogFoodTest.scala index 4715d18d..cf0e5b95 100644 --- a/modules/scalacheck/shared/src/test/scala/weaver/scalacheck/PropertyDogFoodTest.scala +++ b/modules/scalacheck/shared/src/test/scala/weaver/scalacheck/PropertyDogFoodTest.scala @@ -4,7 +4,6 @@ package scalacheck import scala.concurrent.duration._ import cats.effect.{ IO, Resource } -import cats.syntax.all._ import weaver.framework._ From a9f246013ca96c3a82ab4555bea887d2bec44e6d Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Fri, 8 Mar 2024 17:00:26 +0000 Subject: [PATCH 14/38] Remove unused integer from LazyAccessSequential. --- modules/framework-cats/jvm/src/test/scala/MetaJVM.scala | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/framework-cats/jvm/src/test/scala/MetaJVM.scala b/modules/framework-cats/jvm/src/test/scala/MetaJVM.scala index d21d8dcc..e49e0d2d 100644 --- a/modules/framework-cats/jvm/src/test/scala/MetaJVM.scala +++ b/modules/framework-cats/jvm/src/test/scala/MetaJVM.scala @@ -132,7 +132,7 @@ object MetaJVM { } } - abstract class LazyAccessSequential(global: GlobalRead, index: Int) + abstract class LazyAccessSequential(global: GlobalRead) extends IOSuite { type Res = LazyState def sharedResource: Resource[IO, Res] = { @@ -157,10 +157,10 @@ object MetaJVM { // Using sleeps to force sequential runs of suites class LazyAccessSequential0(global: GlobalRead) - extends LazyAccessSequential(global, 0) + extends LazyAccessSequential(global) class LazyAccessSequential1(global: GlobalRead) - extends LazyAccessSequential(global, 1) + extends LazyAccessSequential(global) class LazyAccessSequential2(global: GlobalRead) - extends LazyAccessSequential(global, 2) + extends LazyAccessSequential(global) } From 62c64c5caf9b8c073247e0abfea76e109620f7d3 Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Fri, 8 Mar 2024 17:00:43 +0000 Subject: [PATCH 15/38] Use msg instead of cat for Scala 2/3 warnings. --- modules/framework-cats/shared/src/test/scala/Meta.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/framework-cats/shared/src/test/scala/Meta.scala b/modules/framework-cats/shared/src/test/scala/Meta.scala index bbe095df..7ab883bd 100644 --- a/modules/framework-cats/shared/src/test/scala/Meta.scala +++ b/modules/framework-cats/shared/src/test/scala/Meta.scala @@ -14,7 +14,7 @@ object Meta { object Boom extends Error("Boom") with scala.util.control.NoStackTrace - @nowarn("cat=w-flag-dead-code") + @nowarn("msg=dead code following this construct") object CrashingSuite extends SimpleIOSuite { throw Boom } From e921362d435498432361e0bdc00bdd72fc725e0f Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Fri, 8 Mar 2024 17:06:11 +0000 Subject: [PATCH 16/38] Use recoverWith with partial function. --- modules/framework/jvm/src/main/scala/RunnerCompat.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/framework/jvm/src/main/scala/RunnerCompat.scala b/modules/framework/jvm/src/main/scala/RunnerCompat.scala index c84b8753..f13f4bcc 100644 --- a/modules/framework/jvm/src/main/scala/RunnerCompat.scala +++ b/modules/framework/jvm/src/main/scala/RunnerCompat.scala @@ -240,7 +240,7 @@ trait RunnerCompat[F[_]] { self: sbt.testing.Runner => .productR(broker.send(TestFinished(outcome))), finalizer) } - )).handleErrorWith { case scala.util.control.NonFatal(_) => + )).recoverWith { case scala.util.control.NonFatal(_) => effect.unit // avoid non-fatal errors propagating up } } From b1cd2ec841fede720386632739a5ae7b87374789 Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Fri, 8 Mar 2024 17:11:22 +0000 Subject: [PATCH 17/38] Use runner. --- modules/framework/jvm/src/main/scala/DogFoodCompat.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/framework/jvm/src/main/scala/DogFoodCompat.scala b/modules/framework/jvm/src/main/scala/DogFoodCompat.scala index 81f3b81b..c86aaec5 100644 --- a/modules/framework/jvm/src/main/scala/DogFoodCompat.scala +++ b/modules/framework/jvm/src/main/scala/DogFoodCompat.scala @@ -17,7 +17,7 @@ private[weaver] trait DogFoodCompat[F[_]] { self: DogFood[F] => eventHandler: EventHandler, logger: Logger, maxParallelism: Int)(tasks: List[sbt.testing.Task]): F[Unit] = { - + val _ = runner effect.void { @scala.annotation.nowarn("msg=implicit numeric widening") val r = tasks.toVector.parTraverseN[F, Unit](maxParallelism) { task => From 8b8c04534a07a35e3513dff85ae60d94120d0e8c Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Fri, 8 Mar 2024 17:12:31 +0000 Subject: [PATCH 18/38] Add a None case for comprehensive matching. --- .../shared/src/main/scala/weaver/framework/Fingerprints.scala | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/framework/shared/src/main/scala/weaver/framework/Fingerprints.scala b/modules/framework/shared/src/main/scala/weaver/framework/Fingerprints.scala index 715dd65b..535adf8b 100644 --- a/modules/framework/shared/src/main/scala/weaver/framework/Fingerprints.scala +++ b/modules/framework/shared/src/main/scala/weaver/framework/Fingerprints.scala @@ -58,6 +58,7 @@ abstract class WeaverFingerprints[F[_]](implicit F: Sync[F]) { loadModule(taskDef.fullyQualifiedName(), classLoader) val init = cast(module)(GlobalResourcesInitClass) Some(GlobalResourcesRef(init)) + case _ => None } } From b24746d4a493c00a1824cdf55b14660e17711a52 Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Fri, 8 Mar 2024 17:13:29 +0000 Subject: [PATCH 19/38] Remove unused implicit numeric widening annotation. --- modules/framework/jvm/src/main/scala/DogFoodCompat.scala | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/framework/jvm/src/main/scala/DogFoodCompat.scala b/modules/framework/jvm/src/main/scala/DogFoodCompat.scala index c86aaec5..eb864379 100644 --- a/modules/framework/jvm/src/main/scala/DogFoodCompat.scala +++ b/modules/framework/jvm/src/main/scala/DogFoodCompat.scala @@ -19,7 +19,6 @@ private[weaver] trait DogFoodCompat[F[_]] { self: DogFood[F] => maxParallelism: Int)(tasks: List[sbt.testing.Task]): F[Unit] = { val _ = runner effect.void { - @scala.annotation.nowarn("msg=implicit numeric widening") val r = tasks.toVector.parTraverseN[F, Unit](maxParallelism) { task => blocker.block(discard[Array[Task]](task.execute(eventHandler, Array(logger)))) From d8ceb05f0689445221c7e9d7cc540897422e729a Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Fri, 8 Mar 2024 17:20:57 +0000 Subject: [PATCH 20/38] Remove unused private var. --- modules/framework/js-native/src/main/scala/RunnerCompat.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/framework/js-native/src/main/scala/RunnerCompat.scala b/modules/framework/js-native/src/main/scala/RunnerCompat.scala index a37921d6..5029b521 100644 --- a/modules/framework/js-native/src/main/scala/RunnerCompat.scala +++ b/modules/framework/js-native/src/main/scala/RunnerCompat.scala @@ -177,7 +177,7 @@ trait RunnerCompat[F[_]] { self: sbt.testing.Runner => } private[weaver] object ReadWriter { - class Reader(bytes: ByteBuffer, private var pt: Int) { + class Reader(bytes: ByteBuffer) { def readString() = { val stringSize = bytes.getInt() val ar = new Array[Byte](stringSize) @@ -201,7 +201,7 @@ private[weaver] object ReadWriter { def reader[A](s: String)(f: Reader => A) = { val buf = ByteBuffer.wrap(s.getBytes) - f(new Reader(buf, 0)) + f(new Reader(buf)) } def writer(f: Writer => Unit): String = { From 936d593456e1855eb44c2c974d7d3ec7a334a628 Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Fri, 8 Mar 2024 17:21:14 +0000 Subject: [PATCH 21/38] Mark cls as unused (broken for 2.12). --- modules/core/js/src/main/scala/org/junit/runner/RunWith.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/core/js/src/main/scala/org/junit/runner/RunWith.scala b/modules/core/js/src/main/scala/org/junit/runner/RunWith.scala index 98c3708b..d1d79b65 100644 --- a/modules/core/js/src/main/scala/org/junit/runner/RunWith.scala +++ b/modules/core/js/src/main/scala/org/junit/runner/RunWith.scala @@ -3,4 +3,4 @@ package org.junit.runner /** * Stub used for cross-compilation */ -class RunWith[T](cls: Class[T]) extends scala.annotation.StaticAnnotation +class RunWith[T](@scala.annotation.unused cls: Class[T]) extends scala.annotation.StaticAnnotation From 0c24b5d29df1515d638e0c974415a4599f85e1bd Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Fri, 8 Mar 2024 17:22:52 +0000 Subject: [PATCH 22/38] Reformat. --- modules/core/js/src/main/scala/org/junit/runner/RunWith.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/core/js/src/main/scala/org/junit/runner/RunWith.scala b/modules/core/js/src/main/scala/org/junit/runner/RunWith.scala index d1d79b65..b6ffcfec 100644 --- a/modules/core/js/src/main/scala/org/junit/runner/RunWith.scala +++ b/modules/core/js/src/main/scala/org/junit/runner/RunWith.scala @@ -3,4 +3,5 @@ package org.junit.runner /** * Stub used for cross-compilation */ -class RunWith[T](@scala.annotation.unused cls: Class[T]) extends scala.annotation.StaticAnnotation +class RunWith[T](@scala.annotation.unused cls: Class[T]) + extends scala.annotation.StaticAnnotation From 086549240129a3aa561b014a4e7ba749c7780d3b Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Fri, 8 Mar 2024 17:26:18 +0000 Subject: [PATCH 23/38] Mark RunWith as unused. --- .../core/native/src/main/scala/org/junit/runner/RunWith.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/core/native/src/main/scala/org/junit/runner/RunWith.scala b/modules/core/native/src/main/scala/org/junit/runner/RunWith.scala index 98c3708b..b6ffcfec 100644 --- a/modules/core/native/src/main/scala/org/junit/runner/RunWith.scala +++ b/modules/core/native/src/main/scala/org/junit/runner/RunWith.scala @@ -3,4 +3,5 @@ package org.junit.runner /** * Stub used for cross-compilation */ -class RunWith[T](cls: Class[T]) extends scala.annotation.StaticAnnotation +class RunWith[T](@scala.annotation.unused cls: Class[T]) + extends scala.annotation.StaticAnnotation From d1ac0c4fb9b46eefbb7fd7f32929a51d877270c9 Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Mon, 11 Mar 2024 14:35:25 +0000 Subject: [PATCH 24/38] Add newline to scalafmt.conf. --- .scalafmt.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.scalafmt.conf b/.scalafmt.conf index a164bdaa..00ceef68 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -36,4 +36,4 @@ fileOverride { "glob:**/scala-3/**" { runner.dialect = scala3 } -} \ No newline at end of file +} From 12cca522231f30ce74de2b60f4db2095cd670224 Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Mon, 11 Mar 2024 14:55:00 +0000 Subject: [PATCH 25/38] Use scalacCompatAnnotation. --- build.sbt | 28 ++++++++++--------- .../main/scala/org/junit/runner/RunWith.scala | 4 ++- .../main/scala/weaver/PlatformCompat.scala | 4 +-- .../main/scala/org/junit/runner/RunWith.scala | 3 +- .../main/scala/weaver/PlatformCompat.scala | 3 +- .../src/main/scala/DogFoodCompat.scala | 3 +- .../src/main/scala/RunnerCompat.scala | 3 +- .../jvm/src/main/scala/RunnerCompat.scala | 3 +- 8 files changed, 30 insertions(+), 21 deletions(-) diff --git a/build.sbt b/build.sbt index 23524a28..383259c1 100644 --- a/build.sbt +++ b/build.sbt @@ -25,18 +25,19 @@ ThisBuild / crossScalaVersions := Seq(scala212, scala213, "3.3.1") ThisBuild / scalaVersion := scala213 // the default Scala val Version = new { - val catsEffect = "3.5.2" - val catsLaws = "2.9.0" - val discipline = "1.5.1" - val expecty = "0.16.0" - val fs2 = "3.5.0" - val junit = "4.13.2" - val portableReflect = "1.1.2" - val scalaJavaTime = "2.4.0" - val scalacheck = "1.17.0" - val scalajsMacroTask = "1.1.1" - val scalajsStubs = "1.1.0" - val testInterface = "1.0" + val catsEffect = "3.5.2" + val catsLaws = "2.9.0" + val discipline = "1.5.1" + val expecty = "0.16.0" + val fs2 = "3.5.0" + val junit = "4.13.2" + val portableReflect = "1.1.2" + val scalaJavaTime = "2.4.0" + val scalacheck = "1.17.0" + val scalajsMacroTask = "1.1.1" + val scalajsStubs = "1.1.0" + val testInterface = "1.0" + val scalacCompatAnnotation = "0.1.4" } lazy val root = tlCrossRootProject.aggregate(core, @@ -55,7 +56,8 @@ lazy val core = crossProject(JVMPlatform, JSPlatform, NativePlatform) "org.typelevel" %%% "cats-effect" % Version.catsEffect, "com.eed3si9n.expecty" %%% "expecty" % Version.expecty, // https://github.com/portable-scala/portable-scala-reflect/issues/23 - "org.portable-scala" %%% "portable-scala-reflect" % Version.portableReflect cross CrossVersion.for3Use2_13 + "org.portable-scala" %%% "portable-scala-reflect" % Version.portableReflect cross CrossVersion.for3Use2_13, + "org.typelevel" %% "scalac-compat-annotation" % Version.scalacCompatAnnotation ) ) diff --git a/modules/core/js/src/main/scala/org/junit/runner/RunWith.scala b/modules/core/js/src/main/scala/org/junit/runner/RunWith.scala index b6ffcfec..02389224 100644 --- a/modules/core/js/src/main/scala/org/junit/runner/RunWith.scala +++ b/modules/core/js/src/main/scala/org/junit/runner/RunWith.scala @@ -1,7 +1,9 @@ package org.junit.runner +import org.typelevel.scalaccompat.annotation.unused + /** * Stub used for cross-compilation */ -class RunWith[T](@scala.annotation.unused cls: Class[T]) +class RunWith[T](@unused cls: Class[T]) extends scala.annotation.StaticAnnotation diff --git a/modules/core/js/src/main/scala/weaver/PlatformCompat.scala b/modules/core/js/src/main/scala/weaver/PlatformCompat.scala index d1f4679e..f331a229 100644 --- a/modules/core/js/src/main/scala/weaver/PlatformCompat.scala +++ b/modules/core/js/src/main/scala/weaver/PlatformCompat.scala @@ -1,8 +1,8 @@ package weaver - +import org.typelevel.scalaccompat.annotation.unused private[weaver] object PlatformCompat { val platform: Platform = Platform.JS - def getClassLoader(clazz: java.lang.Class[_]): ClassLoader = + def getClassLoader(@unused clazz: java.lang.Class[_]): ClassLoader = new ClassLoader() {} } diff --git a/modules/core/native/src/main/scala/org/junit/runner/RunWith.scala b/modules/core/native/src/main/scala/org/junit/runner/RunWith.scala index b6ffcfec..0ba6ff2c 100644 --- a/modules/core/native/src/main/scala/org/junit/runner/RunWith.scala +++ b/modules/core/native/src/main/scala/org/junit/runner/RunWith.scala @@ -1,7 +1,8 @@ package org.junit.runner +import org.typelevel.scalaccompat.annotation.unused /** * Stub used for cross-compilation */ -class RunWith[T](@scala.annotation.unused cls: Class[T]) +class RunWith[T](@unused cls: Class[T]) extends scala.annotation.StaticAnnotation diff --git a/modules/core/native/src/main/scala/weaver/PlatformCompat.scala b/modules/core/native/src/main/scala/weaver/PlatformCompat.scala index f981fbf9..7d588b18 100644 --- a/modules/core/native/src/main/scala/weaver/PlatformCompat.scala +++ b/modules/core/native/src/main/scala/weaver/PlatformCompat.scala @@ -1,8 +1,9 @@ package weaver +import org.typelevel.scalaccompat.annotation.unused private[weaver] object PlatformCompat { val platform: Platform = Platform.Native - def getClassLoader(clazz: java.lang.Class[_]): ClassLoader = + def getClassLoader(@unused clazz: java.lang.Class[_]): ClassLoader = new ClassLoader() {} } diff --git a/modules/framework/js-native/src/main/scala/DogFoodCompat.scala b/modules/framework/js-native/src/main/scala/DogFoodCompat.scala index dc6b7d97..d794752c 100644 --- a/modules/framework/js-native/src/main/scala/DogFoodCompat.scala +++ b/modules/framework/js-native/src/main/scala/DogFoodCompat.scala @@ -4,6 +4,7 @@ package framework import cats.data.Chain import cats.effect.Resource import cats.syntax.all._ +import org.typelevel.scalaccompat.annotation.unused private[weaver] trait DogFoodCompat[F[_]] { self: DogFood[F] => @@ -15,7 +16,7 @@ private[weaver] trait DogFoodCompat[F[_]] { self: DogFood[F] => runner: WeaverRunner[F], eventHandler: sbt.testing.EventHandler, logger: sbt.testing.Logger, - maxParallelism: Int)(tasks: List[sbt.testing.Task]): F[Unit] = { + @unused maxParallelism: Int)(tasks: List[sbt.testing.Task]): F[Unit] = { tasks.traverse { task => self.framework.unsafeRun.fromFuture { task.asInstanceOf[AsyncTask].executeFuture(eventHandler, Array(logger)) diff --git a/modules/framework/js-native/src/main/scala/RunnerCompat.scala b/modules/framework/js-native/src/main/scala/RunnerCompat.scala index 5029b521..501011f9 100644 --- a/modules/framework/js-native/src/main/scala/RunnerCompat.scala +++ b/modules/framework/js-native/src/main/scala/RunnerCompat.scala @@ -2,6 +2,7 @@ package weaver package framework import java.nio.ByteBuffer +import org.typelevel.scalaccompat.annotation.unused import scala.collection.mutable.ListBuffer import scala.concurrent.Future @@ -138,7 +139,7 @@ trait RunnerCompat[F[_]] { self: sbt.testing.Runner => } } - def finaliseError(outcomes: Ref[ + def finaliseError(@unused outcomes: Ref[ F, Chain[TestOutcome]]): Throwable => F[Unit] = { error => val outcome = diff --git a/modules/framework/jvm/src/main/scala/RunnerCompat.scala b/modules/framework/jvm/src/main/scala/RunnerCompat.scala index f13f4bcc..0fb0f393 100644 --- a/modules/framework/jvm/src/main/scala/RunnerCompat.scala +++ b/modules/framework/jvm/src/main/scala/RunnerCompat.scala @@ -1,5 +1,6 @@ package weaver package framework +import org.typelevel.scalaccompat.annotation.unused import java.io.PrintStream import java.util.concurrent.ConcurrentLinkedQueue @@ -37,7 +38,7 @@ trait RunnerCompat[F[_]] { self: sbt.testing.Runner => } // Required on js - def receiveMessage(msg: String): Option[String] = None + def receiveMessage(@unused msg: String): Option[String] = None // Flag meant to be raised if build-tool call `done` protected val isDone: AtomicBoolean = new AtomicBoolean(false) From 50ff96abb9857ff0dfd2208e0e039320ccbe1a29 Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Mon, 11 Mar 2024 15:28:21 +0000 Subject: [PATCH 26/38] Add type parameters for Scala 2.12 compiler subtype warning. --- modules/core/shared/src/main/scala/weaver/Test.scala | 2 +- modules/core/shared/src/main/scala/weaver/suites.scala | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/core/shared/src/main/scala/weaver/Test.scala b/modules/core/shared/src/main/scala/weaver/Test.scala index 397ee715..56a9be4a 100644 --- a/modules/core/shared/src/main/scala/weaver/Test.scala +++ b/modules/core/shared/src/main/scala/weaver/Test.scala @@ -40,6 +40,6 @@ object Test { def apply[F[_]](name: String, f: F[Expectations])( implicit F: EffectCompat[F] - ): F[TestOutcome] = apply(name, (_: Log[F]) => f) + ): F[TestOutcome] = apply[F](name, (_: Log[F]) => f) } diff --git a/modules/core/shared/src/main/scala/weaver/suites.scala b/modules/core/shared/src/main/scala/weaver/suites.scala index b3a118f8..5b105650 100644 --- a/modules/core/shared/src/main/scala/weaver/suites.scala +++ b/modules/core/shared/src/main/scala/weaver/suites.scala @@ -131,13 +131,13 @@ abstract class MutableFSuite[F[_]] extends RunnableSuite[F] { } def pureTest(name: TestName)(run : => Expectations) : Unit = registerTest(name)(_ => Test(name.name, effectCompat.effect.delay(run))) - def loggedTest(name: TestName)(run: Log[F] => F[Expectations]) : Unit = registerTest(name)(_ => Test(name.name, log => run(log))) + def loggedTest(name: TestName)(run: Log[F] => F[Expectations]) : Unit = registerTest(name)(_ => Test[F](name.name, log => run(log))) def test(name: TestName) : PartiallyAppliedTest = new PartiallyAppliedTest(name) class PartiallyAppliedTest(name : TestName) { def apply(run: => F[Expectations]) : Unit = registerTest(name)(_ => Test(name.name, run)) def apply(run : Res => F[Expectations]) : Unit = registerTest(name)(res => Test(name.name, run(res))) - def apply(run : (Res, Log[F]) => F[Expectations]) : Unit = registerTest(name)(res => Test(name.name, log => run(res, log))) + def apply(run : (Res, Log[F]) => F[Expectations]) : Unit = registerTest(name)(res => Test[F](name.name, log => run(res, log))) // this alias helps using pattern matching on `Res` def usingRes(run : Res => F[Expectations]) : Unit = apply(run) From 5fde5d4d7a6d5d5a610d69bb523a4d176b9d813f Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Mon, 11 Mar 2024 16:37:31 +0000 Subject: [PATCH 27/38] Fix doc for 2.13 --- .../shared/src/main/scala/weaver/framework/Fingerprints.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/framework/shared/src/main/scala/weaver/framework/Fingerprints.scala b/modules/framework/shared/src/main/scala/weaver/framework/Fingerprints.scala index 535adf8b..f36982cf 100644 --- a/modules/framework/shared/src/main/scala/weaver/framework/Fingerprints.scala +++ b/modules/framework/shared/src/main/scala/weaver/framework/Fingerprints.scala @@ -76,7 +76,7 @@ abstract class WeaverFingerprints[F[_]](implicit F: Sync[F]) { /** * A fingerprint that searches only for classes extending * [[weaver.EffectSuite]]. that have a constructor that takes a single - * [[weaver.GlobalResources.Read]] parameter. + * `weaver.GlobalResources.Read` parameter. */ object ResourceSharingSuiteFingerprint extends WeaverFingerprint { def isModule() = false From 6721c4d77963e352b684f99d7a620b06044d5626 Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Mon, 11 Mar 2024 16:59:08 +0000 Subject: [PATCH 28/38] Experiment: remove RunWith annotation. --- modules/core/shared/src/main/scala/weaver/suites.scala | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/core/shared/src/main/scala/weaver/suites.scala b/modules/core/shared/src/main/scala/weaver/suites.scala index 5b105650..1ece7c2d 100644 --- a/modules/core/shared/src/main/scala/weaver/suites.scala +++ b/modules/core/shared/src/main/scala/weaver/suites.scala @@ -7,7 +7,6 @@ import cats.effect.{ Async, Resource } import cats.syntax.all._ import fs2.Stream -import org.junit.runner.RunWith import org.portablescala.reflect.annotation.EnableReflectiveInstantiation // Just a non-parameterized marker trait to help SBT's test detection logic. @@ -60,7 +59,6 @@ object EffectSuite { } -@RunWith(classOf[weaver.junit.WeaverRunner]) abstract class RunnableSuite[F[_]] extends EffectSuite[F] { implicit protected def effectCompat: UnsafeRun[EffectType] private[weaver] def getEffectCompat: UnsafeRun[EffectType] = effectCompat From 5374b60ae347f54c9751cd4a994d12a98a3bce53 Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Tue, 12 Mar 2024 15:56:16 +0000 Subject: [PATCH 29/38] Add unused Reader.pt, WeaverRunner.dummy, LazyAccessSequential.index --- .../jvm/src/main/scala/weaver/junit/WeaverRunner.scala | 4 +++- .../framework-cats/jvm/src/test/scala/MetaJVM.scala | 10 ++++++---- .../js-native/src/main/scala/RunnerCompat.scala | 4 ++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/modules/core/jvm/src/main/scala/weaver/junit/WeaverRunner.scala b/modules/core/jvm/src/main/scala/weaver/junit/WeaverRunner.scala index 9b82a6a2..7a730766 100644 --- a/modules/core/jvm/src/main/scala/weaver/junit/WeaverRunner.scala +++ b/modules/core/jvm/src/main/scala/weaver/junit/WeaverRunner.scala @@ -1,13 +1,15 @@ package weaver package junit +import org.typelevel.scalaccompat.annotation.unused + import weaver.TestStatus._ import weaver.internals.Reflection import org.junit.runner.Description import org.junit.runner.notification.RunNotifier -class WeaverRunner(cls: Class[_]) +class WeaverRunner(cls: Class[_], @unused dummy: Boolean) extends org.junit.runner.Runner { type F[A] = Any diff --git a/modules/framework-cats/jvm/src/test/scala/MetaJVM.scala b/modules/framework-cats/jvm/src/test/scala/MetaJVM.scala index e49e0d2d..f9d23b94 100644 --- a/modules/framework-cats/jvm/src/test/scala/MetaJVM.scala +++ b/modules/framework-cats/jvm/src/test/scala/MetaJVM.scala @@ -2,6 +2,8 @@ package weaver package framework package test +import org.typelevel.scalaccompat.annotation.unused + import java.io.File import cats.effect._ @@ -132,7 +134,7 @@ object MetaJVM { } } - abstract class LazyAccessSequential(global: GlobalRead) + abstract class LazyAccessSequential(global: GlobalRead, @unused index: Int) extends IOSuite { type Res = LazyState def sharedResource: Resource[IO, Res] = { @@ -157,10 +159,10 @@ object MetaJVM { // Using sleeps to force sequential runs of suites class LazyAccessSequential0(global: GlobalRead) - extends LazyAccessSequential(global) + extends LazyAccessSequential(global, 0) class LazyAccessSequential1(global: GlobalRead) - extends LazyAccessSequential(global) + extends LazyAccessSequential(global, 1) class LazyAccessSequential2(global: GlobalRead) - extends LazyAccessSequential(global) + extends LazyAccessSequential(global, 2) } diff --git a/modules/framework/js-native/src/main/scala/RunnerCompat.scala b/modules/framework/js-native/src/main/scala/RunnerCompat.scala index 501011f9..f57f4d77 100644 --- a/modules/framework/js-native/src/main/scala/RunnerCompat.scala +++ b/modules/framework/js-native/src/main/scala/RunnerCompat.scala @@ -178,7 +178,7 @@ trait RunnerCompat[F[_]] { self: sbt.testing.Runner => } private[weaver] object ReadWriter { - class Reader(bytes: ByteBuffer) { + class Reader(bytes: ByteBuffer, @unused private var pt: Int) { def readString() = { val stringSize = bytes.getInt() val ar = new Array[Byte](stringSize) @@ -202,7 +202,7 @@ private[weaver] object ReadWriter { def reader[A](s: String)(f: Reader => A) = { val buf = ByteBuffer.wrap(s.getBytes) - f(new Reader(buf)) + f(new Reader(buf, 0)) } def writer(f: Writer => Unit): String = { From 98dd4922933eee2e7dd39494c84a2f0008a2e885 Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Tue, 12 Mar 2024 16:01:25 +0000 Subject: [PATCH 30/38] Add WeaverRunner constructor back. --- modules/core/jvm/src/main/scala/weaver/junit/WeaverRunner.scala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/core/jvm/src/main/scala/weaver/junit/WeaverRunner.scala b/modules/core/jvm/src/main/scala/weaver/junit/WeaverRunner.scala index 7a730766..358f374b 100644 --- a/modules/core/jvm/src/main/scala/weaver/junit/WeaverRunner.scala +++ b/modules/core/jvm/src/main/scala/weaver/junit/WeaverRunner.scala @@ -14,6 +14,8 @@ class WeaverRunner(cls: Class[_], @unused dummy: Boolean) type F[A] = Any + def this(cls: Class[_]) = this(cls, true) + lazy val suite: RunnableSuite[F] = { Reflection.loadRunnableSuite(cls.getName(), getClass().getClassLoader()) } From 482bd816fa4617b9dc4cd443c2ba997c3650682f Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Tue, 12 Mar 2024 16:07:38 +0000 Subject: [PATCH 31/38] Use nowarn2 annotation. --- modules/framework-cats/shared/src/test/scala/Meta.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/framework-cats/shared/src/test/scala/Meta.scala b/modules/framework-cats/shared/src/test/scala/Meta.scala index 7ab883bd..90ddd5c8 100644 --- a/modules/framework-cats/shared/src/test/scala/Meta.scala +++ b/modules/framework-cats/shared/src/test/scala/Meta.scala @@ -2,7 +2,7 @@ package weaver package framework package test -import scala.annotation.nowarn +import org.typelevel.scalaccompat.annotation._ import cats.effect._ @@ -14,7 +14,7 @@ object Meta { object Boom extends Error("Boom") with scala.util.control.NoStackTrace - @nowarn("msg=dead code following this construct") + @nowarn2("cat=w-flag-dead-code") object CrashingSuite extends SimpleIOSuite { throw Boom } From 705c8331acaa7aa6178ac84e09dfee17c6afcd35 Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Tue, 12 Mar 2024 16:11:36 +0000 Subject: [PATCH 32/38] Mark runner in DogFoodCompat as unused. --- modules/framework/jvm/src/main/scala/DogFoodCompat.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/framework/jvm/src/main/scala/DogFoodCompat.scala b/modules/framework/jvm/src/main/scala/DogFoodCompat.scala index eb864379..2c3480fa 100644 --- a/modules/framework/jvm/src/main/scala/DogFoodCompat.scala +++ b/modules/framework/jvm/src/main/scala/DogFoodCompat.scala @@ -5,6 +5,7 @@ import cats.effect.Resource import cats.effect.implicits._ import sbt.testing._ +import org.typelevel.scalaccompat.annotation.unused private[weaver] trait DogFoodCompat[F[_]] { self: DogFood[F] => @@ -13,11 +14,10 @@ private[weaver] trait DogFoodCompat[F[_]] { self: DogFood[F] => def blocker: BlockerCompat[F] def runTasksCompat( - runner: WeaverRunner[F], + @unused runner: WeaverRunner[F], eventHandler: EventHandler, logger: Logger, maxParallelism: Int)(tasks: List[sbt.testing.Task]): F[Unit] = { - val _ = runner effect.void { val r = tasks.toVector.parTraverseN[F, Unit](maxParallelism) { task => blocker.block(discard[Array[Task]](task.execute(eventHandler, From 901504ed1fe44b4585928609c16f789ef048a183 Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Tue, 12 Mar 2024 16:22:43 +0000 Subject: [PATCH 33/38] Use tupleLeft. --- modules/framework/jvm/src/main/scala/RunnerCompat.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/framework/jvm/src/main/scala/RunnerCompat.scala b/modules/framework/jvm/src/main/scala/RunnerCompat.scala index 0fb0f393..d4834c5e 100644 --- a/modules/framework/jvm/src/main/scala/RunnerCompat.scala +++ b/modules/framework/jvm/src/main/scala/RunnerCompat.scala @@ -59,7 +59,7 @@ trait RunnerCompat[F[_]] { self: sbt.testing.Runner => val waitForResourcesShutdown = new java.util.concurrent.Semaphore(0) val tasksAndSuites = (taskDefs.toList.mapFilter { taskDef => - suiteLoader(taskDef).map(loader => (taskDef, loader)) + suiteLoader(taskDef).tupleLeft(taskDef) }) def makeTasks( From 13400cbf91c2ffa9b97a1a058f39ec0e42b99caa Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Tue, 12 Mar 2024 16:39:54 +0000 Subject: [PATCH 34/38] Add `RunWith` annotation (and fail CI pipeline). --- modules/core/shared/src/main/scala/weaver/suites.scala | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/core/shared/src/main/scala/weaver/suites.scala b/modules/core/shared/src/main/scala/weaver/suites.scala index 1ece7c2d..975ebbf7 100644 --- a/modules/core/shared/src/main/scala/weaver/suites.scala +++ b/modules/core/shared/src/main/scala/weaver/suites.scala @@ -8,6 +8,7 @@ import cats.syntax.all._ import fs2.Stream import org.portablescala.reflect.annotation.EnableReflectiveInstantiation +import org.junit.runner.RunWith // Just a non-parameterized marker trait to help SBT's test detection logic. @EnableReflectiveInstantiation @@ -59,6 +60,7 @@ object EffectSuite { } +@RunWith(classOf[weaver.junit.WeaverRunner]) abstract class RunnableSuite[F[_]] extends EffectSuite[F] { implicit protected def effectCompat: UnsafeRun[EffectType] private[weaver] def getEffectCompat: UnsafeRun[EffectType] = effectCompat From 3fe2d7bf4e2f6cd86394f08fbc5a853a2e306276 Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Wed, 13 Mar 2024 13:20:36 +0000 Subject: [PATCH 35/38] Add optional JUnit dependency to cats-core. --- build.sbt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build.sbt b/build.sbt index 383259c1..23c927e3 100644 --- a/build.sbt +++ b/build.sbt @@ -108,6 +108,11 @@ lazy val frameworkNative = framework.native lazy val coreCats = crossProject(JVMPlatform, JSPlatform, NativePlatform) .in(file("modules/core-cats")) .dependsOn(core) + .settings( + libraryDependencies ++= Seq( + "junit" % "junit" % Version.junit % Optional + ) + ) .settings(name := "cats-core") lazy val coreCatsJS = coreCats.js From 6b0fd1c676086779b547e33036500900a7f8d23b Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Wed, 13 Mar 2024 13:33:07 +0000 Subject: [PATCH 36/38] Use ScalaDocTool configuration. --- build.sbt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build.sbt b/build.sbt index 23c927e3..a57a6272 100644 --- a/build.sbt +++ b/build.sbt @@ -1,3 +1,5 @@ +import sbt.librarymanagement.Configurations.ScalaDocTool + // https://typelevel.org/sbt-typelevel/faq.html#what-is-a-base-version-anyway ThisBuild / tlBaseVersion := "0.0" // your current series x.y @@ -110,7 +112,7 @@ lazy val coreCats = crossProject(JVMPlatform, JSPlatform, NativePlatform) .dependsOn(core) .settings( libraryDependencies ++= Seq( - "junit" % "junit" % Version.junit % Optional + "junit" % "junit" % Version.junit % ScalaDocTool ) ) .settings(name := "cats-core") From bcc7d34856c9882047522425dbb495b8d4a73eea Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Wed, 13 Mar 2024 13:52:08 +0000 Subject: [PATCH 37/38] Remove unused index from LazyAccessSequential test. --- .../framework-cats/jvm/src/test/scala/MetaJVM.scala | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/modules/framework-cats/jvm/src/test/scala/MetaJVM.scala b/modules/framework-cats/jvm/src/test/scala/MetaJVM.scala index f9d23b94..e49e0d2d 100644 --- a/modules/framework-cats/jvm/src/test/scala/MetaJVM.scala +++ b/modules/framework-cats/jvm/src/test/scala/MetaJVM.scala @@ -2,8 +2,6 @@ package weaver package framework package test -import org.typelevel.scalaccompat.annotation.unused - import java.io.File import cats.effect._ @@ -134,7 +132,7 @@ object MetaJVM { } } - abstract class LazyAccessSequential(global: GlobalRead, @unused index: Int) + abstract class LazyAccessSequential(global: GlobalRead) extends IOSuite { type Res = LazyState def sharedResource: Resource[IO, Res] = { @@ -159,10 +157,10 @@ object MetaJVM { // Using sleeps to force sequential runs of suites class LazyAccessSequential0(global: GlobalRead) - extends LazyAccessSequential(global, 0) + extends LazyAccessSequential(global) class LazyAccessSequential1(global: GlobalRead) - extends LazyAccessSequential(global, 1) + extends LazyAccessSequential(global) class LazyAccessSequential2(global: GlobalRead) - extends LazyAccessSequential(global, 2) + extends LazyAccessSequential(global) } From 03d98b2a282ed8a06c055196f5db9f887dad6bcf Mon Sep 17 00:00:00 2001 From: zainab-ali Date: Wed, 13 Mar 2024 13:55:42 +0000 Subject: [PATCH 38/38] Use GlobalResourceF.Read in scaladoc. --- .../shared/src/main/scala/weaver/framework/Fingerprints.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/framework/shared/src/main/scala/weaver/framework/Fingerprints.scala b/modules/framework/shared/src/main/scala/weaver/framework/Fingerprints.scala index f36982cf..75b6d0a5 100644 --- a/modules/framework/shared/src/main/scala/weaver/framework/Fingerprints.scala +++ b/modules/framework/shared/src/main/scala/weaver/framework/Fingerprints.scala @@ -76,7 +76,7 @@ abstract class WeaverFingerprints[F[_]](implicit F: Sync[F]) { /** * A fingerprint that searches only for classes extending * [[weaver.EffectSuite]]. that have a constructor that takes a single - * `weaver.GlobalResources.Read` parameter. + * [[weaver.GlobalResourceF.Read]] parameter. */ object ResourceSharingSuiteFingerprint extends WeaverFingerprint { def isModule() = false