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

Jbuilder presentation at Docker Cambridge

Jbuilder presentation at Docker Cambridge

Presentation on jbuilder given at Docker offices in Cambridge.

Jbuilder is a build system for OCaml developed at Jane Street. It solves many common problems faced by OCaml developers in general and makes the whole experience of developing and maintaining OCaml projects smoother.

Avatar for Jérémie Dimino

Jérémie Dimino

May 25, 2017
Tweet

Other Decks in Programming

Transcript

  1. At Jane Street • Monolithic repository • Continuous release process

    • Almost no versioning story • Mostly in-house tooling (jenga, iron, hydra, …)
  2. Open Source World • Many small repositories maintained by various

    entities • Stable releases / development repositories • Complex version constraints • oasis, ocamlfind, ocamlbuild, make, opam…
  3. History • Releasing packages for about 5 years • from

    1 package to ~100 • Becoming more and more important
  4. Step 2: setup repos • LICENSE.txt • _oasis, setup.ml •

    myocamlbuild.ml, _tags • META • install.ml • opam
  5. Complex process • Requires lots of manual adjustments • Code

    doesn’t always build with ocamlbuild • Hard to debug errors • Just too much tooling and layers for something that is now simple
  6. Jenga • Full featured build system • Scale to huge

    repositories • Support polling builds • Knows how to talk to Emacs
  7. Jane Street setup • Build system admins maintain the Jenga

    rules (in OCaml) • The rules read jbuild files • Developers write jbuild files
  8. Automatic discovery • No need to specify where libraries/executables are

    • Easy to move things around • Multi-project development (imported from jenga)
  9. Build contexts • Can build simultaneously against several opam switches/roots

    • Artefacts in _build/<context>/ • Specific to the rules, not part of the core
  10. Cross-compilation • Rules can cross build contexts • Can easily

    depend on the host version of an executable
  11. And all the rest • Generates .install files • Supports

    repositories defining multiple packages • Generates META files • Supports parallel builds • Portable • Tries to report usable error messages
  12. Keep rules simple • static set of targets • no

    need for clever rules when you have List.iter • -> immediately get the whole DAG
  13. Build arrow • type rule = (unit, Action.t) Build.t •

    reusable code • allow to analyse the graph without running commands
  14. OCaml plugins • So that complex rules can be written

    outside of Jbuilder • Automatic loading of plugins • (x:ctypes …) • Allow plugins inside the workspace