Skip to content

Commit

Permalink
Remove Scala 2.11 support
Browse files Browse the repository at this point in the history
  • Loading branch information
guizmaii committed Aug 10, 2023
1 parent 1f3c53e commit 0c5863e
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 94 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/ci.yml
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 All @@ -137,7 +134,7 @@ jobs:
strategy:
fail-fast: false
matrix:
java: ['8', '11']
java: ['8', '11', '17']
platform: ['JVM']
steps:
- name: Checkout current branch
Expand Down
12 changes: 2 additions & 10 deletions build.sbt
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,8 +211,8 @@ 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 _ =>
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
Expand Up @@ -68,7 +68,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 +80,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 +109,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 macros/shared/src/main/scala-2/zio/prelude/Liftables.scala
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
42 changes: 12 additions & 30 deletions project/BuildHelper.scala
@@ -1,14 +1,13 @@
import explicitdeps.ExplicitDepsPlugin.autoImport._
import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport._
import sbt._
import sbt.Keys._
import sbtbuildinfo._
import sbtbuildinfo.BuildInfoKeys._
import sbtcrossproject.CrossPlugin.autoImport._
import scalafix.sbt.ScalafixPlugin.autoImport._
import explicitdeps.ExplicitDepsPlugin.autoImport.*
import org.portablescala.sbtplatformdeps.PlatformDepsPlugin.autoImport.*
import sbt.*
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.18"
val Scala213: String = "2.13.11"
val Scala3: String = "3.3.0"
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")
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

0 comments on commit 0c5863e

Please sign in to comment.