Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Reproducible environments for Scala using coursier

Reproducible environments for Scala using coursier

Scala.Love in the City 2021
2021/02/13

Alexandre Archambault

February 13, 2021
Tweet

More Decks by Alexandre Archambault

Other Decks in Programming

Transcript

  1. get-coursier.io Used by sbt, mill, bazel, … almond.sh Contributor -

    shapeless - Ammonite Other projects - plotly-scala - case-app - … alexarchambault.github.io github.com/alexarchambault
  2. cs native-image No dependencies (almost) One command or one click

    to install it curl -fLo cs https://git.io/coursier-cli-"$(uname | tr LD ld)" && chmod +x cs All GraalVM platforms: x86_64: win / mac / linux, arm64: linux get-coursier.io > Install CLI
  3. cs Low level: org:name:X.Y.Z cs complete cs resolve cs fetch

    cs launch High level: applications, JVMs cs install cs java cs setup get-coursier.io/docs/cli-overview
  4. cs cs launch ammonite --jvm 11 – Ammonite version? –

    JVM version? – Scala version? – coursier channel / JVM index? cs launch ammonite:2.3.8 --jvm adopt:1.11.0-9 – How can we check if it's enough?
  5. coursier internals cache: Artifact => F[String] case class Artifact(url: String,

    changing: Boolean) Maven Central: artifacts are immutable – https://repo1.maven.org/maven2/org/scala-lang/scala-library/ 2.13.4/scala-library-2.13.4.pom as input -> always same String as output – Artifact => F[String] becomes pure function, but for the time delay (F[_])
  6. coursier internals But some artifacts do change, even on Maven

    Central – Snapshots – Version listings: https://repo1.maven.org/maven2/org/scala-lang/ scala-library/maven-metadata.xml case class Artifact(url: String, changing: Boolean) Two different ways of handling artifacts – immutable ones (good for reproducibility) – changing ones (bad for reproducibility): TTL, …
  7. Limitations Other sources of non-reproducibility – coursier version – OS

    – JVM cache :| Quite a bit of guesswork, to know the options to pass to lock everything You can help
  8. cs If you are interested in funding that effort, as

    a company, contact me. alexarchambault.github.io/proposals/coursier-reproducible- environments.html