Skip to content

Commit

Permalink
Update sbt 1.5.2 and Scala 3.0.0-RC3 (#169)
Browse files Browse the repository at this point in the history
* Changes for sbt 1.5.2 and Scala 3.0.0-RC3

* Update build for more normal shared source locations

* Update README for release
  • Loading branch information
ekrich authored May 12, 2021
1 parent 8cef835 commit fb075b7
Showing 26 changed files with 39 additions and 20 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ All available versions can be seen at the [Maven Repository](https://mvnreposito
| 2.11.x ||||
| 2.12.x ||||
| 2.13.x ||||
| 3.0.0-RC2 ||| n/a |
| 3.0.0-RC3 ||| n/a |

## Usage and Help
[![Scaladoc](https://www.javadoc.io/badge/org.ekrich/sconfig_2.11.svg?label=scaladoc)](https://www.javadoc.io/doc/org.ekrich/sconfig_2.11)
@@ -60,6 +60,7 @@ For specific changes, refer to the releases below.

## Versions

Release [1.4.3](https://github.com/ekrich/sconfig/releases/tag/v1.4.3) - (2021-05-12)<br/>
Release [1.4.2](https://github.com/ekrich/sconfig/releases/tag/v1.4.2) - (2021-04-01)<br/>
Release [1.4.1](https://github.com/ekrich/sconfig/releases/tag/v1.4.1) - (2021-02-24)<br/>
Release [1.4.0](https://github.com/ekrich/sconfig/releases/tag/v1.4.0) - (2021-01-26)<br/>
53 changes: 37 additions & 16 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -35,12 +35,19 @@ Compile / console / scalacOptions --= Seq(
"-Xfatal-warnings"
)

val isScala3 = Def.setting {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((3, _)) => true
case _ => false
}
}

val scala211 = "2.11.12"
val scala212 = "2.12.13"
val scala213 = "2.13.5"
val scala300 = "3.0.0-RC2"
val scala300 = "3.0.0-RC3"

val javaTime = "1.1.3"
val javaTime = "1.1.4"
val scCompat = "2.4.3"

val versionsBase = Seq(scala211, scala212, scala213)
@@ -101,18 +108,19 @@ lazy val sconfig = crossProject(JVMPlatform, NativePlatform, JSPlatform)
.crossType(CrossType.Full)
.settings(
scalacOptions ++= {
if (isDotty.value) dotcOpts else scalacOpts
if (isScala3.value) dotcOpts else scalacOpts
},
scala2or3Source,
sharedScala2or3Source,
libraryDependencies += ("org.scala-lang.modules" %%% "scala-collection-compat" % scCompat)
)
.jvmSettings(
crossScalaVersions := versionsJVM,
sharedJvmNativeSource,
libraryDependencies ++= Seq(
"io.crashbox" %% "spray-json" % "1.3.5-7" % Test,
"com.novocode" % "junit-interface" % "0.11" % Test
).map(_.withDottyCompat(scalaVersion.value)),
("io.crashbox" %% "spray-json" % "1.3.5-7" % Test)
.cross(CrossVersion.for3Use2_13),
"com.novocode" % "junit-interface" % "0.11" % Test
),
Compile / compile / javacOptions ++= Seq(
"-source",
"1.8",
@@ -157,17 +165,30 @@ lazy val sconfig = crossProject(JVMPlatform, NativePlatform, JSPlatform)
libraryDependencies += "org.ekrich" %%% "sjavatime" % javaTime % "provided"
)

lazy val sharedJvmNativeSource: Seq[Setting[_]] = Def.settings(
Compile / unmanagedSourceDirectories +=
(ThisBuild / baseDirectory).value
/ "sconfig" / "sharedjvmnative" / "src" / "main" / "scala"
lazy val sharedScala2or3Source: Seq[Setting[_]] = Def.settings(
Compile / unmanagedSourceDirectories ++= {
val projectDir = baseDirectory.value.getParentFile()
sourceDir(projectDir, scalaVersion.value)
}
)

lazy val scala2or3Source: Seq[Setting[_]] = Def.settings(
Compile / unmanagedSourceDirectories +=
(ThisBuild / baseDirectory).value
/ "sconfig" / { if (isDotty.value) "sharedScala3" else "sharedScala2" }
/ "src" / "main" / "scala"
// For Scala 2/3 enums
def sourceDir(projectDir: File, scalaVersion: String): Seq[File] = {
def versionDir(versionDir: String): File =
projectDir / "shared" / "src" / "main" / versionDir

CrossVersion.partialVersion(scalaVersion) match {
case Some((3, _)) => Seq(versionDir("scala-3"))
case Some((2, _)) => Seq(versionDir("scala-2"))
case _ => Seq() // unknown version
}
}

lazy val sharedJvmNativeSource: Seq[Setting[_]] = Def.settings(
Compile / unmanagedSourceDirectories += {
val projectDir = baseDirectory.value.getParentFile()
projectDir / "shared" / "src" / "main" / "scala-jvm-native"
}
)

lazy val sconfigJVM = sconfig.jvm
3 changes: 0 additions & 3 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -14,6 +14,3 @@ addSbtPlugin("org.scala-native" % "sbt-scala-native" % scalaNativ
// Scala.js support
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % crossVer)
addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion)

// Dotty - Scala 3
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % "0.5.5")

0 comments on commit fb075b7

Please sign in to comment.