All Projects → scalacenter → sbt-eviction-rules

scalacenter / sbt-eviction-rules

Licence: Apache-2.0 license
An sbt plugin enhancing the evicted key.

Programming Languages

scala
5932 projects

Projects that are alternatives of or similar to sbt-eviction-rules

Ensime Sbt
Generates .ensime config files for SBT projects
Stars: ✭ 244 (+1120%)
Mutual labels:  sbt
sliding-puzzle
Sliding puzzle game implemented in Scala / Scala.js / JavaFX
Stars: ✭ 25 (+25%)
Mutual labels:  sbt
cassandra-phantom
Cassandra + Phantom Example
Stars: ✭ 64 (+220%)
Mutual labels:  sbt
sbt-ghpages
git, site and ghpages support for sbt projects.
Stars: ✭ 94 (+370%)
Mutual labels:  sbt
outwatch
The Functional and Reactive Web-Frontend Library for Scala.js
Stars: ✭ 444 (+2120%)
Mutual labels:  sbt
akka-http-docker-sample
example of running an Sbt application in Docker based on openjdk:jre-alpine
Stars: ✭ 20 (+0%)
Mutual labels:  sbt
Sbt Fresh
sbt-plugin to create an opinionated fresh sbt project
Stars: ✭ 229 (+1045%)
Mutual labels:  sbt
gatling-sbt-plugin
Gatling Plugin for SBT
Stars: ✭ 105 (+425%)
Mutual labels:  sbt
sbt-sass
A fork of the sbt-sass repository which seems to be abandoned.
Stars: ✭ 32 (+60%)
Mutual labels:  sbt
weui-scalajs
write WeApp with scalajs
Stars: ✭ 18 (-10%)
Mutual labels:  sbt
sbt-babel
An SBT plugin to perform Babel compilation.
Stars: ✭ 12 (-40%)
Mutual labels:  sbt
sbt-avro
Plugin SBT to Generate Scala classes from Apache Avro schemas hosted on a remote Confluent Schema Registry.
Stars: ✭ 15 (-25%)
Mutual labels:  sbt
sbt-graphql
SBT plugin to generate and validate graphql schemas written with Sangria
Stars: ✭ 94 (+370%)
Mutual labels:  sbt
Zinc
Scala incremental compiler library, originally part of sbt
Stars: ✭ 246 (+1130%)
Mutual labels:  sbt
sbt-findbugs
FindBugs static analysis plugin for sbt.
Stars: ✭ 47 (+135%)
Mutual labels:  sbt
Sbt Dynver
An sbt plugin to dynamically set your version from git
Stars: ✭ 243 (+1115%)
Mutual labels:  sbt
Converter
Typescript to Scala.js converter
Stars: ✭ 168 (+740%)
Mutual labels:  sbt
sbt-swagger-2
sbt plugin for generating Swagger JSON schemas during build
Stars: ✭ 13 (-35%)
Mutual labels:  sbt
typelevel-stack.g8
📚 Unofficial Giter8 template for the Typelevel Stack (Http4s / Doobie / Circe / Cats Effect / Fs2) based on Cats v1.x.x
Stars: ✭ 63 (+215%)
Mutual labels:  sbt
scalarr
A command-line client for Sonarr, written in Scala
Stars: ✭ 33 (+65%)
Mutual labels:  sbt

Note: this project is in maintenance mode because sbt 1.5.0 provides equivalent features. See sbt/sbt#6221 for more details.

You can still use the version 1.0.0-RC1 of this plugin in case you are stuck with an old version of sbt.

sbt-eviction-rules

An sbt plugin enhancing the evicted task.

This plugin:

  1. makes the output of evicted slightly more readable
  2. allows you to easily run eviction checks on your CI
  3. allows you to more easily configure evictions that can be ignored (to avoid false positive warnings).

Note: sbt has been gradually providing these features. As of sbt 1.5.0, all of the features of this plugin are now supported by sbt out of the box. Nevertheless, this plugin can be useful if you are stuck with an old version of sbt.

Installation

Add to project/plugins.sbt:

addSbtPlugin("ch.epfl.scala" % "sbt-eviction-rules" % "1.0.0-RC1")

The latest version is Maven Central.

Usage

The plugin provides the following tasks.

evictionWarnings

Unlike the default evicted task, the evctionWarnings task reports only problematic evictions (ie, libraries that have been evicted by binary incompatible versions):

> evictionWarnings
[warn] Found eviction warnings in b:
[warn] Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:
[warn]
[warn] 	* org.scala-lang.modules:scala-xml_2.12:1.2.0 is selected over {1.0.6, 1.0.6}
[warn] 	    +- eu.timepit:refined_2.12:0.9.12                     (depends on 1.2.0)
[warn] ct    +- org.scala-lang:scala-compiler:2.12.11              (depends on 1.0.6)
[warn] Found eviction warnings in a:
[warn] Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:
[warn]
[warn] 	* org.scala-lang.modules:scala-xml_2.12:1.2.0 is selected over {1.0.6, 1.0.6}
[warn] 	    +- eu.timepit:refined_2.12:0.9.12                     (depends on 1.2.0)
[warn] 	    +- org.scala-lang:scala-compiler:2.12.11              (depends on 1.0.6)
[success] Total time: 1 s, completed jun 4 2020 16:05:22

evictionCheck

This task turns the eviction warnings into errors. It succeeds only if there are no eviction warnings in your build.

You typically want to invoke this task in your CI, to make sure that no pull requests introduce eviction warnings.

evicted

The built-in evicted task is overridden to provide a more readable output. It prints which of your projects each printed eviction comes from:

> evicted
[warn] Found eviction warnings in b:
[warn] Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:
[warn]
[warn] 	* org.scala-lang.modules:scala-xml_2.12:1.2.0 is selected over {1.0.6, 1.0.6}
[warn] 	    +- eu.timepit:refined_2.12:0.9.12                     (depends on 1.2.0)
[warn] ct    +- org.scala-lang:scala-compiler:2.12.11              (depends on 1.0.6)
[warn] Found eviction warnings in a:
[warn] Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:
[warn]
[warn] 	* org.scala-lang.modules:scala-xml_2.12:1.2.0 is selected over {1.0.6, 1.0.6}
[warn] 	    +- eu.timepit:refined_2.12:0.9.12                     (depends on 1.2.0)
[warn] 	    +- org.scala-lang:scala-compiler:2.12.11              (depends on 1.0.6)
[info] Found non problematic eviction(s) in c:
[info] Here are other dependency conflicts that were resolved:
[info]
[info] 	* org.scala-lang.modules:scala-xml_2.12:1.2.0 is selected over {1.0.6, 1.0.6}
[info] 	    +- eu.timepit:refined_2.12:0.9.12                     (depends on 1.2.0)
[info] 	    +- org.scala-lang:scala-compiler:2.12.11              (depends on 1.0.6)
[success] Total time: 1 s, completed jun 4 2020 15:54:04

Configuration

The recommended versioning scheme in the Scala ecosystem is a (stricter) variant of Semantic Versioning, but not all libraries follow this versioning scheme.

You can configure which versioning scheme is used by which library by using the evictionRules setting:

evictionRules += "org.scala-lang.modules" %% "scala-xml" % "semver-spec"

This specifies that "org.scala-lang.modules" %% "scala-xml" follows semantic versioning, so that it's fine if version 1.2.0 is selected where 1.0.6 is expected (ie, no evictions will be reported).

The following compatibility types are available:

  • early-semver: assumes the matched modules follow a variant of Semantic Versioning that guarantees backward binary compatibility between minor releases (e.g., 1.1.1 and 1.2.0), and between patch releases if the major version number is 0 (e.g., 0.7.2 and 0.7.3).
  • semver-spec: assumes the matched modules follow Semantic Versioning, which guarantees backward binary compatibility between minor releases (e.g., 1.1.1 and 1.2.0), but does not guarantee any compatibility between patch releases if the major version number is 0 (e.g., 0.7.2 and 0.7.3).
  • pvp: assumes the matched modules follow package versioning policy (quite common in Scala),
  • always: assumes all versions of the matched modules are compatible with each other,
  • strict: requires exact matches between the wanted and the selected versions of the matched modules.

Note that starting with sbt 1.4.x, libraries can embed the versioning scheme they use in their artifacts metadata, making the evictionRules setting unnecessary. This setting is still useful during the transition period.

Module patterns

evictionRules accepts * as organization or module name, or as parts of them, to match several modules at once:

evictionRules += "io.get-coursier" %% "*" % "pvp"
evictionRules += "org.typelevel" %% "cats-*" % "semver-spec"

About the default eviction rules in sbt

By default, sbt assumes that

If any eviction brings an incompatible version per those defaults, sbt warns about it in update and gives more details in evicted.

sbt-eviction-rules then allows you to remove false warnings if you know that a library follows another versioning scheme than PVP.

Note that there can be slight discrepancies between the checks performed by evictionRules and those performed by default by sbt: the checks done by evictionRules are handled by the coursier versions library, while those of sbt are handled by the sbt/librarymanagement library.

Acknowledgments

sbt-eviction-rules is funded by the Scala Center.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].