- Add a Sub_system module that allows to register sub-systems
that are implemented in a single file
- Add a Syntax module to deal with versioned syntaxes
Other changes:
- Add location to all library dependencies in jbuild files, to report
properly located errors
- Change the type of functions in Lib to return (_, exn) result
rather than (_, Lib.Error.t With_required_by.t) result, which was
hard to use
- Remove With_required_by.t as it was unused
- Rename With_required_by to Dep_path
- Cleanup a bit the Exe module, move a lot of stuff that was specific to
executable stanzas in gen_rules.ml
- Add String_with_vars.Unexpanded.sexp_of_t
- Rework a bit the code in Lib, in particular factorize the code
for taking the transitive closure of libraries
- Add an ?extra_vars argument to functions that expand variables
in Super_context
- Fix the printing of dependency path
- Merge the handling of dependency path between the build system and
the Lib module
- make sure type t always come first
- Map.map, Map.fold, ... never pass the key to the callback while Map.mapi, Map.foldi, ... do
- removed the ~key and ~data labels, I find them useless and annoying
- Set.elements --> Set.to_list
- Map.bindings --> Map.to_list
- Map.of_alist --> Map.of_list
- added Ordering.t for comparison functions
- renamed Inl/Inr to Left/Right. The latter seems clearer
- moved List.longest to String.longest
- added a Pp module with a nicer API than Format
Lib module
----------
We have a new module Lib that replaces Lib, parts of Lib_db and parts
of Findlib. It is used to manage all libraries (internal and
extrernal). Lib.t represent a completely resolved library, i.e. where
all the dependencies have been resolved. Lib.Compile is used to
provide what is necessary to build the library itself. Lib.Meta
provides what is necessary to generate the META file for the library.
We also have library databases represented as Lib.DB.t. A library
database is simply a mapping from names to Lib.t values and and
created from a resolve function that looks up a name and return a
Lib.Info.t. A Lib.Info.t is the same as a Lib.t except that
dependencies are not resolved.
A library database can have a parent database that is used to lookup
names that are not found in the current database. In practice we have
the following hierarchy:
1. For every scope, we have a library database that holds all the
libraries of this scope. In this DB, a library can be referred by
either it's name or public name
2. the parent of each of these databases is a database that holds all
the public libraries of the workspace. In this DB libraries must be
referred by their public name
3. the parent of this DB is for installed libraries
(1) databases are accessible via Scope.libs
(Super_context.find_scope_by_{name,dir} sctx xxx)
(2) is accessible via Super_context.public_libs sctx
(3) is accessible via Super_context.installed_libs sctx
The dependencies of a library are always resolved inside the DB it is
part of. When we compute a transitive closure, we check that we don't
have two libraries from two different DB with the same name. So for
instance linting Base should now supported.
Jbuild.Scope_info
-----------------
Jbuild.Scope was renamed Jbuild.Scope_info
Scope module
------------
This replaces Lib_db. A Scope.t is now just a pair of a
Jbuild.Scope_info.t and a Lib.DB.t. Scope.DB.t is an object used to
lookup scopes by either name or directory.
We no longer have an external scope or special anonymous
scope. Instead one should use Super_context.installed_libs or
Super_context.public_libs depending on the context.