Commit Graph

17 Commits

Author SHA1 Message Date
Jérémie Dimino 138c920069 Add support for sub-systems
- 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
2018-02-26 16:05:48 +00:00
Jérémie Dimino 2a531c5d24
Detect when a module is used by several stanzas (#532)
- print a warning
- don't generate several rules for the .d files
- Added tests for multiple rules for .ml.d
2018-02-20 16:44:25 +00:00
Jérémie Dimino 9e4cc84370
Refactor library management (#516)
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.
2018-02-20 11:46:10 +00:00
Jérémie Dimino bd0593c11a
Fix printing of errors (#513)
The status line wasn't properly cleared
2018-02-13 18:31:21 +00:00
Jérémie Dimino 0570e09f9a
Add a configuration file and a quiet mode (#490) 2018-02-07 11:38:21 +00:00
Jérémie Dimino 4e4f651b37
Don't stop on the first error (#477)
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.
2018-02-06 14:39:03 +00:00
Jeremie Dimino 3e525d8eec Vendored usexp and switch to it 2017-12-21 13:13:47 +00:00
Jeremie Dimino d55c807d51 Allow to localize the error reported by Path.relative/of_string
Since these are often used to parse user input.
2017-09-10 01:26:06 +01:00
Jeremie Dimino 06ab34981c Capture locations of string-with-vars generated inside jbuilder 2017-06-08 10:54:46 +01:00
Jeremie Dimino a52c8a4cd7 Add location to a few errors 2017-05-31 16:49:54 +01:00
Jeremie Dimino 9df1bad58c Change an error into a warning
Otherwise this breaks the build of atd.
2017-05-18 16:50:53 +01:00
Jérémie Dimino c6b2169037 Refactor S-expression parsing 2017-02-25 18:03:56 +00:00
Jeremie Dimino cdcd7e907f 114.20+69 2016-12-02 13:54:32 +00:00
Jeremie Dimino d3125bd4a8 handle findlib properly 2016-11-13 17:05:55 +00:00
Jeremie Dimino 24bb677ed2 fixes 2016-11-13 11:27:31 +00:00
Jeremie Dimino 583b55f527 findlib support 2016-11-13 11:13:47 +00:00
Jeremie Dimino 0a29ae3749 more work 2016-11-03 16:44:09 +00:00