- 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.
We are now computing the transitive closure of findlib packages
lazily. This simplify the code and prepare for subsequent changes to
library management.
Fix#484 at the same time
Before, jbuilder used to stop its execution after an error was
encountered. Now it continues until all branches have been explored.
To implement this feature, Future was rewritten as a Fiber module with
a simpler semantic.
This patch contains various other refactorings.
Instead of doing a single call to ocamldep, do one per file. This is
needed to support "menhir --infer".
This should also make compilation go further when there are files with
syntax errors.
This commit introduces explicit scopes in Lib_db and refactors dune to use these
scopes where appropriate. Briefly, they are appropriate whenever we previously
used a directory to resolve the scope with Lib_db.find ~dir and friends. So a
Lib_db.Scope.t replaces a (dir, Lib_db.t) pair.
This allows to be explicit about the anonymous and external scope. Which is
important when building ppx drivers.
We also harmonize the error handling with the Findlib module. In both cases
we use a flat string list of errors. Rather than the more specific type we had
before in Findlib.
* Change jbuilder to load rules lazily
Rules are now loaded on a per directory basis as needed. This speed up
the start up time on large workspaces.
Does various refactoring as well.
* Simplify the handling of META files
We no longer generate a META.foo.from-jbuilder file. Nobody is using
this feature and it's making the new code more complicated.
* Let variables say whether they are Concat or Split
To concatenate the contents of a split variable, put it in a string:
"${var} ".
Fixes#300
See also https://github.com/janestreet/jbuilder/issues/408
* Issue a deprecation warning for ${!...}
* Treat ${CC}, ${<}, ${^} and ${read-lines:...} as split vars
* Change ${!^} into ${^} for this project jbuild rules
* Test that modules are actually built by running their code.
* Make reasonlypp to also be a linter
* Make the reason only pp double as linter When ran with the -lint flag
Make jbuilder exec build its target
Jbuilder will now attempt to rebuild the target before executing it. This option can be turned off by passing in --no-build
Test the following scenarios:
* reason source, reason interface
* reason source, ocaml interface
* ocaml source, reason interface
* preprocessed reason sources
* rei files are included in the .install file
Option to force running tests
The mechanism allows for forcing any alias, but only forcing tests is exposed to the user. Aliases are forced by deleting all the alias files that belong to a particular alias. The option for forcing tests is called --force.
Add (copy_files <glob>) and (copy_files# <glob>) stanzas. These
stanzas setup rules for copying files from a sub-directory to the
current directory.
This provides a reasonable way to support multi-directory
library/executables in jbuilder.
The code to support it is starting to become increasingly complicated
and the number of problem found is a bit alarming.
We'll reinclude it later after a bit more testing and hopefully some
simplifications.
Add a field "public_interfaces" to library stanza listing which modules are public.
Private modules won't be accessible outside the scope where the library is defined.
While analysing packages using jbuilder, I found that some packages
use ${ROOT} to refer to the root of the project. However, this doesn't
work as ${ROOT} depends on the workspace configuration.
Add ${SCOPE_ROOT} to make this easier for projects with a lot of
nested sub-directories.
Adds the menhir stanza which desugars into a Rule.t with Support for:
* ocamlyacc like use
* modular parsers with --base
* passing extra flags
Also add tests and documentation.
Makes the output quieter by default and add a `--verbose` argument. Print a message when waiting for background jobs to finish only it it takes more than 0.5 seconds.
Before this commit, when there was more than one applicable
assignment, the one with the lowest number of formal predicates was
selected instead of the one with the biggest number of formal predicates