Skip to content

Commit

Permalink
Update Scala Native to 0.5 and drop Scala 2.11 (#1358)
Browse files Browse the repository at this point in the history
  • Loading branch information
joroKr21 authored May 15, 2024
1 parent 332b465 commit 7f7601c
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 66 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest]
scala: [2.11.12, 2.12.17, 2.13.11]
scala: [2.12.19, 2.13.14]
java: [temurin@8]
platform: [jvm, js, native]
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -77,7 +77,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
scala: [2.13.11]
scala: [2.13.14]
java: [temurin@8]
runs-on: ${{ matrix.os }}
steps:
Expand Down
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,20 +120,20 @@ resolvers ++= Seq(
[ci]: https://travis-ci.org/milessabin/shapeless


Builds are available for Scala 2.11.x, 2.12.x and 2.13.x. The main line of development for
shapeless 2.3.3 is Scala 2.13.2.
Builds are available for Scala 2.12 and 2.13.
The main line of development for shapeless 2.3.x is Scala 2.13.

```scala
scalaVersion := "2.13.5"
scalaVersion := "2.13.14"

libraryDependencies ++= Seq(
"com.chuusai" %% "shapeless" % "2.3.3"
"com.chuusai" %% "shapeless" % "2.3.11"
)
```

For using snapshots of Shapeless you should add,
```scala
scalaVersion := "2.13.5"
scalaVersion := "2.13.14"

libraryDependencies ++= Seq(
"com.chuusai" %% "shapeless" % "2.4.0-SNAPSHOT"
Expand Down Expand Up @@ -163,8 +163,7 @@ releases][olderusage] on the shapeless wiki.

## Building shapeless

shapeless is built with SBT 1.3.10 or later, and its main branch is built with Scala 2.13.2 by default but also
cross-builds for 2.11.12 and 2.12.12.
shapeless is built with SBT 1.x and its main branch is built with Scala 2.13 by default but also cross-builds for 2.12.

[namehashing]: https://github.com/sbt/sbt/issues/1640

Expand Down
20 changes: 4 additions & 16 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,16 @@ import com.typesafe.tools.mima.core.*
import sbtcrossproject.CrossPlugin.autoImport.crossProject
import sbtcrossproject.CrossProject

val Scala211 = "2.11.12"
val Scala212 = "2.12.17"
val Scala213 = "2.13.11"
val Scala212 = "2.12.19"
val Scala213 = "2.13.14"

commonSettings
noPublishSettings
crossScalaVersions := Nil

ThisBuild / organization := "com.chuusai"
ThisBuild / scalaVersion := Scala213
ThisBuild / crossScalaVersions := Seq(Scala211, Scala212, Scala213)
ThisBuild / crossScalaVersions := Seq(Scala212, Scala213)
ThisBuild / mimaFailOnNoPrevious := false
ThisBuild / versionScheme := Some("pvp")

Expand Down Expand Up @@ -193,7 +192,7 @@ lazy val examples = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.configureCross(configureJUnit)
.dependsOn(core)
.settings(moduleName := "examples")
.settings(libraryDependencies += "org.scala-lang.modules" %%% "scala-parser-combinators" % "2.2.0")
.settings(libraryDependencies += "org.scala-lang.modules" %%% "scala-parser-combinators" % "2.4.0")
.settings(runAllIn(Compile))
.settings(commonSettings)
.settings(noPublishSettings)
Expand Down Expand Up @@ -248,17 +247,6 @@ lazy val mimaSettings = Seq(
ProblemFilters.exclude[DirectMissingMethodProblem]("shapeless.package.macrocompat"),
// inaccessible interface change
ProblemFilters.exclude[MissingClassProblem]("shapeless.CaseClassMacros$PatchedContext$2$PatchedLookupResult"),
// methods added to traits (not binary compatible on Scala 2.11)
ProblemFilters.exclude[ReversedMissingMethodProblem]("shapeless.LowPriorityUnaryTCConstraint.hnilUnaryTC"),
ProblemFilters.exclude[ReversedMissingMethodProblem]("shapeless.SingletonTypeUtils.isSymbolLiteral"),
ProblemFilters.exclude[ReversedMissingMethodProblem]("shapeless.CaseClassMacros.mkAttributedRef"),
ProblemFilters.exclude[ReversedMissingMethodProblem]("shapeless.CaseClassMacros.numNonCaseParamLists"),
ProblemFilters.exclude[ReversedMissingMethodProblem]("shapeless.ReprTypes.objectRef"),
ProblemFilters.exclude[ReversedMissingMethodProblem]("shapeless.IsCons1Macros.mkPackUnpack"),
ProblemFilters.exclude[InheritedNewAbstractMethodProblem]("shapeless.CaseClassMacros.varargTpt"),
ProblemFilters.exclude[InheritedNewAbstractMethodProblem]("shapeless.CaseClassMacros.varargTC"),
ProblemFilters.exclude[InheritedNewAbstractMethodProblem]("shapeless.IsCons1Macros.varargTpt"),
ProblemFilters.exclude[InheritedNewAbstractMethodProblem]("shapeless.IsCons1Macros.varargTC")
)
)

Expand Down
23 changes: 23 additions & 0 deletions core/shared/src/test/scala/shapeless/generic.scala
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,16 @@ package GenericTestsAux {
@generateGeneric
object A
}

case class WrongApplySignature private(value: String)
object WrongApplySignature {
def apply(v: String): Either[String, WrongApplySignature] = scala.Left("No ways")
}

case class CCWithCustomUnapply(x: Int, y: String)
object CCWithCustomUnapply {
def unapply(cc: CCWithCustomUnapply): Option[(Int, String, String)] = None
}
}

class GenericTests {
Expand Down Expand Up @@ -878,6 +888,19 @@ class GenericTests {
assertEquals(Priv("secret"), gen.from(Inl(Priv("secret"))))
assertEquals(Inl(Priv("secret")), gen.to(Priv("secret")))
}

@Test
def testCCWithCustomUnapply(): Unit = {
illTyped("Generic[WrongApplySignature]")
val cc = CCWithCustomUnapply(23, "foo")
val gen = Generic[CCWithCustomUnapply]
val r = gen.to(cc)
val f = gen.from(13 :: "bar" :: HNil)
assertTypedEquals[Int :: String :: HNil](23 :: "foo" :: HNil, r)
typed[CCWithCustomUnapply](f)
assertEquals(13, f.x)
assertEquals("bar", f.y)
}
}

package GenericTestsAux2 {
Expand Down
37 changes: 0 additions & 37 deletions core/shared/src/test/scala_2.13+/shapeless/GenericTests213.scala

This file was deleted.

2 changes: 1 addition & 1 deletion project/Boilerplate.scala
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ object Boilerplate {
val `a:T..n:T` = synVals.map(_ + ":T").mkString(", ")
val commonImplicits = "factory: Factory[T, CC[T]], ev: AdditiveCollection[CC[T]]"
val implicits = scalaBinaryVersion match {
case "2.11" | "2.12" => commonImplicits
case "2.12" => commonImplicits
case _ => s"dis: DefaultToIndexedSeq[CC], $commonImplicits"
}

Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.9.9
sbt.version=1.10.0
4 changes: 2 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ addSbtPlugin("com.typesafe.sbt" % "sbt-osgi" % "0.
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.12.0")
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.7")
addSbtPlugin("com.thoughtworks.sbt-api-mappings" % "sbt-api-mappings" % "3.0.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.16.0")
addSbtPlugin("org.scala-native" % "sbt-scala-native" % "0.5.1")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "1.3.2")
addSbtPlugin("org.portable-scala" % "sbt-scala-native-crossproject" % "1.3.2")
addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.14.2")

0 comments on commit 7f7601c

Please sign in to comment.