When the root of the workspace is not the current directory, print:
Entering directory '<absolute path to root>'
This way editors such as emacs or vim knows how to interpret filenames
reported by the compiler.
Fixes#138
- vendored libraries are replaced by files in `vendor/boot`
- files named `XXX.boot.EXT` replace their `XXX.EXT` equivalent
For instance, to build boot.exe, we use `src/glob_lexer.boot.ml`
rather than `src/glob_lexer.ml` (which would be generated from
`src/glob_lexer.mll`).
Add (copy_files <glob>) and (copy_files# <glob>) stanzas. These
stanzas setup rules for copying files from a sub-directory to the
current directory.
This provides a reasonable way to support multi-directory
library/executables in jbuilder.
Previously, in Mode.Native, executables depended on .cmx files only.
This was fine when changes were detected by timestamp, but it is
possible to semantically alter an .ml such that only the .o/.obj file
alters. In this situation, Jbuilder would rebuild the .cmx file, but not
relink the executable.
Fixes#237.
Signed-off-by: David Allsopp <david.allsopp@metastack.com>
The form (:include $(SCOPE_ROOT)\foo) requires quoting, but the error
message was cryptic ("Error: undefined symbol include").
Signed-off-by: David Allsopp <david.allsopp@metastack.com>
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.
Add a utop subcommand that build and execute a utop where all the libraries defined in the current directory are immediately available for interactive use.
Extend Ordered_set_lang.Unexpanded.expand to include a mapping function
for the S-expression for each atom. The previous behaviour can be
achieved with ~f:Sexp.Of_sexp.string, but this allows the S-expression
to be parsed using String_with_vars.t, thus allowing variable expansion.
* Allow digits in library/module names
Also include the malformed module name in the error message so it's more clear what it's complaining about.
* Update jbuild.ml
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.
This is useful, for example, if one needs to pass specific flags
by hand (due to the need to use old libraries for example). Fixes
#198
Signed-off-by: Marcello Seri <marcello.seri@citrix.com>
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.
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.
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.
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.
For instance (chdir ${read:foo} ...) is not allowed. This doesn't seem
really useful since we couldn't express the targets anyway and
supporting it complicate the code.
The Microsoft C compiler doesn't recognise -g. For now, easier just not
to compile with any debugging information on MSVC.
Signed-off-by: David Allsopp <david.allsopp@metastack.com>
Currently (foreach ...) is too general and variables can be used
anywhere inside S-expressions.
We need to sort out how we are going to handle meta-programming first
as this might impact how we implement (foreach ...).
In any case, it's better not to have it in 1.0.0.
Instead make jbuilder print the rule to do the same in the warning
message. The rule is not that big. Also add a note about mli only
modules in the "Known issues" section of the README.
This avoids polluting the jbuild specification and is still a
reasonable solution until someone implements proper support for mli
only modules in the compiler.
- ${read:<filename>} -> expand to the contents of the file
- ${read-lines:<filename>} -> expand to the list of lines in the file
- ${read-strings:<filename> -> expand to the list of lines in the file,
unescaped using OCaml escaping rules
Generalize ${!...} form
This way, when an external library is reinstalled, jbuilder knows to
rebuild things.
Currently, because the library dependencies transitive closures are
computed dynamically and jbuilder doesn't yet support dynamic targets,
every single rule has to depend on all the external files.
When jbuilder support dynamic targets, we can setup one alias per
external directory.
Tested the build of 97 Jane Street repository at once. No slow down
observed for the initial build.
Then a null build goes from ~1.5s to 2s. The test case is a bit
extreme so it's bot that bad given the benefits.