-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scala 3.0.0-M3 #158
Scala 3.0.0-M3 #158
Changes from 9 commits
b4fb3df
9e86137
da11fa8
99563ff
5ac1818
9b36b2d
629e4a8
fa063fc
1d6a5ac
c374f81
18dc51d
1dde528
2d11554
41334a1
7d7d186
3829a2c
7d21326
cad73c5
72b7602
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,3 +25,7 @@ spaces { | |
} | ||
|
||
project.git = true | ||
|
||
project.excludeFilters = [ | ||
".*-scala-3.*" | ||
] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,16 +7,17 @@ ThisBuild / commands += Command.command("ci") { state => | |
"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 => | ||
"scalafmtAll" :: | ||
"scalafmtSbt" :: | ||
"scalafix" :: | ||
"test:scalafix" :: state | ||
"scalafix" :: | ||
"test:scalafix" :: | ||
"scalafmtAll" :: | ||
"scalafmtSbt" :: state | ||
} | ||
|
||
ThisBuild / commands += Command.command("release") { state => | ||
|
@@ -33,7 +34,6 @@ Global / (Test / testOptions) += Tests.Argument("--quickstart") | |
|
||
lazy val root = project | ||
.in(file(".")) | ||
.enablePlugins(ScalafixPlugin) | ||
.aggregate(allModules: _*) | ||
.configure(WeaverPlugin.profile) | ||
.settings(WeaverPlugin.doNotPublishArtifact) | ||
|
@@ -75,17 +75,19 @@ lazy val core = projectMatrix | |
.configure(catsEffectDependencies) | ||
.settings( | ||
libraryDependencies ++= Seq( | ||
"com.eed3si9n.expecty" %%% "expecty" % "0.14.1", | ||
"org.portable-scala" %%% "portable-scala-reflect" % "1.0.0" | ||
"com.eed3si9n.expecty" %%% "expecty" % "0.15.0", | ||
("org.portable-scala" %%% "portable-scala-reflect" % "1.0.0").withDottyCompat( | ||
scalaVersion.value) | ||
), | ||
libraryDependencies ++= { | ||
if (virtualAxes.value.contains(VirtualAxis.jvm)) | ||
Seq( | ||
"org.scala-js" %%% "scalajs-stubs" % "1.0.0" % "provided" | ||
("org.scala-js" %%% "scalajs-stubs" % "1.0.0" % "provided").withDottyCompat( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this dep is like 2 annotations, may be we can copypaste it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mmm not sure how we could do it without polluting the user's classpath tbh. I think having the dotty compat on this one is low risk for the time being, since it's a compile-only thing. |
||
scalaVersion.value) | ||
) | ||
else { | ||
Seq( | ||
"io.github.cquiroz" %%% "scala-java-time" % "2.0.0" | ||
"io.github.cquiroz" %%% "scala-java-time" % "2.1.0" | ||
) | ||
} | ||
} | ||
|
@@ -109,7 +111,7 @@ val allIntegrationsCoresFilter: ScopeFilter = | |
|
||
lazy val docs = projectMatrix | ||
.in(file("modules/docs")) | ||
.jvmPlatform(WeaverPlugin.supportedScalaVersions) | ||
.jvmPlatform(WeaverPlugin.supportedScala2Versions) | ||
.enablePlugins(DocusaurusPlugin, MdocPlugin) | ||
.dependsOn(core, scalacheck, cats, zio, monix, monixBio, specs2) | ||
.settings( | ||
|
@@ -182,13 +184,15 @@ lazy val framework = projectMatrix | |
libraryDependencies ++= { | ||
if (virtualAxes.value.contains(VirtualAxis.jvm)) | ||
Seq( | ||
"org.scala-sbt" % "test-interface" % "1.0", | ||
"org.scala-js" %%% "scalajs-stubs" % "1.0.0" % "provided" | ||
"org.scala-sbt" % "test-interface" % "1.0", | ||
("org.scala-js" %%% "scalajs-stubs" % "1.0.0" % "provided").withDottyCompat( | ||
scalaVersion.value) | ||
) | ||
else | ||
Seq( | ||
"org.scala-js" %% "scalajs-test-interface" % scalaJSVersion, | ||
"io.github.cquiroz" %%% "scala-java-time-tzdb" % "2.0.0" % Test | ||
("org.scala-js" %% "scalajs-test-interface" % scalaJSVersion).withDottyCompat( | ||
scalaVersion.value), | ||
"io.github.cquiroz" %%% "scala-java-time-tzdb" % "2.1.0" % Test | ||
) | ||
} | ||
) | ||
|
@@ -217,7 +221,8 @@ lazy val specs2 = projectMatrix | |
name := "specs2", | ||
testFrameworks := Seq(new TestFramework("weaver.framework.CatsEffect")), | ||
libraryDependencies ++= Seq( | ||
"org.specs2" %%% "specs2-matcher" % "4.10.5" | ||
("org.specs2" %%% "specs2-matcher" % "4.10.5").withDottyCompat( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not seeing a 3.0.0-M3 release yet, so this might have to become onlyScala2 for the time being. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm fine with that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i.e. with making it scala 2 only? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
yes |
||
scalaVersion.value) | ||
) | ||
) | ||
.settings(WeaverPlugin.simpleLayout) | ||
|
@@ -239,7 +244,7 @@ lazy val coreCats = projectMatrix | |
|
||
lazy val coreMonix = projectMatrix | ||
.in(file("modules/core/monix")) | ||
.onlyCatsEffect2() | ||
.onlyCatsEffect2(onlyScala2 = true) | ||
.dependsOn(core) | ||
.configure(WeaverPlugin.profile) | ||
.settings(WeaverPlugin.simpleLayout) | ||
|
@@ -252,7 +257,7 @@ lazy val coreMonix = projectMatrix | |
|
||
lazy val coreMonixBio = projectMatrix | ||
.in(file("modules/core/monixBio")) | ||
.onlyCatsEffect2() | ||
.onlyCatsEffect2(onlyScala2 = true) | ||
.dependsOn(core) | ||
.configure(WeaverPlugin.profile) | ||
.settings(WeaverPlugin.simpleLayout) | ||
|
@@ -265,7 +270,7 @@ lazy val coreMonixBio = projectMatrix | |
|
||
lazy val coreZio = projectMatrix | ||
.in(file("modules/core/zio")) | ||
.onlyCatsEffect2() | ||
.onlyCatsEffect2(onlyScala2 = true) | ||
.dependsOn(core) | ||
.configure(WeaverPlugin.profile) | ||
.settings(WeaverPlugin.simpleLayout) | ||
|
@@ -296,12 +301,15 @@ lazy val cats = projectMatrix | |
.settings( | ||
name := "cats", | ||
testFrameworks := Seq(new TestFramework("weaver.framework.CatsEffect")), | ||
libraryDependencies += "io.github.cquiroz" %%% "scala-java-time-tzdb" % "2.0.0" % Test | ||
libraryDependencies += { | ||
// if(virtualAxes.contains(VirtualAxis.js)) | ||
"io.github.cquiroz" %%% "scala-java-time-tzdb" % "2.1.0" % Test | ||
} | ||
) | ||
|
||
lazy val monix = projectMatrix | ||
.in(file("modules/framework/monix")) | ||
.onlyCatsEffect2() | ||
.onlyCatsEffect2(onlyScala2 = true) | ||
.dependsOn(framework, coreMonix) | ||
.configure(WeaverPlugin.profile) | ||
.settings(WeaverPlugin.simpleLayout) | ||
|
@@ -312,7 +320,7 @@ lazy val monix = projectMatrix | |
|
||
lazy val monixBio = projectMatrix | ||
.in(file("modules/framework/monix-bio")) | ||
.onlyCatsEffect2() | ||
.onlyCatsEffect2(onlyScala2 = true) | ||
.dependsOn(framework, coreMonixBio) | ||
.configure(WeaverPlugin.profile) | ||
.settings(WeaverPlugin.simpleLayout) | ||
|
@@ -323,7 +331,7 @@ lazy val monixBio = projectMatrix | |
|
||
lazy val zio = projectMatrix | ||
.in(file("modules/framework/zio")) | ||
.onlyCatsEffect2() | ||
.onlyCatsEffect2(onlyScala2 = true) | ||
.dependsOn(framework, coreZio) | ||
.configure(WeaverPlugin.profile) | ||
.settings(WeaverPlugin.simpleLayout) | ||
|
@@ -337,7 +345,7 @@ lazy val zio = projectMatrix | |
// ################################################################################################# | ||
|
||
lazy val intellijRunner = projectMatrix | ||
.onlyCatsEffect2(withJs = false) | ||
.onlyCatsEffect2(withJs = false, onlyScala2 = true) | ||
.in(file("modules/intellij-runner")) | ||
.dependsOn(core, framework, framework % "test->compile") | ||
.configure(WeaverPlugin.profile) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
package weaver | ||
|
||
import cats.effect.IO | ||
import cats.effect.{ ContextShift, IO, Timer } | ||
|
||
trait BaseIOSuite extends RunnableSuite[IO] { | ||
implicit protected def effectCompat: UnsafeRun[IO] = CatsUnsafeRun | ||
final implicit protected def contextShift = effectCompat.contextShift | ||
final implicit protected def timer = effectCompat.timer | ||
final implicit protected def contextShift: ContextShift[IO] = | ||
effectCompat.contextShift | ||
final implicit protected def timer: Timer[IO] = effectCompat.timer | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,5 +55,4 @@ private[weaver] trait CECompat { | |
} | ||
} | ||
} | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package weaver | ||
|
||
// import cats.data.{ NonEmptyList, ValidatedNel } | ||
// import cats.syntax.all._ | ||
|
||
import com.eed3si9n.expecty._ | ||
|
||
class Expect | ||
extends Recorder[Boolean, Expectations] | ||
with UnaryRecorder[Boolean, Expectations] { | ||
|
||
def all(recordings: Boolean*): Expectations = | ||
macro VarargsRecorderMacro.apply[Boolean, Expectations] | ||
|
||
override lazy val listener = new ExpectyListener | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package weaver | ||
|
||
object ScalaCompat { | ||
def isScala3: Boolean = false | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package weaver | ||
|
||
// kudos to https://github.com/monix/minitest | ||
// format: off | ||
import scala.reflect.macros.whitebox | ||
|
||
trait SourceLocationMacro { | ||
|
||
import macros._ | ||
|
||
trait Here { | ||
/** | ||
* Pulls source location without being affected by implicit scope. | ||
*/ | ||
def here: SourceLocation = macro Macros.fromContext | ||
} | ||
|
||
implicit def fromContext: SourceLocation = | ||
macro Macros.fromContext | ||
|
||
|
||
} | ||
|
||
object macros { | ||
class Macros(val c: whitebox.Context) { | ||
import c.universe._ | ||
|
||
def fromContext: Tree = { | ||
val (pathExpr, relPathExpr, lineExpr) = getSourceLocation | ||
val SourceLocationSym = symbolOf[SourceLocation].companion | ||
q"""$SourceLocationSym($pathExpr, $relPathExpr, $lineExpr)""" | ||
} | ||
|
||
private def getSourceLocation = { | ||
val pwd = java.nio.file.Paths.get("").toAbsolutePath | ||
val p = c.enclosingPosition.source.path | ||
val abstractFile = c.enclosingPosition.source.file | ||
|
||
val rp = if (!abstractFile.isVirtual){ | ||
pwd.relativize(abstractFile.file.toPath()).toString() | ||
} else p | ||
|
||
val line = c.Expr[Int](Literal(Constant(c.enclosingPosition.line))) | ||
(p, rp, line) | ||
} | ||
|
||
} | ||
} | ||
// format: on |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package weaver | ||
|
||
import cats.data.{ NonEmptyList, ValidatedNel } | ||
import cats.syntax.all._ | ||
|
||
import com.eed3si9n.expecty._ | ||
|
||
import scala.quoted._ | ||
|
||
class Expect | ||
extends Recorder[Boolean, Expectations] | ||
with UnaryRecorder[Boolean, Expectations] { | ||
|
||
inline def all(inline recordings: Boolean*): Expectations = | ||
${ RecorderMacro.varargs('recordings, 'listener) } | ||
|
||
override lazy val listener = new ExpectyListener | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package weaver | ||
|
||
object ScalaCompat { | ||
def isScala3: Boolean = true | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package weaver | ||
|
||
// kudos to https://github.com/monix/minitest | ||
// format: off | ||
// import scala.reflect.macros.whitebox | ||
|
||
import scala.quoted._ | ||
|
||
trait SourceLocationMacro { | ||
trait Here { | ||
/** | ||
* Pulls source location without being affected by implicit scope. | ||
*/ | ||
inline def here: SourceLocation = ${macros.fromContextImpl} | ||
} | ||
|
||
implicit inline def fromContext: SourceLocation = ${macros.fromContextImpl} | ||
} | ||
|
||
object macros { | ||
def fromContextImpl(using ctx: Quotes): Expr[SourceLocation] = { | ||
import ctx.reflect.Position._ | ||
import ctx.reflect._ | ||
|
||
val pwd = java.nio.file.Paths.get("").toAbsolutePath | ||
|
||
val position = Position.ofMacroExpansion | ||
|
||
val rp = Expr(pwd.relativize(position.sourceFile.jpath).toString) | ||
val absPath = Expr(position.sourceFile.jpath.toAbsolutePath.toString) | ||
val l = Expr(position.startLine + 1) | ||
|
||
'{new SourceLocation($absPath, $rp, $l) } | ||
} | ||
} | ||
|
||
// format: on |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because scalafix can actually change the formatting :-/