Skip to content
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

Give some love to the project #1175

Merged
merged 12 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 1 addition & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
strategy:
fail-fast: false
matrix:
scala: ['2.11.*', '2.12.*', '2.13.*', '3.*']
scala: ['2.12.*', '2.13.*', '3.*']
java: ['17']
platform: ['JVM']
steps:
Expand All @@ -118,9 +118,6 @@ jobs:
uses: pierotofy/set-swap-space@master
with:
swap-size-gb: 7
- name: tests 2.11
if: ${{ startsWith(matrix.scala, '2.11.') }}
run: free --si -tmws 10 & ./sbt ++${{ matrix.scala }} root211/test
- name: tests 2.12
if: ${{ startsWith(matrix.scala, '2.12.') }}
run: free --si -tmws 10 & ./sbt ++${{ matrix.scala }} root212/test
Expand Down
16 changes: 4 additions & 12 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ addCommandAlias(
";coreTestsNative/test;experimentalTestsNative/test" // `test` currently executes only compilation, see `nativeSettings` in `BuildHelper`
)

val zioVersion = "2.0.10"
val zioVersion = "2.0.15"

val projectsCommon = List(
core,
Expand Down Expand Up @@ -70,12 +70,6 @@ lazy val rootNative = project
.settings(publish / skip := true)
.aggregate(projectsCommon.map(_.native: ProjectReference): _*)

lazy val root211 = project
.in(file("target/root211"))
.settings(publish / skip := true)
.aggregate(projectsCommon.map(_.jvm: ProjectReference): _*)
.aggregate(scalaParallelCollections)

lazy val root212 = project
.in(file("target/root212"))
.settings(publish / skip := true)
Expand Down Expand Up @@ -217,10 +211,10 @@ lazy val scalaParallelCollections = project
.settings(
libraryDependencies ++= {
scalaVersion.value match {
// Only 2.11 and 2.12 standard library contains Parallel Scala collections
case BuildHelper.Scala211 | BuildHelper.Scala212 =>
// Only 2.12 standard library contains Parallel Scala collections
case BuildHelper.Scala212 =>
List()
case _ =>
case _ =>
List("org.scala-lang.modules" %% "scala-parallel-collections" % "1.0.4")
}
}
Expand All @@ -233,7 +227,6 @@ lazy val benchmarks = project
.in(file("benchmarks"))
.settings(stdSettings("zio-prelude-benchmarks"))
.settings(
crossScalaVersions --= List(BuildHelper.Scala211),
publish / skip := true,
scalacOptions -= "-Yno-imports",
scalacOptions -= "-Xfatal-warnings",
Expand All @@ -252,7 +245,6 @@ lazy val docs = project
scalacOptions -= "-Yno-imports",
scalacOptions -= "-Xfatal-warnings",
scalaVersion := Scala213,
crossScalaVersions -= Scala211,
projectName := "ZIO Prelude",
mainModuleName := (core.jvm / moduleName).value,
projectStage := ProjectStage.ProductionReady,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import zio.prelude.NewtypeSpecTypes._
import zio.prelude.laws.{isFailureV, isSuccessV}
import zio.prelude.newtypes.{And, Or, Sum}
import zio.test.Assertion._
import zio.test.TestAspect._
import zio.test.{Assertion => TestAssertion, _}

import scala.reflect.ClassTag
Expand Down Expand Up @@ -68,7 +67,7 @@ object NewtypeSpec extends ZIOBaseSpec {
),
test("classtag reports same runtimeclass as underlying primitive") {
assert(implicitly[ClassTag[LuckyNumber]].runtimeClass eq implicitly[ClassTag[Double]].runtimeClass)(isTrue)
} @@ exceptScala211,
},
test("allows creating subtypes of newtypes") {
val compile = typeCheck {
"""import java.util.UUID
Expand All @@ -80,7 +79,7 @@ object NewtypeSpec extends ZIOBaseSpec {
"""
}
assertZIO(compile)(isRight)
} @@ TestAspect.exceptScala211,
},
test("allows creating arrays of newtypes") {
val data = Array.fill(2)(Natural(0))
data(1) = Natural(1)
Expand Down Expand Up @@ -109,7 +108,7 @@ object NewtypeSpec extends ZIOBaseSpec {
),
test("classtag reports same runtimeclass as underlying primitive") {
assert(implicitly[ClassTag[Natural]].runtimeClass eq implicitly[ClassTag[Int]].runtimeClass)(isTrue)
} @@ exceptScala211,
},
test("pattern matching") {
val number = Natural(2)
assertTrue(
Expand Down

This file was deleted.

21 changes: 0 additions & 21 deletions core/shared/src/main/scala-2.11/zio/prelude/Subtype.scala

This file was deleted.

4 changes: 2 additions & 2 deletions core/shared/src/main/scala/zio/prelude/Equal.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package zio.prelude

import zio.Exit.{Failure, Success}
import zio.prelude.coherent.{HashOrd, HashPartialOrd}
import zio.{Cause, Chunk, Duration => ZIODuration, Exit, FiberId, NonEmptyChunk, StackTrace}
import zio.{Cause, Chunk, Exit, FiberId, NonEmptyChunk, StackTrace, Duration => ZIODuration}

import scala.annotation.implicitNotFound
import scala.concurrent.duration.{Duration => ScalaDuration}
Expand Down Expand Up @@ -863,7 +863,7 @@ object Equal extends EqualVersionSpecific {
* Since there is only one `Unit` value all equality comparisons will always be true.
*/
implicit val UnitHashOrd: Hash[Unit] with Ord[Unit] =
HashOrd.make(_.hashCode, (_, _) => Ordering.Equals, (_, _) => true)
HashOrd.make(_ => 0, (_, _) => Ordering.Equals, (_, _) => true)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We definitely wan to behave like hashCode.


/**
* Derives an `Equal[Vector[A]]` given an `Equal[A]`.
Expand Down
4 changes: 2 additions & 2 deletions macros/shared/src/main/scala-2/zio/prelude/Liftables.scala
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,14 @@ trait Liftables {
}

/**
* This Ordering instance exists for compatibility between 2.11, 2.12 and 2.13.
* This Ordering instance exists for compatibility between 2.12 and 2.13.
*/
object DoubleOrdering extends Ordering[Double] {
def compare(x: Double, y: Double): Int = java.lang.Double.compare(x, y)
}

/**
* This Ordering instance exists for compatibility between 2.11, 2.12 and 2.13.
* This Ordering instance exists for compatibility between 2.12 and 2.13.
*/
object FloatOrdering extends Ordering[Float] {
def compare(x: Float, y: Float): Int = java.lang.Float.compare(x, y)
Expand Down
36 changes: 9 additions & 27 deletions project/BuildHelper.scala
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import explicitdeps.ExplicitDepsPlugin.autoImport._
import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport._
import sbt.Keys._
import sbt._
import sbtbuildinfo.BuildInfoKeys._
import sbt.Keys._
import sbtbuildinfo._
import sbtbuildinfo.BuildInfoKeys._
import sbtcrossproject.CrossPlugin.autoImport._
import scalafix.sbt.ScalafixPlugin.autoImport._

object BuildHelper {
val Scala211: String = "2.11.12"
val Scala212: String = "2.12.17"
val Scala213: String = "2.13.10"
val Scala3: String = "3.2.2"
val Scala212: String = "2.12.18"
val Scala213: String = "2.13.11"
val Scala3: String = "3.3.0"

val SilencerVersion = "1.7.13"

Expand Down Expand Up @@ -139,21 +138,6 @@ object BuildHelper {
"-Xmax-classfile-name",
"242"
) ++ std2xOptions ++ optimizerOptions(optimize)
case Some((2, 11)) =>
Seq(
"-Ypartial-unification",
"-Yno-adapted-args",
"-Ywarn-inaccessible",
"-Ywarn-infer-any",
"-Ywarn-nullary-override",
"-Ywarn-nullary-unit",
"-Xexperimental",
"-Ywarn-unused-import",
"-Xfuture",
"-Xsource:2.13",
"-Xmax-classfile-name",
"242"
) ++ std2xOptions
case _ => Seq.empty
}

Expand All @@ -166,14 +150,12 @@ object BuildHelper {

def crossPlatformSources(scalaVer: String, platform: String, conf: String, baseDir: File) = {
val versions = CrossVersion.partialVersion(scalaVer) match {
case Some((2, 11)) =>
List("2.11+", "2.11-2.12")
case Some((2, 12)) =>
List("2.11+", "2.12+", "2.11-2.12", "2.12-2.13")
List("2.12", "2.12+", "2.12-2.13")
Copy link
Member Author

@guizmaii guizmaii Aug 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2.12 is still used for https://github.com/zio/zio-prelude/pull/1175/files#diff-be30bee277855f18960ddd438b1594a798cbaf405b6e0ab9d4d7eccf3d965638

This class was in 2.11-2.12. I transferred it to this 2.12 directory.
It may not be the best decision.
I decided to do this so I'm sure not to change the behaviour.

case Some((2, 13)) =>
List("2.11+", "2.12+", "2.13+", "2.12-2.13")
List("2.12+", "2.13+", "2.12-2.13")
case Some((3, _)) =>
List("2.11+", "2.12+", "2.13+")
List("2.12+", "2.13+")
case _ =>
List()
}
Expand Down Expand Up @@ -201,7 +183,7 @@ object BuildHelper {

def stdSettings(prjName: String) = Seq(
name := s"$prjName",
crossScalaVersions := Seq(Scala211, Scala212, Scala213, Scala3),
crossScalaVersions := Seq(Scala212, Scala213, Scala3),
ThisBuild / scalaVersion := Scala213,
scalacOptions ++= stdOptions ++ extraOptions(scalaVersion.value, optimize = !isSnapshot.value),
libraryDependencies ++= {
Expand Down
4 changes: 2 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ addSbtPlugin("com.typesafe" % "sbt-mima-plugin"
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.10.0")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.12.0")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.9")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.13.2")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.4.14")
addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.3.7")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.0")
addSbtPlugin("pl.project13.scala" % "sbt-jcstress" % "0.2.0")
Expand Down