package jbuilder

  1. Overview
  2. Docs
Fast, portable and opinionated build system

Install

Dune Dependency

Authors

Maintainers

Sources

1.0+beta4.tar.gz
sha256=a421c729e8db3cf31609032e705e6059436067bfc3ebf17af56d5493772af637
md5=cfce9bc70426485d7c220bb2ff2fef0f

Description

jbuilder is a build system that was designed to simplify the release of Jane Street packages. It reads metadata from "jbuild" files following a very simple s-expression syntax.

jbuilder is fast, it has very low-overhead and support parallel builds on all platforms. It has no system dependencies, all you need to build jbuilder and packages using jbuilder is OCaml. You don't need or make or bash as long as the packages themselves don't use bash explicitely.

jbuilder supports multi-package development by simply dropping multiple repositories into the same directory.

It also supports multi-context builds, such as building against several opam roots/switches simultaneously. This helps maintaining packages across several versions of OCaml and gives cross-compilation for free.

Published: 20 Mar 2017

README

README.org

* JBUILDER - A composable build system for OCaml

Jbuilder is a build system designed for OCaml projects only. It
focuses on providing the user with a consistent experience and takes
care of most of the low-level details of OCaml compilation. All you
have to do is provide a description of your project and Jbuilder will
do the rest.

The scheme it implements is inspired from the one used inside Jane
Street and adapted to the open source world. It has matured over a
long time and is used daily by hundred of developpers, which means
that it is highly tested and productive.

Jbuilder comes with a [[./doc/manual.org][manual]]. If you want to get started without
reading too much, you can look at the [[./doc/quick-start.org][quick start guide]].

[[https://travis-ci.org/janestreet/jbuilder][https://travis-ci.org/janestreet/jbuilder.png?branch=master]]

** Overview

Jbuilder reads project metadata from =jbuild= files, which are either
static files in a simple S-expression syntax or OCaml scripts. It uses
this information to setup build rules, generate configuration files
for development tools such as [[https://github.com/ocaml/merlin][merlin]], handle installation, etc...

Jbuilder itself is fast, has very low-overhead and supports parallel
builds on all platforms. It has no system dependencies: all you need
to build jbuilder and packages using jbuilder is OCaml. You don't need
=make= or =bash= as long as the packages themselves don't use =bash=
explicitely.

Especially, one should be able to install OCaml on Windows with a
binary installer and then use only the Windows Console to build
Jbuilder and packages using Jbuilder. Although this hasn't been tested
yet.

** Strengths

*** Composable

Take n repositories that use Jbuilder, arrange them in any way on the
file system and the result is still a single repository that Jbuilder
knows how to build at once.

This make simultaneous development on multiple packages trivial.

*** Gracefully handles multi-package repositories

Jbuilder knows how to handle repositories containing several
packages. When building via [[https://opam.ocaml.org/][opam]], it is able to correctly use
libraries that were previously installed even if they are already
present in the source tree.

The magic invocation is:

#+begin_src sh
$ jbuilder build --only-packages <package-name> @install
#+end_src

*** Building against several configurations at once

Jbuilder is able to build a given source code repository against
several configurations simultaneously. This helps maintaining packages
across several versions of OCaml as you can tests them all at once
without hassle.

This feature should make cross-compilation easy, see details in the
[[ROADMAP.org][roadmap]].

This feature requires [[https://opam.ocaml.org/][opam]].

*** Jenga bridge

[[https://github.com/janestreet/jenga][Jenga]] is another build system for OCaml that has more advanced
features such as polling or much better editor integration. Jenga is
more powerful and more complex and as a result as much more
dependencies.  It is planned to implement a small bridge between the
two so that a Jbuilder project can build with Jenga using this bridge.

** Status

Jbuilder is now in beta testing stage. Once a bit more testing has
been done, it will be released in 1.0.

** Roadmap

See [[ROADMAP.org]] for the current plan. Help on any of these points is
welcome!

** Implementation details

This section is for people who want to work on Jbuilder itself.

*** Bootstrap

In order to build itself, Jbuilder uses an OCaml script ([[bootstrap.ml]])
that dumps most of the sources of Jbuilder into a single =boot.ml=
file. This file is built using =ocamlopt= or =ocamlc= and used to
build everything else.

*** OCaml compatibility test

Install opam switches for all the entries in the [[jbuild-workspace.dev]]
file and run:

#+begin_src sh
$ make all-supported-ocaml-versions
#+end_src

*** Repository organization

- =vendor/= contains dependencies of Jbuilder, that have been vendored
- =plugin/= contains the API given to =jbuild= files that are OCaml
  scripts
- =src/= contains the core of =Jbuilder=, as a library so that it can
  be used to implement the Jenga bridge later
- =bin/= contains the command line interface
- =doc/= contains the manual and rules to generate the manual pages

*** Design

Jbuilder was initially designed to sort out the public release of Jane
Street packages which became incredibly complicated over time. It is
still successfully used for this purpose.

One necessary feature to achieve this is the ability to precisely
report the external dependencies necesseray to build a given set of
targets without running any command, just by looking at the source
tree. This is used to automatically generate the =<package>.opam=
files for all Jane Street packages.

To implement this, the build rules are described using a build arrow,
which is defined in [[src/build.mli][src/build]]. In the end it makes the development
of the internal rules of Jbuilder very composable and quite pleasant.

To deal with process multi-plexing, Jbuilder uses a simplified
Lwt/Async like monad, implemented in [[src/future.mli][src/future]].

**** Code flow

- [[src/jbuild_types.ml][src/jbuild_types]] contains the internal representation of =jbuild=
  files and the parsing code
- [[src/jbuild_load.ml][src/jbuild_load]] contains the code to scan a source tree and build
  the internal database by reading the =jbuild= files
- [[src/gen_rules.ml][src/gen_rules]] contains all the build rules of Jbuilder
- [[src/build_system.ml][src/build_system]] contains a trivial implementation of a Build
  system. This is what Jenga will provide when implementing the bridge

Dependencies (1)

  1. ocaml >= "4.02.3" & < "4.08.0"

Dev Dependencies

None

Used by (61)

  1. base < "v0.9.2"
  2. bin_prot = "v0.9.0"
  3. decompress = "0.8"
  4. fieldslib = "v0.9.0"
  5. jupyter-kernel < "0.4"
  6. malfunction < "0.3"
  7. mirage-net-macosx = "1.4.0"
  8. nonstd >= "0.0.3"
  9. npy >= "0.0.5" & < "0.0.8"
  10. ocaml-compiler-libs < "v0.10.0"
  11. ocaml-migrate-parsetree < "1.0"
  12. osbx < "1.1.1"
  13. ppx_assert = "v0.9.0"
  14. ppx_ast < "v0.10.0"
  15. ppx_base < "v0.10.0"
  16. ppx_bench = "v0.9.0"
  17. ppx_bin_prot = "v0.9.0"
  18. ppx_compare = "v0.9.0"
  19. ppx_conv_func = "v0.9.0"
  20. ppx_core >= "v0.9.0" & < "v0.9.3"
  21. ppx_custom_printf = "v0.9.0"
  22. ppx_driver = "v0.9.0"
  23. ppx_enumerate = "v0.9.0"
  24. ppx_expect = "v0.9.0"
  25. ppx_fail = "v0.9.0"
  26. ppx_fields_conv = "v0.9.0"
  27. ppx_hash < "v0.10.0"
  28. ppx_here = "v0.9.0"
  29. ppx_inline_test = "v0.9.0"
  30. ppx_jane = "v0.9.0"
  31. ppx_js_style < "v0.10.0"
  32. ppx_let = "v0.9.0"
  33. ppx_metaquot < "v0.10.0"
  34. ppx_optcomp = "v0.9.0"
  35. ppx_optional < "v0.10.0"
  36. ppx_pipebang = "v0.9.0"
  37. ppx_regexp >= "0.3.0" & < "0.4.0"
  38. ppx_sexp_conv = "v0.9.0"
  39. ppx_sexp_message = "v0.9.0"
  40. ppx_sexp_value = "v0.9.0"
  41. ppx_traverse < "v0.10.0"
  42. ppx_traverse_builtins < "v0.10.0"
  43. ppx_type_conv = "v0.9.0"
  44. ppx_typerep_conv = "v0.9.0"
  45. ppx_variants_conv = "v0.9.0"
  46. prometheus = "0.2"
  47. prometheus-app = "0.2"
  48. protocol-9p = "0.10.0"
  49. protocol-9p-tool < "0.11.2"
  50. protocol-9p-unix < "0.11.0"
  51. qcow = "0.10.0"
  52. rfc1951 < "0.8.1"
  53. sanddb < "0.2"
  54. sexplib >= "v0.9.0" & < "v0.9.2"
  55. stdio < "v0.10.0"
  56. tar < "0.9.0"
  57. tar-mirage < "0.9.0"
  58. tensorflow = "0.0.10"
  59. tube < "4.1"
  60. typerep = "v0.9.0"
  61. variantslib = "v0.9.0"

Conflicts

None

OCaml

Innovation. Community. Security.