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

All the fancy things you can do with flexible dependency management

All the fancy things you can do with flexible dependency management

New APIs of coursier (high level, Java, sbt)

coursier install and coursier publish commands

Alexandre Archambault

June 13, 2019
Tweet

More Decks by Alexandre Archambault

Other Decks in Programming

Transcript

  1. All the fancy things you can do with flexible dependency

    mgmt Alexandre Archambault @alxarchambault (not a typo) github.com/alexarchambault Scala Center
  2. Plan – New APIs: high-level, Java, sbt API – "Enterprise"

    features (better authentication, mirrors, …) – install command – publish command – Demo!
  3. Purity or getting things done? Both! Pass all the inputs

    explicitly if you want to Get results in an IO Relies on all the defaults Get results or an exception, synchronously
  4. Java API Minimum surface area Even more conservative in terms

    of binary compatibility Shades coursier, scala-library too Goals – Java users? – Lower chances of conflicts (scalafmt- dynamic, Ammonite?, dotty?)
  5. APIs High-level API – Simpler API, closer to the CLI,

    while still retaining purity Java API – Stability, binary compatibility Also – lm-coursier (implementing sbt/library-management)
  6. Rules Enforce constraints Fix them automatically, or fail Available –

    Strict – DontBumpRootDependencies – SameVersion Resolution strategy – Try to fix – Warn – Fail
  7. Reworked authentication Read credentials from file Pass on redirect (or

    not) Restrict to https (default) … For now: applied by host
  8. Motivation Distribute apps just like libraries – No launchers to

    handle / push / distribute / download… – But (slightly) more cumbersome command for end-users
  9. App descriptions – in JSON at specific paths or URLs

    https://github.com/coursier/ apps/blob/extras/apps.json – from "channels" (JAR published on a Maven repository, containing JSON files for multiple apps) Default channel: io.get-coursier:apps, via github.com/coursier/apps
  10. install Installs – JVM apps – scala-native apps (built locally

    from Maven artifacts) – graalvm native image generation Updates – changes in source (JSON) – new artifacts (if latest.* or version interval) Only relies on the coursier cache – no git clone, …
  11. Workflow Build tool writes (all) artifacts to a directory Then

    the publish command takes over, and publishes that
  12. Principle Take one or more "sources" – Think sbt projects,

    existing directories with pre-defined structure, … Transform them – Adjust organization, version, etc. (changes POM files, paths) – Add missing metadata (maven-metadata.xml) – Add missing checksums, signatures – Snapshot versioning Write / push them somewhere – In a local directory, to a remote repository, …