- Setup the rules to use the `-output-complete-obj` option of OCaml
- Introduce a `best` mode in addition to `byte` and `native`
- Extend the `modes` field of executables to mean "linking modes", and add linking modes for static and shared objects
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.
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.
jbuild-ignore should only refer to directories in the current directory
(unlike .gitignore): referring to subdirectories doesn't work.
Signed-off-by: David Allsopp <david.allsopp@metastack.com>
The -o option in the Microsoft C Compiler is deprecated (and has been for
a very long time). The warning is tedious, so use /Fo instead. The only
problem with this is that "-o foo.obj" must become "/Fofoo.obj" with no
space, which requires a little support in Arg_spec.
Signed-off-by: David Allsopp <david.allsopp@metastack.com>
The legacy DOS readonly attribute is a tedious difference on Windows,
because a user may have permission to delete a file, but unlink fails
because the attribute is set.
Signed-off-by: David Allsopp <david.allsopp@metastack.com>
* 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.
Warn when a file is both present in the source tree and generated by
a rule. Before, jbuilder would silently ignore the rule. One now has
to add a field `(fallback)` to custom rules to keep the current
behavior.
Instead of passing `-I <path> file.cma` to the compiler, pass `-I
<path> <path>/file.cma`.
Fixes#118 and #177. Using the fill path should also be slightly
faster as the compiler won't have to do the lookup through all include
paths. The only drawback is that it makes linking command line
slightly longer.
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.
before:
- foo.re --> foo.re.ml
- foo.rei --> foo.rei.mli
after:
- foo.re --> foo.re.ml
- foo.rei --> foo.re.mli
When compiling foo.re.ml with ocamlc or ocamlopt, the compiler checks
for the existence of foo.re.mli to determine whether the file has an
explicit interface or not. With the previous naming scheme, the
compiler always thought that there was no interface and was
re-creating the .cmi, which caused a race condition.
Fixes#184
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.
Report an error when in a wrapped library, a module that is not the
toplevel module depends on the toplevel module. This doesn't make as
such a module would in theory be inaccessible from the outside
If this causes compilation failures of released packages, we'll need
to turn this into a warning.