Scheme tools for herding OCaml projects; in particular analyzing and editing Dune, OPAM, and META files.
If you prefer acronyms: Meta-ibl ("ibl" is Arabic for "camel"). If you prefer recursion: Mibl integrates build languages.
Important
|
STATUS: Alpha. The code (in C) for the crawling the file system and parsing Dune, Meta, and OPAM and META files is written but the Scheme APIs are still under construction. An earlier version of the Dune API was sufficient for generating Bazel build files, but it is undergoing major revisions. What’s there is sufficient for exploration. |
mibl
is derived from
s7. See
Why S7
Scheme? for reasons why.
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
git_repository(
name = "mibl",
remote = "https://github.com/obazl/mibl",
branch = "main"
)
Note
|
Once mibl is officially released this should be replaced with an http_archive rule.
|
There are two ways to run mibl
: with or without Bazel.
From within a Bazel project:
$ bazel run @mibl//repl
Options: -v
(verbose) and -d
(debug).
Once in the repl, run dune-load
to crawl your project and produce a
hash-table of package specs:
(dune-load "src/lib_stdlib_unix")
By default, dune-load
will interpret a single string arg as a file
path relative to the launch directory. You can also give it a list of
directories to crawl:
(dune-load '("src/a" "src/b"))
You can also pass it two arguments: a path and a list of paths; the
first will be interpreted as a path relative to your $HOME
directory, which will serve as the traversal root; the paths in the
second arg will be interpreted relative to that root directory.
For example, suppose your current directory is $HOME/myproj
and you
are also working on a related project at $HOME/mylib
. Then to crawl
the src/foo
and test/bar
directories of that project (i.e.
$HOME/mylib/src/foo
and $HOME/mylib/test/bar
), run:
(dune-load "myproj" '("src/foo" "src/bar"))
Finally, running without any args - (dune-load)
- will crawl the
tree rooted at the current directory.
You can install mibl
in your local system by running:
$ bazel run @mibl//deploy
Installation follows the XDG standard:
-
the
mibl
executable will go in$HOME/.local/bin
; put this in your$PATH
. -
mibl
dynamically loads (dlopen
) filelibc_s7.so
; this will be installed in$XDG_DATA_HOME/mibl
. By default,XDG_DATA_HOME
=$HOME/.local/share
. -
Scheme script files used by
mibl
will be installed in$XDG_DATA_HOME/mibl
.
The load-path of `mibl
will be configured to include:
-
.
(current directory) -
$PWD/.mibl
-
$HOME/.mibl
-
$XDG_DATA_HOME/.local/share/mibl
-
$XDG_DATA_HOME/.local/share/mibl/s7
Then run $ mibl
to launch the repl.