Commit Graph

33 Commits

Author SHA1 Message Date
Rudi Grinberg f700de1572 Add ~loc to of_string_exn
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-08-28 13:30:40 +03:00
Rudi Grinberg 81dda61f23 Fix cases where we'd map over lib name lists just to convert them to strings
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-08-28 13:30:40 +03:00
Rudi Grinberg 071c2377de Introduce Lib_name.t and Lib_name.Local.t types
These types help distinguish external and internal library names

Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-08-28 13:30:40 +03:00
Rudi Grinberg 463ee3653a Invert the stdune and dsexp dependency
Signed-off-by: Rudi Grinberg <rudi.grinberg@gmail.com>
2018-08-23 11:58:10 +03:00
Louis Roché a5d0941b14 replace jbuilder with dune
* when printing context
* in meta comments
* error messages

Signed-off-by: Louis Roché <louis@louisroche.net>
2018-08-02 12:41:35 +02:00
Rudi Grinberg 98b2ea795c Move String_map to stdune 2018-04-23 12:43:20 +07:00
Rudi Grinberg 530dbfeb81 Move String_set to stdune 2018-04-23 12:08:09 +07: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
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 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 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
Rudi Grinberg 672120b3b8 Introduce explicit scopes for Lib_db
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.
2018-01-30 19:21:40 +08:00
Jérémie Dimino c066efd196
Add the transitive dependencies of used ppx rewriters (#450) 2018-01-25 11:22:50 +00:00
Jeremie Dimino ad9b82e92a Compute the transitive closure of ppx runtime deps only when needed
We only need it when the kind is ppx_rewriter or ppx_deriver.
2018-01-24 18:12:50 +00:00
Jérémie Dimino ba5ffbc414
Fix meta generation for ppx runtime deps (#441)
Use the transitive closure for the deprecated ppx method
2018-01-23 16:03:59 +00:00
Jérémie Dimino e28344a24b
Do not use the transitive closure in generated META files (#405) 2018-01-12 16:41:23 +00:00
Jérémie Dimino ca81d1704e Get rid of the deprecated-ppx-method sub-package (#222)
Instead, inline the fields it contains into the parent package
2017-08-17 12:41:49 +01:00
Jeremie Dimino b74544919a jbuild_types.ml --> jbuild.ml 2017-06-02 14:32:05 +01:00
Jeremie Dimino 4130bc2f63 Add support for ${version:<package>} 2017-05-05 12:26:56 +01:00
Jeremie Dimino fbe0810156 Improve location of errors for mispelled package in jbuild files 2017-05-05 10:59:07 +01:00
Jeremie Dimino b73e672cad Move js_of_ocaml to Buildable 2017-05-02 13:30:58 +01:00
hhugo 86a4f0324a Add js_of_ocaml support (#60)
Add rules for building .js files from .bc files using js_of_ocaml as well as rules for separate js compilation when --dev is passed.
2017-05-02 11:25:37 +01:00
Jeremie Dimino d8f7d77a75 Don't generate an "exists_if ..." line in META files
This is useless sine the jbuild is auto-generated
2017-04-10 10:10:15 +01:00
Jeremie Dimino 020da39542 as-ppx.exe --> ppx.exe 2017-03-13 13:36:01 +00:00
Jérémie Dimino 6364f70245 Fix a few ppx related issues 2017-03-05 11:57:27 +00:00
Jérémie Dimino cef3847977 Do no require ppx_driver 2017-03-05 09:38:39 +00:00
Jeremie Dimino 2183a6f2d8 Remove support for (object_public_name ...)
Installing libraries from an executables stanza is just weird.
2017-03-02 10:06:05 +00:00
Jeremie Dimino c999039aa7 Install sub-libraries into sub-directories
Otherwise we have a problem when two libraries of the same package
define the same module.
2017-03-01 15:03:09 +00:00
Jeremie Dimino 593b90723d Implement package version support 2017-02-24 18:21:22 +00:00
Jeremie Dimino 193f8d5238 moved cmdliner and re to vendor/ 2017-02-21 15:09:58 +00:00
Jeremie Dimino 716f30c3d3 114.28+32 2017-01-19 13:19:13 +00:00
Jeremie Dimino e054ce4d71 114.20+69 2016-12-15 13:00:30 +00:00
Jeremie Dimino 2357fa0799 114.20+69 2016-12-15 11:20:46 +00:00