Commit Graph

155 Commits

Author SHA1 Message Date
Jeremie Dimino f20b43a22b Strip colors in blackbox tests 2018-03-06 11:01:06 +00:00
Jérémie Dimino 4857ed444a
Reduce interleaving in the scheduler (#586) 2018-03-05 17:52:21 +00:00
Rudi Grinberg 5ded45faf0
Merge pull request #584 from rgrinberg/improve-error-modules
Improve error in modules partition
2018-03-05 23:47:19 +07:00
Jeremie Dimino 348d2b1a1e display tweaks 2018-03-05 16:24:24 +00:00
Rudi Grinberg 719cf5eea0 Improve error in modules partition
Specify how to fix the error (by writing modules fields)
2018-03-05 23:11:45 +07:00
Rudi Grinberg dcbfc37666 Add flags field to menhir test 2018-03-05 20:03:36 +07:00
Rudi Grinberg 14d1a4f5e0 META file includes private libraries
This is incorrect as those aren't installed
2018-03-04 01:29:27 +07:00
Jeremie Dimino de99d84f73 Ignore errors while generating the .merlin file
Fix #568
Fix #51
2018-03-01 23:34:43 +00:00
Jeremie Dimino 224d627d07 Import the test case for #568 2018-03-01 23:30:01 +00:00
Jeremie Dimino 2e7f881d4c Fix #567
The alias module needs an implementation for non-jbuilder users.
2018-03-01 20:47:08 +00:00
Rudi Grinberg 6dae7ca6ca Add unit test for configurator 2018-02-28 23:37:27 +07:00
Jeremie Dimino 8fd3335ee8 Make inline tests more reproducible 2018-02-28 11:32:32 +00:00
Rudi Grinberg 60b8c7c968 Update inline tests (#556) 2018-02-28 09:34:57 +00:00
Rudi Grinberg c5da66e156 Use a more unique binary name
Use dunetestbar rather than bar as a binary name. The former name is too common
and hence can make the test fail if a bar binary exists elsewhere.
2018-02-28 12:30:19 +07:00
Rudi Grinberg 5ecf354127 Add a sub-system for inline tests (#547)
To support frameworks such as ppx_inline_test, ppx_expect and qtest
2018-02-27 19:06:12 +00:00
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
Rudi Grinberg 1cb005bb50 Add a way to customize obj dir for executables
Use this function to simplify the obj dir for the utop runner
2018-02-26 01:30:02 +07:00
Rudi Grinberg b4e0c04368 Revert "Use _utop.ml to avoid creating a separate dir for utop rules"
This reverts commit 9ec894eda0.
2018-02-26 01:30:02 +07:00
Jérémie Dimino 3fd3eb8a12
Split src/import.ml into a new library src/stdune (#548)
- 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
2018-02-25 16:35:25 +00:00
Jérémie Dimino 4cf7dc558b
Fix generation of the alias module with 4.02 (#549) 2018-02-25 12:58:40 +00:00
Rudi Grinberg 9ec894eda0 Use _utop.ml to avoid creating a separate dir for utop rules 2018-02-22 17:34:39 +07:00
Jeremie Dimino 41b5017eb2 Fix #534 2018-02-21 13:35:47 +00:00
Jeremie Dimino 4993c6b89a Added a test for #534 2018-02-21 13:35:47 +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
Rudi Grinberg d8e4145dba Warn instead of error on harmless fake modules
E.g. (modules (:standard \ does_not_exist)) is harmless
2018-02-20 20:23:28 +07:00
Rudi Grinberg 7977b8371a Test case for excluding missing module
Setting the field modules as follows (modules (:standard \ foo)) where foo
doesn't exist is an error.
2018-02-20 20:21:34 +07: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
Rudi Grinberg b27486b4bd Multi stanza in 1 jbuild build failure
After the change to run ocamldep per module, defining an executable and a
library this way doesn't work anymore.
2018-02-20 11:07:51 +07:00
Rudi Grinberg a6e6136f3a
Merge pull request #521 from rgrinberg/build-only-public-docs
Change @doc to only build public docs
2018-02-19 19:00:27 +07:00
Rudi Grinberg 2b73678284 Add test for the same mld's in different scopes
This case on the other hand is allowed
2018-02-17 19:12:52 +07:00
Rudi Grinberg 526c1eef39 Test to reproduce bug with duplicate mld's in same package
Odoc doesn't actually allow this so this test will turn into an error later on.
2018-02-16 19:58:11 +07:00
Rudi Grinberg d28c6e4456 Change @doc to only build public docs
Private docs can still be built using the new @doc-private alias
2018-02-16 16:22:28 +07:00
Rudi Grinberg 7e1300ab95
Add .merlin tests (#508)
These require post-processing all the absolute paths out of the .merlin
2018-02-14 02:13:57 +08:00
Jeremie Dimino 807251c931 Added missing file 2018-02-13 18:01:44 +00:00
Jérémie Dimino dfb8afb46e
Compute the transitive closure of findlib packages lazily (#507)
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
2018-02-13 17:49:07 +00:00
Jeremie Dimino 3744c158c2 Added a reproduction case for #484 2018-02-13 17:48:05 +00:00
Jérémie Dimino 8e27f1966d
Fix #485 (#512) 2018-02-13 15:56:59 +00:00
Jeremie Dimino 473b8d11ed Update test for #485 2018-02-13 15:52:18 +00:00
Jérémie Dimino dc3bfb9b05
Add a test for #485 (#511) 2018-02-13 12:58:34 +00:00
Jérémie Dimino 2fb65c05ba
Fix #330 (#510) 2018-02-13 12:49:50 +00:00
Jérémie Dimino 1e6ee05ecc
Added tests for byte-code only architectures (#509) 2018-02-13 12:46:07 +00:00
Rudi Grinberg 8781c81bd3 Fix the top closure for internal libs
keying by the private name isn't enough. We include the dir in the key, because
private names are unique per dir.
2018-02-12 19:55:39 +08:00
Rudi Grinberg ee42ca5301 Add test showing that private libs with same names don't get built
2 private libs with equivalent names but living in public names will not be
built as part of @install even if they have different public names
2018-02-12 19:55:39 +08:00
Hugo Heuzard dad2458879 install all sources 2018-02-08 23:09:55 +08:00
Rudi Grinberg 4ed4cad3e5 Witness failure to install .ml source when .mli is present 2018-02-08 23:08:52 +08:00
Jérémie Dimino b3838284c6
Better support for mli/rei only modules (#489) 2018-02-08 10:12:46 +00:00
Jérémie Dimino 763feda683 Move the addition of <lib>.a dependencies to Lib.archive_files (#493)
Move the addition of <lib>.a dependencies to Lib.archive_files

And refactor a bit the code
2018-02-08 03:21:11 +08:00
Jeremie Dimino b46cef533a Make Findlib.package abstract 2018-02-07 18:10:05 +00:00
Jeremie Dimino 1588ce90f2 Update js_of_ocaml tests 2018-02-07 14:20:56 +00:00
Jeremie Dimino b17b476048 Set the obj_dir for executables 2018-02-07 12:34:01 +00:00