-
Notifications
You must be signed in to change notification settings - Fork 66
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 crossbuild #190
Scala 3 crossbuild #190
Changes from all commits
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 |
---|---|---|
|
@@ -23,7 +23,7 @@ jobs: | |
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
scala: [2.12.13, 2.13.4] | ||
scala: [2.12.13, 2.13.4, 3.0.0-RC1] | ||
java: [[email protected]] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
|
@@ -71,7 +71,7 @@ jobs: | |
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
scala: [2.12.12] | ||
scala: [2.13.4] | ||
java: [[email protected]] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
|
@@ -117,6 +117,16 @@ jobs: | |
tar xf targets.tar | ||
rm targets.tar | ||
|
||
- name: Download target directories (3.0.0-RC1) | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: target-${{ matrix.os }}-3.0.0-RC1-${{ matrix.java }} | ||
|
||
- name: Inflate target directories (3.0.0-RC1) | ||
run: | | ||
tar xf targets.tar | ||
rm targets.tar | ||
|
||
- uses: olafurpg/setup-gpg@v3 | ||
|
||
- env: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,17 +4,13 @@ import sbtcrossproject.CrossPlugin.autoImport.crossProject | |
|
||
ThisBuild / githubWorkflowPublishTargetBranches := Seq() | ||
|
||
ThisBuild / crossScalaVersions := Seq("2.12.13", "2.13.4") | ||
ThisBuild / crossScalaVersions := Seq("2.12.13", "2.13.4", "3.0.0-RC1") | ||
|
||
lazy val commonSettings = Def.settings( | ||
scalaVersion := "2.13.1", | ||
crossScalaVersions := (ThisBuild / crossScalaVersions).value | ||
) | ||
ThisBuild / scalaVersion := "2.13.4" | ||
|
||
lazy val root = project.in(file(".")).aggregate(js, jvm). | ||
settings( | ||
name := "mouse", | ||
commonSettings, | ||
publish / skip := true, | ||
sonatypeProfileName := "org.typelevel", | ||
releaseCrossBuild := true | ||
|
@@ -24,13 +20,11 @@ lazy val cross = crossProject(JSPlatform, JVMPlatform).in(file(".")). | |
settings( | ||
name := "mouse", | ||
organization := "org.typelevel", | ||
commonSettings, | ||
sonatypeProfileName := "org.typelevel", | ||
libraryDependencies ++= Seq( | ||
"org.typelevel" %%% "cats-core" % "2.4.2", | ||
"org.scalatest" %%% "scalatest" % "3.2.5" % Test, | ||
"org.scalatestplus" %%% "scalacheck-1-15" % "3.2.5.0" % Test, | ||
compilerPlugin("org.typelevel" %% "kind-projector" % "0.11.3" cross CrossVersion.full) | ||
"org.scalatestplus" %%% "scalacheck-1-15" % "3.2.5.0" % Test | ||
), | ||
licenses += ("MIT license", url("http://opensource.org/licenses/MIT")), | ||
homepage := Some(url("https://github.com/typelevel/mouse")), | ||
|
@@ -39,11 +33,19 @@ lazy val cross = crossProject(JSPlatform, JVMPlatform).in(file(".")). | |
scalacOptions ++= Seq("-feature", "-deprecation", "-language:implicitConversions", "-language:higherKinds"), | ||
scalacOptions ++= { | ||
scalaVersion.value match { | ||
case v if v.startsWith("2.13") => Nil | ||
case _ => Seq("-Ypartial-unification") | ||
case v if v.startsWith("2.12") => Seq("-Ypartial-unification") | ||
case v if v.startsWith("3") => Seq("-source", "3.0-migration") | ||
case _ => Nil | ||
} | ||
}, | ||
Test / publishArtifact := false, | ||
Compile / doc / sources := { | ||
val old = (Compile / doc / sources).value | ||
if (isDotty.value) | ||
Seq() | ||
else | ||
old | ||
}, | ||
pomIncludeRepository := { _ => false }, | ||
releasePublishArtifactsAction := PgpKeys.publishSigned.value, | ||
releaseProcess := Seq[ReleaseStep]( | ||
|
@@ -59,6 +61,10 @@ lazy val cross = crossProject(JSPlatform, JVMPlatform).in(file(".")). | |
commitNextVersion, | ||
) | ||
) | ||
.jsSettings( | ||
crossScalaVersions := (ThisBuild / crossScalaVersions).value.filter(_.startsWith("2")), | ||
publishConfiguration := publishConfiguration.value.withOverwrite(true) | ||
Comment on lines
+65
to
+66
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 is required because Scalatest does not publish DottyJS artifacts. |
||
) | ||
|
||
ThisBuild / githubWorkflowTargetTags ++= Seq("v*") | ||
ThisBuild / githubWorkflowPublishTargetBranches := | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,19 +6,36 @@ import cats.{Id, ~>} | |
|
||
class AnyFSyntaxTest extends MouseSuite { | ||
|
||
val emptyK: List ~> List = λ[List ~> List](_ => Nil) | ||
val emptyK = new (List ~> List) { | ||
def apply[A](x: List[A]) = Nil | ||
} | ||
Comment on lines
-9
to
+11
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 syntax is not supported in Dotty, so I opted to write it like this. It's only in tests, so it seemed fair to me. |
||
|
||
val double: List ~> List = λ[List ~> List](list => list ::: list) | ||
val double = new (List ~> List) { | ||
def apply[A](x: List[A]) = x ::: x | ||
} | ||
|
||
type E[B] = Either[String, B] | ||
val toRight = new (Option ~> E) { | ||
def apply[A](x: Option[A]) = x.toRight("foo") | ||
} | ||
|
||
val headOption = new (List ~> Option) { | ||
def apply[A](x: List[A]) = x.headOption | ||
} | ||
|
||
val optionGet = new (Option ~> Id) { | ||
def apply[A](x: Option[A]) = x.get | ||
} | ||
|
||
List(1, 2, 3) thrushK emptyK shouldEqual Nil | ||
|
||
List(5, 10) thrushK double shouldEqual List(5, 10, 5, 10) | ||
|
||
"thing".some thrushK (λ[Option ~> Either[String, *]](_.toRight("foo"))) shouldEqual Right( | ||
"thing".some thrushK toRight shouldEqual Right( | ||
"thing" | ||
) | ||
|
||
(List("This") ||> double | ||
||> λ[List ~> Option](_.headOption) | ||
||> λ[Option ~> Id](_.head)) shouldEqual "This" | ||
||> headOption | ||
||> optionGet) shouldEqual "This" | ||
} |
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.
This is to make Dotty shut up about missing parens in lambdas. I didn't fix them to keep the PR as small as possible.