Skip to content
Commits on Source (13)
1.11.0 (23/07/2019)
-------------------
- Don't select all local implementations in `dune utop`. Instead, let the
default implementation selection do its job. (#2327, fixes #2323, @TheLortex,
review by @rgrinberg)
- Check that selected implementations (either by variants or default
implementations) are indeed implementations. (#2328, @TheLortex, review by
@rgrinberg)
- Don't reserve the `Ppx` toplevel module name for ppx rewriters (#2242, @diml)
- Redesign of the library variant feature according to the #2134 proposal. The
set of variants is now computed when the virtual library is installed.
Introducing a new `external_variant` stanza. (#2169, fixes #2134, @TheLortex,
review by @diml)
- Add proper line directives when copying `.cc` and `.cxx` sources (#2275,
@rgrinberg)
- Fix error message for missing C++ sources. The `.cc` extension was always
ignored before. (#2275, @rgrinberg)
- Add `$ dune init project` subcommand to create project boilerplate according
to a common template. (#2185, fixes #159, @shonfeder)
- Allow to run inline tests in javascript with nodejs (#2266, @hhugo)
- Build `ppx.exe` as compiling host binary. (#2286, fixes #2252, @toots, review
by @rgrinberg and @diml)
- Add a `cinaps` extension and stanza for better integration with the
[cinaps tool](https://github.com/janestreet/cinaps) tool (#2269,
@diml)
- Allow to embed build info in executables such as version and list
and version of statically linked libraries (#2224, @diml)
- Set version in `META` and `dune-package` files to the one read from
the vcs when no other version is available (#2224, @diml)
- Add a variable `%{target}` to be used in situations where the context
requires at most one word, so `%{targets}` can be confusing; stdout
redirections and "-o" arguments of various tools are the main use
case; also, introduce a separate field `target` that must be used
instead of `targets` in those situations. (#2341, @aalekseyev)
- Fix dependency graph of wrapped_compat modules. Previously, the dependency on
the user written entry module was omitted. (#2305, @rgrinberg)
- Allow to promote executables built with an `executable` stanza
(#2379, @diml)
- When instantiating an implementation with a variant, make sure it matches
virtual library's list of known implementations. (#2361, fixes #2322,
@TheLortex, review by @rgrinberg)
- Add a variable `%{ignoring_promoted_rules}` that is `true` when
`--ingore-promoted-rules` is passed on the command line and false
otherwise (#2382, @diml)
- Fix a bug in `future_syntax` where the characters `@` and `&` were
not distinguished in the names of binding operators (`let@` was the
same as `let&`) (#2376, @aalekseyev, @diml)
- Workspaces with non unique project names are now supported. (#2377, fix #2325,
@rgrinberg)
- Improve opam generation to include the `dune` dependncies with the minimum
constraint set based on the dune language version specified in the
`dune-project` file. (2383, @avsm)
- The order of fields in the generated opam file now follows order preferred in
opam-lib. (@avsm, #2380)
- Fix coloring of error messages from the compiler (@diml, #2384)
- Add warning `66` to default set of warnings starting for dune projects with
language verison >= `1.11` (@rgrinberg, @diml, fixes #2299)
- Add (dialect ...) stanza
(@nojb, #2404)
- Add a `--context` argument to `dune install/uninstall` (@diml, #2412)
- Do not warn about merlin files pre 1.9. This warning can only be disabled in
1.9 (#2421, fixes #2399, @emillon)
- Add a new `inline_tests` field in the env stanza to control inline_tests
framework with a variable (#2313, @mlasson, original idea by @diml, review
by @rgrinberg).
- New binary kind `js` for executables in order to explicitly enable Javascript
targets, and a switch `(explicit_js_mode)` to require this mode in order to
declare JS targets corresponding to executables. (#1941, @nojb)
1.10.0 (04/06/2019)
-------------------
- Restricted the set of variables available for expansion in the destination
filename of `install` stanza to simplify implementation and avoid dependency
cycles. (#2073, @aalekseyev, @diml)
- [menhir] call menhir from context root build_dir (#2067, @ejgallego,
review by @diml, @rgrinberg)
- [coq] Add `coq.pp` stanza to help with pre-processing of grammar
files (#2054, @ejgallego, review by @rgrinberg)
- Add a new more generic form for the *promote* mode: `(promote
(until-clean) (into <dir>))` (#2068, @diml)
- Allow to promote only a subset of the targets via `(promote (only
<pred>))`. For instance: `(promote (only *.mli))` (#2068, @diml)
- Improve the behavior when a strict subset of the targets of a rule is already
in the source tree for projects using the dune language < 1.10 (#2068, fixes
#2061, @diml)
- With lang dune >= 1.10, rules in standard mode are no longer allowed to
produce targets that are present in the source tree. This has been a warning
for long enough (#2068, @diml)
- Allow %{...} variables in pps flags (#2076, @mlasson review by @diml and
@aalekseyev).
- Add a 'cookies' option to ppx_rewriter/deriver flags in library stanzas. This
allow to specify cookie requests from variables expanded at each invocation of
the preprocessor. (#2106, @mlasson @diml)
- Add more opam metadata and use it to generate `.opam` files. In particular, a
`package` field has been added to specify package specific information.
(#2017, #2091, @avsm, @jonludlam, @rgrinberg)
- Clean up the special support for `findlib.dynload`. Before, Dune would simply
match on the library name. Now, we only match on the findlib package name when
the library doesn't come from Dune. Someone writing a library called
`findlib.dynload` with Dune would have to add `(special_builtin_support
findlib_dynload)` to trigger the special behavior. (#2115, @diml)
- Install the `future_syntax` preprocessor as `ocaml-syntax-shims.exe` (#2125,
@rgrinberg)
- Hide full command on errors and warnings in development and show them in CI.
(detected using the `CI` environment variable). Commands for which the
invocation might be omitted must output an error prefixed with `File `. Add an
`--always-show-command-line` option to disable this behavior and always show
the full command. (#2120, fixes #1733, @rgrinberg)
- In `dune-workspace` files, add the ability to choose the host context and to
create duplicates of the default context with different settings. (#2098,
@TheLortex, review by @diml, @rgrinberg and @aalekseyev)
- Add support for hg in `dune subst` (#2135, @diml)
- Don't build documentation for implementations of virtual libraries (#2141,
fixes #2138, @jonludlam)
- Fix generation of the `-pp` flag in .merlin (#2142, @rgrinberg)
- Make `dune subst` add a `(version ...)` field to the `dune-project`
file (#2148, @diml)
- Add the `%{os_type}` variable, which is a short-hand for
`%{ocaml-config:os_type}` (#1764, @diml)
- Allow `enabled_if` fields in `library` stanzas, restricted to the
`%{os_type}`, `%{model}`, `%{architecture}`, `%{system}` variables (#1764,
#2164 @diml, @rgrinberg)
- Fix `chdir` on external and source paths. Dune will also fail gracefully if
the external or source path does not exist (#2165, fixes #2158, @rgrinberg)
- Support the `.cc` extension fro C++ sources (#2195, fixes #83, @rgrinberg)
- Run `ocamlformat` relative to the context root. This improves the locations of
errors. (#2196, fixes #1370, @rgrinberg)
- Fix detection of `README`, `LICENSE`, `CHANGE`, and `HISTORY` files. These
would be undetected whenever the project was nested in another workspace.
(#2194, @rgrinberg)
- Fix generation of `.merlin` whenever there's more than one stanza with the
same ppx preprocessing specification (#2209 ,fixes #2206, @rgrinberg)
- Fix generation of `.merlin` in the presence of the `copy_files` stanza and
preprocessing specifications of other stanazs. (#2211, fixes #2206,
@rgrinberg)
- Run `refmt` from the context's root directory. This improves error messages in
case of syntax errors. (#2223, @rgrinberg)
- In .merlin files, don't pass `-dump-ast` to the `future_syntax` preprocessor.
Merlin doesn't seem to like it when binary AST is generated by a `-pp`
preprocessor. (#2236, @aalekseyev)
- `dune install` will verify that all files mentioned in all .install files
exist before trying to install anything. This prevents partial installation of
packages (#2230, @rgrinberg)
1.9.3 (06/05/2019)
------------------
- Fix `.install` files not being generated (#2124, fixes #2123, @rgrinberg)
1.9.2 (02/05/2019)
------------------
- Put back library variants in development mode. We discovered a
serious unexpected issue and we might need to adjust the design of
this feature before we are ready to commit to a final version. Users
will need to write `(using library_variants 0.1)` in their
`dune-project` file if they want to use it before the design is
finalized. (#2116, @diml)
- Forbid to attach a variant to a library that implements a virtual
library outside the current project (#2104, @rgrinberg)
- Fix a bug where `dune install` would install man pages to incorrect
paths when compared to `opam-installer`. For example dune now
installs `(foo.1 as man1/foo.1)` correctly and previously that was
installed to `man1/man1/foo.1`. (#2105, @aalekseyev)
- Do not fail when a findlib directory doesn't exist (#2101, fix #2099, @diml)
- [coq] Rename `(coqlib ...)` to `(coq.theory ...)`, support for
`coqlib` will be dropped in the 1.0 version of the Coq language
(#2055, @ejgallego)
- Fix crash when calculating library dependency closure (#2090, fixes #2085,
@rgrinberg)
- Clean up the special support for `findlib.dynload`. Before, Dune
would simply match on the library name. Now, we only match on the
findlib package name when the library doesn't come from
Dune. Someone writing a library called `findlib.dynload` with Dune
would have to add `(special_builton_support findlib_dynload)` to
trigger the special behavior. (#2115, @diml)
- Include permissions in the digest of targets and dependencies (#2121, fix
#1426, @rgrinberg, @xclerc)
1.9.1 (11/04/2019)
------------------
- Fix invocation of odoc to add previously missing include paths, impacting
mld files that are not in directories containing libraries (#2016, fixes
#2007, @jonludlam)
1.9.0 (09/04/2019)
------------------
- Warn when generated `.merlin` does not reflect the preprocessing
specification. This occurs when multiple stanzas in the same directory use
different preprocessing specifications. This warning can now be disabled with
`allow_approx_merlin` (#1947, fix #1946, @rgrinberg)
- Watch mode: display "Success" in green and "Had errors" in red (#1956,
@emillon)
- Fix glob dependencies on installed directories (#1965, @rgrinberg)
- Add support for library variants and default implementations. (#1900,
@TheLortex)
- Add experimental `$ dune init` command. This command is used to create or
update project boilerplate. (#1448, fixes #159, @shonfeder)
- Experimental Coq support (fix #1466, @ejgallego)
- Install .cmi files of private modules in a `.private` directory (#1983, fix
#1973 @rgrinberg)
- Fix `dune subst` attempting to substitute on directories. (#2000, fix #1997,
@rgrinberg)
- Do not list private modules in the generated index. (#2009, fix #2008,
@rgrinberg)
- Warn instead of failing if an opam file fails to parse. This opam file can
still be used to define scope. (#2023, @rgrinberg)
- Do not crash if unable to read a directory when traversing to find root
(#2024, @rgrinberg)
- Do not exit dune if some source directories are unreadable. Instead, warn the
user that such directories need to be ignored (#2004, fix #310, @rgrinberg)
- Fix nested `(binaries ..)` fields in the `env` stanza. Previously, parent
`binaries` fields would be ignored, but instead they should be combined.
(#2029, @rgrinberg)
- Allow "." in `c_names` and `cxx_names` (#2036, fix #2033, @rgrinberg)
- Format rules: if a dune file uses OCaml syntax, do not format it.
(#2014, fix #2012, @emillon)
1.8.2 (10/03/2019)
------------------
- Fix auto-generated `index.mld`. Use correct headings for the listing. (#1925,
@rgrinberg, @aantron)
1.8.1 (08/03/2019)
------------------
- Correctly write `dune-package` when version is empty string (#1919, fix #1918,
@rgrinberg)
1.8.0 (07/03/2019)
------------------
- Clean up watch mode polling loop: improves signal handling and error handling
during polling (#1912, fix #1907, fix #1671, @aalekseyev)
- Change status messages during polling to be one-line, so that the messages are
correctly erased by ^K. (#1912, @aalekseyev)
- Add support for `.cxx` extension for C++ stubs (#1831, @rgrinberg)
- Add `DUNE_WORKSPACE` variable. This variable is equivalent to setting
`--workspace` in the command line. (#1711, fix #1503, @rgrinberg)
- Add `c_flags` and `cxx_flags` to env profile settings (#1700 and #1800,
@gretay-js)
- Format `dune printenv` output (#1867, fix #1862, @emillon)
- Add the `(promote-into <dir>)` and `(promote-until-clean-into
<dir>)` modes for `(rule ...)` stanzas, so that files can be
promoted in another directory than the current one. For instance,
this is used in merlin to promote menhir generated files in a
directory that depends on the version of the compiler (#1890, @diml)
- Improve error message when `dune subst` fails (#1898, fix #1897, @rgrinberg)
- Add more GC counters to catapult traces (fix908, @rgrinberg)
- Add a preprocessor shim for the `let+` syntax of OCaml 4.08 (#1899,
implements #1891, @diml)
- Fix generation of `.merlin` files on Windows. `\` characters needed
to be escaped (#1869, @mlasson)
- Fix 0 error code when `$ dune format-dune-file` fails. (#1915, fix #1914,
@rgrinberg)
- Configurator: deprecated `query_expr` and introduced `query_expr_err` which is
the same but with a better error in case it fails. (#1886, @ejgallego)
- Make sure `(menhir (mode promote) ...)` stanzas are ignored when
using `--ignore-promoted-rules` or `-p` (#1917, @diml)
1.7.3 (27/02/2019)
------------------
- Fix interpretation of `META` files containing archives with `/` in
the filename. For instance, this was causing llvm to be unusable
with dune (#1889, fix #1885, @diml)
- Make errors about menhir stanzas be located (#1881, fix #1876,
@diml)
1.7.2 (21/02/2019)
------------------
- Add `${corrected-suffix}`, `${library-name}` and a few other
variables to the list of variables to upgrade. This fixes the
support for various framework producing corrections (#1840, #1853,
@diml)
- Fix `$ dune subst` failing because the build directory wasn't set. (#1854, fix
#1846, @rgrinberg)
- Configurator: Add warning to `Pkg_config.query` when a full package expression
is used. Add `Pkg_config.query_expr` for cases when the full power of
pkg-config's querying is needed (#1842, fix #1833, @rgrinberg)
- Fix unavailable, optional implementations eagerly breaking the build (#1857,
fix #1856, @rgrinberg)
1.7.1 (13/02/2019)
------------------
- Fix the watch mode (#1837, #1839, fix #1836, @diml)
- Configurator: Fix misquoting when running pkg-config (#1835, fix #1833,
@Chris00)
1.7.0 (12/02/2019)
------------------
- Second step of the deprecation of jbuilder: the `jbuilder` binary
now emits a warning on every startup and both `jbuilder` and `dune`
emit warnings when encountering `jbuild` files (#1752, @diml)
- Change the layout of build artifacts inside _build. The new layout enables
optimizations that depend on the presence of `.cmx` files of private modules
(#1676, @bobot)
- Fix merlin handling of private module visibility (#1653 @bobot)
- unstable-fmt: use boxes to wrap some lists (#1608, fix #1153, @emillon,
thanks to @rgrinberg)
- skip directories when looking up programs in the PATH (#1628, fixes
#1616, @diml)
- Use `lsof` on macOS to implement `--stats` (#1636, fixes #1634, @xclerc)
- Generate `dune-package` files for every package. These files are installed and
read instead of `META` files whenever they are available (#1329, @rgrinberg)
- Fix preprocessing for libraries with `(include_subdirs ..)` (#1624, fix #1626,
@nojb, @rgrinberg)
- Do not generate targets for archive that don't match the `modes` field.
(#1632, fix #1617, @rgrinberg)
- When executing actions, open files lazily and close them as soon as
possible in order to reduce the maximum number of file descriptors
opened by Dune (#1635, #1643, fixes #1633, @jonludlam, @rgrinberg,
@diml)
- Reimplement the core of Dune using a new generic memoization system
(#1489, @rudihorn, @diml)
- Replace the broken cycle detection algorithm by a state of the art
one from [this paper](https://doi.org/10.1145/2756553) (#1489,
@rudihorn)
- Get the correct environment node for multi project workspaces (#1648,
@rgrinberg)
- Add `dune compute` to call internal memoized functions (#1528,
@rudihorn, @diml)
- Add `--trace-file` option to trace dune internals (#1639, fix #1180, @emillon)
- Add `--no-print-directory` (borrowed from GNU make) to suppress
`Entering directory` messages. (#1668, @dra27)
- Remove `--stats` and track fd usage in `--trace-file` (#1667, @emillon)
- Add virtual libraries feature and enable it by default (#1430 fixes #921,
@rgrinberg)
- Fix handling of Control+C in watch mode (#1678, fixes #1671, @diml)
- Look for jsoo runtime in the same dir as the `js_of_ocaml` binary
when the ocamlfind package is not available (#1467, @nojb)
- Make the `seq` package available for OCaml >= 4.07 (#1714, @rgrinberg)
- Add locations to error messages where a rule fails to generate targets and
rules that require files outside the build/source directory. (#1708, fixes
#848, @rgrinberg)
- Let `Configurator` handle `sizeof` (in addition to negative numbers).
(#1726, fixes #1723, @Chris00)
- Fix an issue causing menhir generated parsers to fail to build in
some cases. The fix is to systematically use `-short-paths` when
calling `ocamlc -i` (#1743, fix #1504, @diml)
- Never raise when printing located errors. The code that would print the
location excerpts was prone to raising. (#1744, fix #1736, @rgrinberg)
- Add a `dune upgrade` command for upgrading jbuilder projects to Dune
(#1749, @diml)
- When automatically creating a `dune-project` file, insert the
detected name in it (#1749, @diml)
- Add `(implicit_transitive_deps <bool>)` mode to dune projects. When this mode
is turned off, transitive dependencies are not accessible. Only listed
dependencies are directly accessible. (#1734, #430, @rgrinberg, @hnrgrgr)
- Add `toplevel` stanza. This stanza is used to define toplevels with libraries
already preloaded. (#1713, @rgrinberg)
- Generate `.merlin` files that account for normal preprocessors defined using a
subset of the `action` language. (#1768, @rgrinberg)
- Emit `(orig_src_dir <path>)` metadata in `dune-package` for dune packages
built with `--store-orig-source-dir` command line flag (also controlled by
`DUNE_STORE_ORIG_SOURCE_DIR` env variable). This is later used to generate
`.merlin` with `S`-directives pointed to original source locations and thus
allowing merlin to see those. (#1750, @andreypopp)
- Improve the behavior of `dune promote` when the files to be promoted have been
deleted. (#1775, fixes #1772, @diml)
- unstable-fmt: preserve comments (#1766, @emillon)
- Pass flags correctly when using `staged_pps` (#1779, fixes #1774, @diml)
- Fix an issue with the use of `(mode promote)` in the menhir
stanza. It was previously causing intermediate *mock* files to be
promoted (#1783, fixes #1781, @diml)
- unstable-fmt: ignore files using OCaml syntax (#1784, @emillon)
- Configurator: Add `which` function to replace the `which` command line utility
in a cross platform way. (#1773, fixes #1705, @Chris00)
- Make configurator append paths to `$PKG_CONFIG_PATH` on macOS. Previously it
was prepending paths and thus `$PKG_CONFIG_PATH` set by users could have been
overridden by homebrew installed libraries (#1785, @andreypopp)
- Disallow c/cxx sources that share an object file in the same stubs archive.
This means that `foo.c` and `foo.cpp` can no longer exist in the same library.
(#1788, @rgrinberg)
- Forbid use of `%{targets}` (or `${@}` in jbuild files) inside
preprocessing actions
(#1812, fixes #1811, @diml)
- Add `DUNE_PROFILE` environment variable to easily set the profile. (#1806,
@rgrinberg)
- Deprecate the undocumented `(no_keep_locs)` field. It was only
necessary until virtual libraries were supported (#1822, fix #1816,
@diml)
- Rename `unstable-fmt` to `format-dune-file` and remove its `--inplace` option.
(#1821, @emillon).
- Autoformatting: `(using fmt 1.1)` will also format dune files (#1821, @emillon).
- Autoformatting: record dependencies on `.ocamlformat-ignore` files (#1824,
fixes #1793, @emillon)
1.6.2 (05/12/2018)
------------------
......
......@@ -4,10 +4,10 @@ developed at [Jane Street][js] and is now maintained by Jane Street,
community.
Contributions to Dune are welcome and should be submitted via github
pull requests. Dune is distributed under the MIT license and
contributors are required to sign their work in order to certify that
they have the right to submit it under this license. See the following
section for more details.
pull requests against the `master` branch. Dune is distributed under
the MIT license and contributors are required to sign their work in
order to certify that they have the right to submit it under this
license. See the following section for more details.
Signing contributions
---------------------
......@@ -69,4 +69,11 @@ If you set your `user.name` and `user.email` git configs, you can sign
your commit automatically with `git commit -s`.
[dco]: http://developercertificate.org/
[js]: https://www.janestreet.com/
[ocl]: http://ocamllabs.io/
Coding style
------------
- wrap lines at 80 characters,
- use `[Ss]nake_case` over `[Pp]ascalCase`.
......@@ -97,7 +97,7 @@ rules.
### Accepting Corrections
A failing expect test will generate a diff between the expected and actual
output. If the new output generate by the command is satisfactory, it can be
output. If the new output generated by the command is satisfactory, it can be
*promoted* with the `$ make promote` command.
## Code flow
......
PREFIX_ARG := $(if $(PREFIX),--prefix $(PREFIX),)
LIBDIR_ARG := $(if $(LIBDIR),--libdir $(LIBDIR),)
INSTALL_ARGS := $(PREFIX_ARG) $(LIBDIR_ARG)
BIN := ./_build/default/bin/main_dune.exe
BIN := ./_boot/default/bin/main/main_dune.exe
-include Makefile.dev
......@@ -15,10 +15,10 @@ boot.exe: bootstrap.ml
ocaml bootstrap.ml
install:
$(BIN) install $(INSTALL_ARGS) dune
$(BIN) install $(INSTALL_ARGS) dune --build-dir _boot
uninstall:
$(BIN) uninstall $(INSTALL_ARGS) dune
$(BIN) uninstall $(INSTALL_ARGS) dune --build-dir _boot
reinstall: uninstall reinstall
......@@ -28,8 +28,11 @@ test:
test-js:
$(BIN) build @runtest-js
test-coq:
$(BIN) build @runtest-coq
test-all:
$(BIN) build @runtest @runtest-js
$(BIN) build @runtest @runtest-js @runtest-coq
check:
$(BIN) build @check
......@@ -44,7 +47,8 @@ all-supported-ocaml-versions:
clean:
rm -f ./boot.exe $(wildcard ./bootstrap.cmi ./bootstrap.cmo ./bootstrap.exe)
$(BIN) clean
$(BIN) clean || true
rm -rf _boot
distclean: clean
rm -f src/setup.ml
......
......@@ -19,7 +19,9 @@ guide][quick-start] or watch [this introduction video][video].
The [example][example] directory contains examples of projects using
dune.
[![Travis status][travis-img]][travis] [![AppVeyor status][appveyor-img]][appveyor]
[![Travis status][travis-img]][travis]
[![AppVeyor status][appveyor-img]][appveyor]
[![Release][release-img]][release]
[manual]: https://dune.readthedocs.io/en/latest/
[quick-start]: https://dune.readthedocs.io/en/latest/quick-start.html
......@@ -28,6 +30,8 @@ dune.
[travis-img]: https://travis-ci.org/ocaml/dune.svg?branch=master
[appveyor]: https://ci.appveyor.com/project/diml/dune/branch/master
[appveyor-img]: https://ci.appveyor.com/api/projects/status/rsxayce22e8f2jkp?svg=true
[release]: https://github.com/ocaml/dune/releases
[release-img]: https://img.shields.io/github/release/ocaml/dune.svg
[merlin]: https://github.com/ocaml/merlin
[opam]: https://opam.ocaml.org
[issues]: https://github.com/ocaml/dune/issues
......@@ -117,7 +121,7 @@ If you do not have `make`, you can do the following:
```sh
$ ocaml bootstrap.ml
$ ./boot.exe
$ ./_build/default/bin/main_dune.exe install dune
$ ./_boot/default/bin/main_dune.exe install dune
```
Support
......@@ -137,8 +141,6 @@ Status
------
Dune is now fairly stable and is used by the majority of packages on
opam. The package is still in beta version as we are waiting for the
renaming from Jbuilder to dune before releasing version 1.0.0. Note
that dune will have backward compatibility with Jbuilder, in particular
existing Jbuilder projects will continue to be buildable with
dune.
opam. Note that dune retains backward compatibility with Jbuilder, and
in particular existing Jbuilder projects will continue to be buildable
with dune.
......@@ -8,9 +8,11 @@ build_script:
- cd "%APPVEYOR_BUILD_FOLDER%"
- ocaml bootstrap.ml
- boot.exe
- copy _build\install\default\bin\dune.exe dune.exe
- copy _boot\install\default\bin\dune.exe dune.exe
- dune.exe build @test\blackbox-tests\windows-diff
artifacts:
- path: _build/log
name: build-log
- path: _boot/log
name: build_bootstrap-log
(library
(name dune_bench)
(libraries stdune fiber dune)
(modules :standard \ main)
(library_flags -linkall)
(preprocess (pps ppx_bench)))
(executable
(name main)
(modules main)
(libraries which_program_dune dune_bench core_bench.inline_benchmarks))
(libraries wp_dune dune_bench core_bench.inline_benchmarks))
(library
(name dune_bench)
(libraries stdune fiber dune)
(library_flags -linkall)
(preprocess (pps ppx_bench)))
(* Benchmark File_tree.t's internal cache *)
open Stdune
open Dune
let deep_path = "a1/a2/a3/a4/a5/a6/a7/a8/a9/10"
let setup = lazy (
let tmp = Path.External.of_string (Filename.get_temp_dir_name ()) in
Path.External.mkdir_p (Path.External.relative tmp deep_path);
Path.set_root tmp;
Path.Build.set_build_dir (Path.Build.Kind.of_string "_build");
let ft = (Dune_load.load ~ancestor_vcs:None ()).file_tree in
let path = Path.Source.of_string deep_path in
at_exit (fun () -> Sys.remove "./dune-project");
(ft, path))
let%bench_fun "File_tree.find_dir" =
let (ft, path) = Lazy.force setup in
fun () ->
ignore (Sys.opaque_identity (File_tree.find_dir ft path)
: File_tree.Dir.t option)
......@@ -3,20 +3,23 @@
open Stdune
open Dune
let () =
let setup = lazy (
Path.set_root (Path.External.cwd ());
Path.set_build_dir (Path.Kind.of_string "_build")
Path.Build.set_build_dir (Path.Build.Kind.of_string "_build"))
let prog =
Option.value_exn (Bin.which ~path:(Env.path Env.initial) "true")
let run () = Process.run ~env:Env.initial Strict prog []
let go ~jobs fiber =
Scheduler.go fiber ~config:{ Config.default with concurrency = Fixed jobs }
let%bench "single" = go (run ()) ~jobs:1
let%bench_fun "single" = Lazy.force setup; fun () -> go run ~jobs:1
let l = List.init ~len:100 ~f:ignore
let l = List.init 100 ~f:ignore
let%bench "many" [@indexed jobs = [1; 2; 4; 8]] =
go ~jobs (Fiber.parallel_iter l ~f:run)
let%bench_fun "many" [@indexed jobs = [1; 2; 4; 8]] =
Lazy.force setup;
fun () ->
go ~jobs (fun () -> Fiber.parallel_iter l ~f:run)
open Stdune
let die = Dune.Import.die
type t =
{ name : string
; recursive : bool
; dir : Path.t
; dir : Path.Source.t
; contexts : Dune.Context.t list
}
let to_log_string { name ; recursive; dir ; contexts = _ } =
sprintf "- %salias %s%s/%s"
(if recursive then "recursive " else "")
(if recursive then "@@" else "@")
(Path.to_string_maybe_quoted dir)
(if recursive then "@" else "@@")
(Path.Source.to_string_maybe_quoted dir)
name
let in_dir ~name ~recursive ~contexts dir =
Util.check_path contexts dir;
match Path.extract_build_context dir with
| None ->
let checked = Util.check_path contexts dir in
match checked with
| External _ ->
User_error.raise
[ Pp.textf "@@ on the command line must be followed by a relative path" ]
| In_source_dir dir ->
{ dir
; recursive
; name
; contexts
}
| Some ("install", _) ->
die "Invalid alias: %s.\n\
There are no aliases in %s."
| In_install_dir _ ->
User_error.raise
[ Pp.textf "Invalid alias: %s."
(Path.to_string_maybe_quoted Path.(relative build_dir "install"))
; Pp.textf "There are no aliases in %s."
(Path.to_string_maybe_quoted dir)
| Some (ctx, dir) ->
]
| In_build_dir (ctx, dir) ->
{ dir
; recursive
; name
; contexts =
[List.find_exn contexts ~f:(fun c -> Dune.Context.name c = ctx)]
[List.find_exn contexts ~f:(fun c -> Dune.Context.name c = ctx.name)]
}
let of_string common s ~contexts =
......@@ -51,9 +54,10 @@ let of_string common s ~contexts =
let s = String.drop s pos in
let path = Path.relative Path.root (Common.prefix_target common s) in
if Path.is_root path then
die "@@ on the command line must be followed by a valid alias name"
else if not (Path.is_managed path) then
die "@@ on the command line must be followed by a relative path"
User_error.raise
[ Pp.textf
"@ on the command line must be followed by a valid alias name"
]
else
let dir = Path.parent_exn path in
let name = Path.basename path in
......
......@@ -3,7 +3,7 @@ open Stdune
type t = private
{ name : string
; recursive : bool
; dir : Path.t
; dir : Path.Source.t
; contexts : Dune.Context.t list
}
......
This diff is collapsed.
open Dune
type t =
{ debug_dep_path : bool
; debug_findlib : bool
; debug_backtraces : bool
; profile : string option
; workspace_file : Arg.Path.t option
; root : string
; root : Workspace_root.t
; target_prefix : string
; only_packages : Package.Name.Set.t option
; only_packages : Dune.Package.Name.Set.t option
; capture_outputs : bool
; x : string option
; diff_command : string option
......@@ -16,21 +14,34 @@ type t =
; force : bool
; ignore_promoted_rules : bool
; build_dir : string
; no_print_directory : bool
; store_orig_src_dir : bool
; (* Original arguments for the external-lib-deps hint *)
orig_args : string list
; config : Config.t
; config : Dune.Config.t
; default_target : string
(* For build & runtest only *)
; watch : bool
; stats : bool
; stats_trace_file : string option
; always_show_command_line : bool
; promote_install_files : bool
}
val prefix_target : t -> string -> string
(** [set_common common ~targets] is [set_dirs common] followed by
[set_common_other common ~targets]. In general, [set_common] executes
sequence of side-effecting actions to initialize Dune's working
environment based on the options determined in a [Common.t] record *)
val set_common : t -> targets:string list -> unit
(** [set_common_other common ~targets] sets all stateful values dictated by
[common], except those accounted for by [set_dirs]. [targets] are
used to obtain external library dependency hints, if needed. *)
val set_common_other : t -> targets:string list -> unit
(** [set_dirs common] sets the workspace root and build directories, and makes
the root the current working directory *)
val set_dirs : t -> unit
val help_secs
......@@ -41,3 +52,19 @@ val help_secs
val footer : [> `Blocks of [> `P of string | `S of string ] list ]
val term : t Cmdliner.Term.t
val context_arg : doc:string -> string Cmdliner.Term.t
(** A [--build-info] command line argument that print build
informations (included in [term]) *)
val build_info : unit Cmdliner.Term.t
val default_build_dir : string
module Let_syntax : sig
val ( let+ ) : 'a Cmdliner.Term.t -> ('a -> 'b) -> 'b Cmdliner.Term.t
val ( and+ )
: 'a Cmdliner.Term.t
-> 'b Cmdliner.Term.t
-> ('a * 'b) Cmdliner.Term.t
end
open Stdune
open Import
let doc = "Compute internal function."
let man =
[ `S "DESCRIPTION"
; `P {|Run a registered memoize function with the given input and
print the output. |}
; `P {|This should only be used for debugging dune.|}
; `Blocks Common.help_secs
]
let info = Term.info "compute" ~doc ~man
let term =
Term.ret @@
let+ common = Common.term
and+ fn =
Arg.(required
& pos 0 (some string) None
& info [] ~docv:"FUNCTION"
~doc:"Compute $(docv) for a given input.")
and+ inp =
Arg.(value
& pos 1 (some string) None
& info [] ~docv:"INPUT"
~doc:"Use $(docv) as the input to the function.")
in
Common.set_common common ~targets:[];
let log = Log.create common in
let action =
Scheduler.go ~log ~common (fun () ->
let open Fiber.O in
let* _setup =
Import.Main.setup ~log common ~external_lib_deps_mode:true
in
match fn, inp with
| "list", None ->
Fiber.return `List
| "list", Some _ ->
Fiber.return (`Error "'list' doesn't take an argument")
| "help", Some fn ->
Fiber.return (`Show_doc fn)
| fn, Some inp ->
let sexp =
Dune_lang.parse_string
~fname:"<command-line>"
~mode:Dune_lang.Parser.Mode.Single inp
in
let+ res = Memo.call fn sexp in
`Result res
| fn, None ->
Fiber.return (`Error (sprintf "argument missing for '%s'" fn))
)
in
match action with
| `Error msg ->
`Error (true, msg)
| `Result res ->
Ansi_color.print (Dyn.pp res);
print_newline ();
`Ok ()
| `List ->
let fns = Memo.registered_functions () in
let longest = String.longest_map fns ~f:(fun info -> info.name) in
List.iter fns ~f:(fun { Memo.Function_info.name; doc } ->
Printf.printf "%-*s : %s\n" longest name doc);
flush stdout;
`Ok ()
| `Show_doc fn ->
let info = Memo.function_info fn in
Printf.printf "%s\n\
%s\n\
%s\n"
info.name
(String.make (String.length info.name) '=')
info.doc;
`Ok ()
let command = term, info
val command : unit Cmdliner.Term.t * Cmdliner.Term.info
(library
(name main)
(modules (:standard \ main_dune main_jbuilder))
(libraries unix dune cmdliner)
(preprocess (action (run src/let-syntax/pp.exe %{input-file}))))
(executable
(name main_dune)
(public_name dune)
(package dune)
(modules main_dune)
(libraries which_program_dune main)
(preprocess no_preprocessing))
(executable
(name main_jbuilder)
(public_name jbuilder)
(package dune)
(modules main_jbuilder)
(libraries which_program_jbuilder main)
(preprocess no_preprocessing))
(libraries memo dune_lang wp fiber stdune unix dune cmdliner build_info)
(preprocess future_syntax))
open Stdune
open Import
let doc =
"Execute a command in a similar environment as if installation was performed."
let man =
[ `S "DESCRIPTION"
; `P {|$(b,dune exec -- COMMAND) should behave in the same way as if you
do:|}
; `Pre " \\$ dune install\n\
\ \\$ COMMAND"
; `P {|In particular if you run $(b,dune exec ocaml), you will have
access to the libraries defined in the workspace using your usual
directives ($(b,#require) for instance)|}
; `P {|When a leading / is present in the command (absolute path), then the
path is interpreted as an absolute path|}
; `P {|When a / is present at any other position (relative path), then the
path is interpreted as relative to the build context + current
working directory (or the value of $(b,--root) when ran outside of
the project root)|}
; `Blocks Common.help_secs
]
let info = Term.info "exec" ~doc ~man
let term =
let+ common = Common.term
and+ context =
Common.context_arg ~doc:{|Run the command in this build context.|}
and+ prog =
Arg.(required
& pos 0 (some string) None (Arg.info [] ~docv:"PROG"))
and+ no_rebuild =
Arg.(value & flag
& info ["no-build"]
~doc:"don't rebuild target before executing")
and+ args =
Arg.(value
& pos_right 0 string [] (Arg.info [] ~docv:"ARGS"))
in
Common.set_common common ~targets:[prog];
let log = Log.create common in
let setup =
Scheduler.go ~log ~common (fun () -> Import.Main.setup ~log common) in
let context = Import.Main.find_context_exn setup.workspace ~name:context in
let prog_where =
match Filename.analyze_program_name prog with
| Absolute ->
`This_abs (Path.of_string prog)
| In_path ->
`Search prog
| Relative_to_current_dir ->
let prog = Common.prefix_target common prog in
`This_rel (Path.build (Path.Build.relative context.build_dir prog)) in
let targets = lazy (
(match prog_where with
| `Search p ->
[Path.Build.relative
(Config.local_install_bin_dir ~context:context.name) p
|> Path.build
]
| `This_rel p when Sys.win32 ->
[p; Path.extend_basename p ~suffix:Bin.exe]
| `This_rel p ->
[p]
| `This_abs p when Path.is_in_build_dir p ->
[p]
| `This_abs _ ->
[])
|> List.map ~f:(fun p -> Target.Path p)
|> Target.resolve_targets_mixed ~log common setup
|> List.concat_map ~f:(function
| Ok targets -> targets
| Error _ -> [])
) in
let real_prog =
if not no_rebuild then begin
match Lazy.force targets with
| [] -> ()
| targets ->
Scheduler.go ~log ~common (fun () -> do_build setup targets);
Hooks.End_of_build.run ();
end;
match prog_where with
| `Search prog ->
let path =
Path.build (Config.local_install_bin_dir ~context:context.name)
:: context.path in
Bin.which prog ~path
| `This_rel prog
| `This_abs prog ->
if Path.exists prog then
Some prog
else if not Sys.win32 then
None
else
let prog = Path.extend_basename prog ~suffix:Bin.exe in
Option.some_if (Path.exists prog) prog
in
match real_prog, no_rebuild with
| None, true ->
begin match Lazy.force targets with
| [] ->
User_error.raise
[ Pp.textf "Program %S not found!" prog ]
| _::_ ->
User_error.raise
[ Pp.textf "Program %S isn't built yet. You need to build it \
first or remove the --no-build option." prog
]
end
| None, false ->
User_error.raise [ Pp.textf "Program %S not found!" prog ]
| Some real_prog, _ ->
let real_prog = Path.to_string real_prog in
let argv = prog :: args in
restore_cwd_and_execve common real_prog argv context.env
let command = term, info
val command : unit Cmdliner.Term.t * Cmdliner.Term.info
open Stdune
open Import
let pp_external_libs libs =
Pp.enumerate (Lib_name.Map.to_list libs) ~f:(fun (name, kind) ->
match (kind : Lib_deps_info.Kind.t) with
| Optional -> Pp.textf "%s (optional)" (Lib_name.to_string name)
| Required -> Pp.textf "%s" (Lib_name.to_string name))
let doc = "Print out external libraries needed to build the given targets."
let man =
[ `S "DESCRIPTION"
; `P {|Print out the external libraries needed to build the given targets.|}
; `P {|The output of $(b,jbuild external-lib-deps @install) should be included
in what is written in your $(i,<package>.opam) file.|}
; `Blocks Common.help_secs
]
let info = Term.info "external-lib-deps" ~doc ~man
let run ~lib_deps ~by_dir ~setup ~only_missing ~sexp =
String.Map.foldi lib_deps ~init:false
~f:(fun context_name lib_deps_by_dir acc ->
let lib_deps =
Path.Source.Map.values lib_deps_by_dir
|> List.fold_left ~init:Lib_name.Map.empty ~f:Lib_deps_info.merge
in
let internals =
String.Map.find_exn setup.Import.Main.scontexts context_name
|> Super_context.internal_lib_names
in
let is_external name _kind = not (Lib_name.Set.mem internals name) in
let externals =
Lib_name.Map.filteri lib_deps ~f:is_external
in
if only_missing then begin
if by_dir || sexp then
User_error.raise [ Pp.textf "--only-missing cannot be used with \
--unstable-by-dir or --sexp" ];
let context =
List.find_exn setup.workspace.contexts
~f:(fun c -> c.name = context_name)
in
let missing =
Lib_name.Map.filteri externals ~f:(fun name _ ->
not (Findlib.available context.findlib name))
in
if Lib_name.Map.is_empty missing then
acc
else if Lib_name.Map.for_alli missing
~f:(fun _ kind -> kind = Lib_deps_info.Kind.Optional)
then begin
User_message.prerr
(User_error.make
[ Pp.textf "The following libraries are missing \
in the %s context:"
context_name
; pp_external_libs missing
]);
false
end else begin
User_message.prerr
(User_error.make
[ Pp.textf "The following libraries are missing \
in the %s context:"
context_name
; pp_external_libs missing
]
~hints:[ Pp.concat ~sep:Pp.space
(Pp.textf "try: opam install"
:: (Lib_name.Map.to_list missing
|> List.filter_map ~f:(fun (name, kind) ->
match (kind : Lib_deps_info.Kind.t) with
| Optional -> None
| Required -> Some (Lib_name.package_name name))
|> Package.Name.Set.of_list
|> Package.Name.Set.to_list
|> List.map ~f:(fun p ->
Pp.verbatim (Package.Name.to_string p))))
]);
true
end
end else if sexp then begin
if not by_dir then
User_error.raise [ Pp.textf "--sexp requires --unstable-by-dir" ];
let lib_deps_by_dir =
lib_deps_by_dir
|> Path.Source.Map.map ~f:(Lib_name.Map.filteri ~f:is_external)
|> Path.Source.Map.filter ~f:(fun m -> not (Lib_name.Map.is_empty m))
in
let sexp =
Path.Source.Map.to_dyn Lib_deps_info.to_dyn lib_deps_by_dir
|> Sexp.of_dyn
in
Format.printf "%a@." Sexp.pp (List [Atom context_name; sexp]);
acc
end else begin
if by_dir then
User_error.raise
[ Pp.textf "--unstable-by-dir cannot be used without --sexp" ];
User_message.print
(User_message.make
[ Pp.textf "These are the external library dependencies in \
the %s context:"
context_name
; pp_external_libs externals
]);
acc
end)
let term =
let+ common = Common.term
and+ only_missing =
Arg.(value
& flag
& info ["missing"]
~doc:{|Only print out missing dependencies|})
and+ targets =
Arg.(non_empty
& pos_all string []
& Arg.info [] ~docv:"TARGET")
and+ by_dir =
Arg.(value
& flag
& info ["unstable-by-dir"]
~doc:{|Print dependencies per directory
(this feature is currently unstable)|})
and+ sexp =
Arg.(value
& flag
& info ["sexp"]
~doc:{|Produce a s-expression output|})
in
Common.set_common common ~targets:[];
let log = Log.create common in
let setup, lib_deps =
Scheduler.go ~log ~common (fun () ->
let open Fiber.O in
let* setup = Import.Main.setup ~log common ~external_lib_deps_mode:true in
let targets = Target.resolve_targets_exn ~log common setup targets in
let request = Target.request setup targets in
let+ deps = Build_system.all_lib_deps ~request in
(setup, deps))
in
let failure = run ~by_dir ~setup ~lib_deps ~sexp ~only_missing in
if failure then raise Dune.Report_error.Already_reported
let command = term, info