Skip to content

Commit

Permalink
scala 3 migration (build-related parts)
Browse files Browse the repository at this point in the history
  • Loading branch information
anthony-cros committed Feb 8, 2024
1 parent 89731bc commit 5e0c1ac
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 53 deletions.
32 changes: 21 additions & 11 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,18 +1,28 @@
// gallia-avro

// ===========================================================================
ThisBuild / organizationName := "Gallia Project"
ThisBuild / organization := "io.github.galliaproject" // *must* match groupId for sonatype
ThisBuild / organizationHomepage := Some(url("https://github.com/galliaproject"))
ThisBuild / startYear := Some(2021)
ThisBuild / version := "0.6.0-SNAPSHOT"
ThisBuild / description := "A Scala library for data manipulation"
ThisBuild / homepage := Some(url("https://github.com/galliaproject/gallia-avro"))
ThisBuild / licenses := Seq("Apache 2" -> url("https://github.com/galliaproject/gallia-avro/blob/master/LICENSE"))
ThisBuild / developers := List(Developer(
id = "anthony-cros",
name = "Anthony Cros",
email = "[email protected]",
url = url("https://github.com/anthony-cros")))
ThisBuild / scmInfo := Some(ScmInfo(
browseUrl = url("https://github.com/galliaproject/gallia-core"),
connection = "scm:[email protected]:galliaproject/gallia-core.git"))

// ===========================================================================
lazy val root = (project in file("."))
.settings(
organizationName := "Gallia Project",
organization := "io.github.galliaproject", // *must* match groupId for sonatype
name := "gallia-avro",
version := GalliaCommonSettings.CurrentGalliaVersion,
homepage := Some(url("https://github.com/galliaproject/gallia-avro")),
scmInfo := Some(ScmInfo(
browseUrl = url("https://github.com/galliaproject/gallia-avro"),
connection = "scm:[email protected]:galliaproject/gallia-avro.git")),
licenses := Seq("Apache 2" -> url("https://github.com/galliaproject/gallia-avro/blob/master/LICENSE")),
description := "A Scala library for data manipulation" )
name := "gallia-avro",
target := baseDirectory.value / "bin" / "avro")
.settings(GalliaCommonSettings.mainSettings:_*)

// ===========================================================================
Expand All @@ -21,7 +31,7 @@ lazy val slf4jVersion = "1.7.36"

// ---------------------------------------------------------------------------
libraryDependencies ++= Seq(
"io.github.galliaproject" %% "gallia-core" % GalliaCommonSettings.CurrentGalliaVersion,
"io.github.galliaproject" %% "gallia-core" % version.value,
"org.slf4j" % "slf4j-nop" % slf4jVersion,
"org.apache.avro" % "avro" % avroVersion,
"org.apache.avro" % "avro-compiler" % avroVersion /* just to deserialize IDL (as opposed to JSON)... */) // any way to serialize IDL (t220224102703)?
Expand Down
36 changes: 10 additions & 26 deletions project/GalliaCommonSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,19 @@ import sbt.Keys._

// ===========================================================================
object GalliaCommonSettings {
val CurrentGalliaVersion = "0.5.0"

val scala3 = "3.3.1"
val scala213 = "2.13.12"
val scala212 = "2.12.18"

// ---------------------------------------------------------------------------
val mainSettings = Seq(
organizationHomepage := Some(url("https://github.com/galliaproject")),
startYear := Some(2021),
developers :=
List(Developer(
id = "anthony-cros",
name = "Anthony Cros",
email = "[email protected]",
url = url("https://github.com/anthony-cros") )),

scalaVersion := scala3,
crossScalaVersions := List(scala3, scala213, scala212),
// ---------------------------------------------------------------------------
scalaVersion := GalliaScalaVersions.supported.head,
crossScalaVersions := GalliaScalaVersions.supported)

// ===========================================================================
// TODO: t210121165741: -Xdisable-assertions (also turns off require?)
scalacOptions ++= Seq(
"-encoding", "UTF-8",
//"-Yimports:java.lang,scala,scala.Predef,scala.util.chaining,aptus.Anything_" -- not possible for 2.12 it seems (TODO: t210308154253 confirm)
"-Ywarn-value-discard") ++
// ---------------------------------------------------------------------------
(scalaBinaryVersion.value match {
case "2.13" => Seq("-Ywarn-unused:imports")
case _ => Seq("-Ywarn-unused-import" ) })

}
scalacOptions ++= (scalaBinaryVersion.value match {
case "3" => GalliaScalacOptions.scala3Options
case "2.13" => GalliaScalacOptions.scala213Options
case "2.12" => GalliaScalacOptions.scala212Options })) }

// ===========================================================================

15 changes: 0 additions & 15 deletions project/GalliaScalaVersions.scala

This file was deleted.

27 changes: 27 additions & 0 deletions project/GalliaScalacOptions.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// ===========================================================================
object GalliaScalacOptions {

val commonOptions = Seq(
"-encoding", "UTF-8",
"-feature",
"-unchecked",
"-deprecation",

"-language:implicitConversions")

// ===========================================================================
val commonOptionsExcept212 = Seq(
"-Wunused:implicits",
"-Wunused:explicits",
"-Wunused:imports",
"-Wunused:locals",
"-Wunused:params",
"-Wunused:privates")

// ===========================================================================
val scala3Options = commonOptions ++ commonOptionsExcept212 ++ Seq("-no-indent", "-Wvalue-discard")
val scala213Options = commonOptions ++ commonOptionsExcept212 ++ Seq("-Wdead-code", "-Ywarn-value-discard")
val scala212Options = commonOptions ++ Seq( "-Ywarn-value-discard", "-Ywarn-unused-import" ) }

// ===========================================================================

2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.5.2
sbt.version=1.9.0

0 comments on commit 5e0c1ac

Please sign in to comment.