Commit Graph

58 Commits

Author SHA1 Message Date
Jeremie Dimino 13b770962d Remove the ?extra_targets argument of Build.run
Instead, use Hidden_targets
2018-04-18 17:00:11 +01:00
Rudi Grinberg 62bbd5d30e
Merge pull request #671 from rgrinberg/pr/653
Cosmetic changes for default package entry point.
2018-04-10 20:04:28 +07:00
Jeremie Dimino 606ad1b10f Pass around library dependencies as static values
This way we know more of the compilation DAG statically. This helps
for parallelism as well as for `jbuilder external-lib-deps`
2018-04-09 06:31:52 +08:00
Thomas Refis 77c717b9af Cosmetic changes for default package entry point. 2018-04-03 00:54:30 +08:00
Anton Bachin f29ff0945d Place module list on its own line (take 2)
See eb05f4f643 and
https://github.com/ocaml/dune/pull/367#issuecomment-352209790.
2018-04-03 00:13:36 +08:00
Rudi Grinberg ff211b18a7 Fix lazy loading of rules
We must load package rules when a file in the _mld dir is requested
2018-04-02 23:15:56 +08:00
Rudi Grinberg 85d69b8e1a Remove Odoc.pkg_odoc
This function is only used once
2018-04-02 19:47:13 +08:00
Rudi Grinberg 8fd04e5a9f Use doc_dir rather than dir
dir is the source directory which is useless to us
2018-03-24 00:54:33 +08:00
Rudi Grinberg aea0131b11 Don't pass library include flags to odoc
We should pass directories where we store .odoc files instead
2018-03-24 00:38:34 +08:00
Rudi Grinberg a83c15b085 Alphabetical listings in odoc
List sub libraries and their modules in alphabetical order
2018-03-22 20:40:46 +08:00
Jeremie Dimino b5fad14f16 Less Path.Set.t -> Path.t list conversions 2018-03-19 01:19:41 +08:00
Rudi Grinberg 7a26c18e20 New odoc rules 2018-03-18 17:44:08 +08:00
Jérémie Dimino b59dab57da Include the package in the public status of libraries 2018-03-16 11:11:18 +08:00
Rudi Grinberg ddefafa58b Introduce private type for module name 2018-03-06 18:45:38 +07:00
Jeremie Dimino 17f4567014 Still build a Lib.t value for hidden libraries
This makes everything else simpler
2018-02-28 19:08:03 +00:00
Rudi Grinberg d01a684f71 Move SC.Doc to Odoc module
It longer has a rason to exist in super context.
2018-02-28 17:24:37 +07:00
Rudi Grinberg 3fd3d5b44c Don't pass lib_name if lib is already passed
We can easily get the library name
2018-02-26 14:55:40 +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 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 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 0d62c34e42
Make Lib.t abstract (#498)
* Make Lib.t abstract

This requires removing the external/internal separation in most places in the
source code. Briefly, these are:

* Special casing of external libs for incremental compilation in jsoo
* .merlin generation
* stamp file generation
* transitive closure having a flag for walking external libs
* checking if a lib is a driver (checking various names)

These cases are fixed by introducing an src_dir, obj_dir abstractions, and the
ability to check if a library is local.
2018-02-13 18:36:15 +08:00
Grégoire Henry fda3c7f680 Implement #427 2018-02-07 12:33:52 +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
Jérémie Dimino d4c9eb6ba0
Do not pass -I <stdlib-dir> (#488) 2018-02-06 11:49:44 +00:00
Jérémie Dimino 80c0bfc879
Split calls to ocamldep (#486)
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.
2018-02-06 11:48:04 +00:00
Rudi Grinberg 4272d34fa6 Fix scoping related odoc rules
the lib component isn't just a library name. It can contain the scope as well
which we should resolve correctly
2018-01-31 03:43:39 +08: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
Rudi Grinberg 6cce747141 Make odoc work with multiple libraries defined in the same dir 2018-01-23 02:56:23 +08:00
Thomas Refis 815c332dc5 odoc: handle .mld files 2018-01-23 02:56:23 +08:00
Jérémie Dimino 9dd5ab74e4
[WIP] Load rules lazily (#370)
* 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.
2018-01-19 08:50:06 +00:00
Jeremie Dimino 18d8cb847d Fix the test added in the previous commit 2017-12-18 13:30:49 +00:00
Anton Bachin eb05f4f643 Place module list on its own line
The markup emitted by Jbuilder treated module lists as inline elements
that can appear inside a line. However, neither ocamldoc nor odoc render
module lists as inline elements. They are instead block elements, that
are laid out vertically, like lists or paragraphs. Correspondingly, odoc
now rejects inline module list markup.

A side effect of the (rejected) misconception is that there was a stray
period appearing on its own line in every module list generated by
Jbuilder. This is now fixed.
2017-12-16 14:27:36 -06:00
Anton Bachin 0aa6faa145 odoc: don't generate raw HTML and level 1 headings
This page generation code really should be moved to odoc, however.
2017-12-16 14:07:51 -06:00
Milo Davis f645f0c030 Build documentation for non-public libraries 2017-11-03 16:12:06 +01:00
François Bobot 2bd8fe49b4 Revert "RFC update odoc rules" 2017-10-24 13:58:34 +02:00
Thomas Refis 765302461d odoc: handle .mld files 2017-10-24 11:51:28 +01:00
Rudi Grinberg c28ee8fa10 Merge pull request #280 from aantron/odoc-index-libraries-not-packages
Docs: list all libraries in top-level index
2017-10-11 21:31:15 -04:00
Anton Bachin 9e3b64af86 Fix "Up" links to top-level index
When the docs are viewed locally, the URL ".." causes the browser to
display a listing of the parent directory, instead of "../index.html".
The "../index.html" interpretation is only provided by web servers.
2017-10-11 10:24:02 -05:00
Anton Bachin 48d9be2d00 Docs: list all libraries in top-level index
This commit changes the top-level index of the docs generated by
Jbuilder so that the index lists all installed libraries (Findlib
library packages generated by Jbuilder), rather than only opam packages.
For example, current Markup.ml installs libraries

  markup
  markup.lwt
  markup.lwt.unix

With this change, all these libraries are listed in the index. Before
this change, only markup was listed, because it happened to coincide
with the name of the opam package that contains all three libraries.

Not listing the extra libraries makes them undiscoverable, as they can
only be reached by direct URL.
2017-10-11 09:39:46 -05:00
Thomas Gazagnaire 71952a0983 Add a toplevel html index to the docs 2017-08-22 11:12:33 +02:00
Jeremie Dimino 297e82061e Update_file --> Write_file
The difference is not meaningful anymore. Also expose Write_file as
write-file.
2017-08-17 15:13:11 +01:00
Jeremie Dimino 4b40cad247 Revert public_interfaces for now
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.
2017-07-21 17:32:39 +01:00
Jeremie Dimino 9893c14500 Fix some problems related to public_interfaces
The dependencies on library artifacts are now properly setup to point
to the files in _build/install/...

Moreorver, private interfaces are now only visible inside the library
itself and are only allowed for private libraries. When a project
defines multiple packages, this ensures that the visibility when all
packages are built simultaneously and when they are installed one by
one.

We can relax these restrictions later with a bit more work and a clear
definition of where private modules should be visible.
2017-07-21 16:52:28 +01:00
Jeremie Dimino cec825bf18 memoize one more computation in odoc 2017-07-21 15:43:44 +01:00
François Bobot a3933a2c18 Add public_interfaces selection for libraries (#106)
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.
2017-07-19 15:26:48 +01:00
François Bobot 9935c838b3 Use lowercase_ascii 2017-07-07 12:27:31 +02:00
Jeremie Dimino b74544919a jbuild_types.ml --> jbuild.ml 2017-06-02 14:32:05 +01:00
Thomas Refis a5af8efa0a Revert "Only build the toplevel module for wrapped libraries with odoc"
odoc is not ready for that as it turns out.

This reverts commit 5bd391e224.
2017-05-29 15:49:29 +01:00
Jeremie Dimino 5bd391e224 Only build the toplevel module for wrapped libraries with odoc 2017-05-29 14:52:20 +01:00
Jeremie Dimino 1d3341ed28 Add a (mkdir ...) action 2017-05-29 14:51:46 +01:00