Skip to content

Commit

Permalink
Scala Version Approach (#14)
Browse files Browse the repository at this point in the history
Scala Version Approach
  • Loading branch information
ChristopherDavenport authored Sep 18, 2019
2 parents 6954222 + f20428b commit aa5dec1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 137 deletions.
18 changes: 9 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@ stages:
if: ((branch = master AND type = push) OR (tag IS present)) AND NOT fork


scala_version_212: &scala_version_212 "2.12.10"
scala_version_213: &scala_version_213 "2.13.0"

jobs:
include:
# stage="test" if no stage is specified
- name: test 2.13
scala: 2.13.0
script: sbt ++$TRAVIS_SCALA_VERSION test
-
name: test 2.12
scala: 2.12.8
name: test 2.13
scala: *scala_version_213
script: sbt ++$TRAVIS_SCALA_VERSION test
- name: test 2.11
scala: 2.11.12
- name: test 2.12
scala: *scala_version_212
script: sbt ++$TRAVIS_SCALA_VERSION test
-
name: mima
script: sbt +mimaReportBinaryIssues
-
name: docs
scala: 2.12.8
scala: *scala_version_212
install:
- rvm use 2.6.0 --install --fuzzy
- gem update --system
Expand All @@ -45,7 +45,7 @@ jobs:
script: sbt ci-release
- stage: release
name: microsite
scala: 2.12.8
scala: *scala_version_212
install:
- rvm use 2.6.0 --install --fuzzy
- gem update --system
Expand Down
60 changes: 3 additions & 57 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ lazy val `cats-effect-time` = project.in(file("."))
.aggregate(core)

lazy val core = project.in(file("core"))
.settings(commonSettings, releaseSettings, mimaSettings)
.settings(commonSettings, releaseSettings)
.settings(
name := "cats-effect-time"
)
Expand Down Expand Up @@ -34,8 +34,8 @@ val betterMonadicForV = "0.3.1"
lazy val commonSettings = Seq(
organization := "io.chrisdavenport",

scalaVersion := "2.12.8",
crossScalaVersions := Seq("2.13.0", scalaVersion.value, "2.11.12"),
scalaVersion := "2.13.0",
crossScalaVersions := Seq(scalaVersion.value, "2.12.10"),

scalacOptions in (Compile, doc) ++= Seq(
"-groups",
Expand Down Expand Up @@ -84,60 +84,6 @@ lazy val releaseSettings = {
)
}

lazy val mimaSettings = {

def semverBinCompatVersions(major: Int, minor: Int, patch: Int): Set[(Int, Int, Int)] = {
val majorVersions: List[Int] =
if (major == 0 && minor == 0) List.empty[Int] // If 0.0.x do not check MiMa
else List(major)
val minorVersions : List[Int] =
if (major >= 1) Range(0, minor).inclusive.toList
else List(minor)
def patchVersions(currentMinVersion: Int): List[Int] =
if (minor == 0 && patch == 0) List.empty[Int]
else if (currentMinVersion != minor) List(0)
else Range(0, patch - 1).inclusive.toList

val versions = for {
maj <- majorVersions
min <- minorVersions
pat <- patchVersions(min)
} yield (maj, min, pat)
versions.toSet
}

def mimaVersions(version: String): Set[String] = {
Version(version) match {
case Some(Version(major, Seq(minor, patch), _)) =>
semverBinCompatVersions(major.toInt, minor.toInt, patch.toInt)
.map{case (maj, min, pat) => maj.toString + "." + min.toString + "." + pat.toString}
case _ =>
Set.empty[String]
}
}
// Safety Net For Exclusions
lazy val excludedVersions: Set[String] = Set()

// Safety Net for Inclusions
lazy val extraVersions: Set[String] = Set()

Seq(
mimaFailOnNoPrevious := false,
mimaFailOnProblem := mimaVersions(version.value).toList.headOption.isDefined,
mimaPreviousArtifacts := (mimaVersions(version.value) ++ extraVersions)
.filterNot(excludedVersions.contains(_))
.map{v =>
val moduleN = moduleName.value + "_" + scalaBinaryVersion.value.toString
organization.value % moduleN % v
},
mimaBinaryIssueFilters ++= {
import com.typesafe.tools.mima.core._
import com.typesafe.tools.mima.core.ProblemFilters._
Seq()
}
)
}

lazy val micrositeSettings = {
import microsites._
Seq(
Expand Down
71 changes: 0 additions & 71 deletions project/Version.scala

This file was deleted.

1 change: 1 addition & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ addSbtPlugin("com.47deg" % "sbt-microsites" % "0.9.4")
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.6.1")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.29")
addSbtPlugin("io.chrisdavenport" % "sbt-mima-version-check" % "0.1.0")

0 comments on commit aa5dec1

Please sign in to comment.