Skip to content

Commit

Permalink
Merge branch 'main' into ps/branch/test__expand___deps__in__cat_
Browse files Browse the repository at this point in the history
  • Loading branch information
Alizter authored Jul 20, 2023
2 parents cefd562 + 92d8848 commit b587f3c
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 19 deletions.
49 changes: 32 additions & 17 deletions doc/hacking.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,19 @@ For integration tests, we use a system similar to `Cram tests
.. _ppx_expect: https://github.com/janestreet/ppx_expect
When running dune inside tests, the ``INSIDE_DUNE`` environment variable is set.
This has the following effects:
* Change the default root detection behaviour to use the current directory
rather than the top most ``dune-project`` / ``dune-workspace`` file.
* Be less verbose when Dune outputs a user message.
* Error reporting is deterministic by default.
* Prefer not to use a diff program for displaying diffs.
This list is not exhaustive and may change in the future. In order to find the
exact behaviour, it is recommended to search for ``INSIDE_DUNE`` in the
codebase.
Guidelines
----------
Expand Down Expand Up @@ -178,16 +191,16 @@ consists of two steps:
Major & Feature Releases
------------------------
Given a new version `x.y.z`, a major release increments `x`, and a feature
release increments `y`. Such a release must be done from the `main` branch.
Once you publish the release, be sure to publish a release branch named `x.y`.
Given a new version ``x.y.z``, a major release increments ``x``, and a feature
release increments ``y``. Such a release must be done from the ``main`` branch.
Once you publish the release, be sure to publish a release branch named ``x.y``.
Point Releases
--------------
Point releases increment the `z` in `x.y.z`. Such releases are done from the
respective `x.y` branch of the respective feature release. Once released, be
sure to update `CHANGES` in the `main` branch.
Point releases increment the ``z`` in ``x.y.z``. Such releases are done from the
respective ``x.y`` branch of the respective feature release. Once released, be
sure to update ``CHANGES.md`` in the ``main`` branch.
Adding Stanzas
==============
Expand Down Expand Up @@ -292,14 +305,14 @@ Loading Rules
-------------
Dune rules are loaded lazily to improve performance. Here's a sketch of the
algorithm that tries to load the rule that generates some target file `t`.
algorithm that tries to load the rule that generates some target file ``t``.
- Get the directory that of `t`. Call it `d`.
- Get the directory that of ``t``. Call it ``d``.
- Load all rules in `d` into a map from targets in that directory to rules that
produce it.
- Load all rules in ``d`` into a map from targets in that directory to rules
that produce it.
- Look up the rule for `t` in this map.
- Look up the rule for ``t`` in this map.
To adhere to this loading scheme, we must generate our rules as part of the
callback that creates targets in that directory. See the ``Gen_rules`` module
Expand Down Expand Up @@ -383,7 +396,9 @@ For project names, use the following capitalization:
- **OCaml**
- **OCamlFormat**, and ``ocamlformat`` is the command.
- ``odoc``, always in monospace.
- **opam**. Can be capitalised as Opam in titles and at the beginning of sentences only, as the official name is formatted opam. The command is ``opam``.
- **opam**. Can be capitalised as Opam at the beginning of sentences only, as
the official name is formatted opam. Even in titles, headers, and subheaders,
it should be all lowercase: opam. The command is ``opam``.
- **esy**. Can be capitalised as Esy.
- **Nix**. The command is ``nix``.
- **Js_of_ocaml** can be abbreviated **JSOO**.
Expand Down Expand Up @@ -534,7 +549,7 @@ Good:
no idea what invariant is broken by the ``assert false``. Kindly describe it
to the reader in the error message.
- Avoid meaningless names like `x`, `a`, `b`, `f`. Try to find a more
- Avoid meaningless names like ``x``, ``a``, ``b``, ``f``. Try to find a more
descriptive name or just inline it altogether.
- If a module ``Foo`` has a module type ``Foo.S`` and you'd like to avoid
Expand Down Expand Up @@ -687,21 +702,21 @@ Benchmarking
Dune Bench
----------
You can benchmark Dune's performance by running `make bench`. This will run a
You can benchmark Dune's performance by running ``make bench``. This will run a
subset of the Duniverse. If you are running the bench locally, make sure that
you bootstrap since that is the executable that the bench will run.
The bench will build a specially selected portion of the Duniverse once, called
a "clean build". Afterwards, the build will be run 5 more times and are termed
the "Null builds".
In each run of the CI, there will be an `ocaml-benchmarks` status in the
sumamry. Clicking `Details` will show a bench report.
In each run of the CI, there will be an ``ocaml-benchmarks`` status in the
sumamry. Clicking ``Details`` will show a bench report.
The report contains the following information:
- The build times for Clean and Null builds.
- The size of the `dune.exe` binary.
- The size of the ``dune.exe`` binary.
- User CPU times for the Clean and Null builds.
- System CPU times for the Clean and Null builds.
- All the garbage collection stats apart from "forced collections" for Clean and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,8 @@ We can also show the original source if it is not preprocessed

$ dune describe pp src/util.ml
let log str = print_endline str

We also make sure that the dump file is not present

$ dune_cmd exists profile.dump
true
15 changes: 13 additions & 2 deletions test/blackbox-tests/test-cases/github8041.t
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
$ cat > dune-project << EOF
> (lang dune 1.0)
> (lang dune 2.4)
> (package
> (name p))
> EOF

$ cat > dune << EOF
> (rule (copy data.txt data2.txt))
>
> (install
> (files data.txt)
> (files data.txt data2.txt)
> (section share))
> EOF

Expand All @@ -15,3 +17,12 @@
If sendfile fails, we should fallback to the portable implementation.

$ strace -e inject=sendfile:error=EINVAL -o /dev/null dune build @install
Error: _build/default/data2.txt: Permission denied
-> required by _build/default/data2.txt
-> required by _build/install/default/share/p/data2.txt
-> required by _build/default/p.install
-> required by alias install
[1]

#8210: data2.txt is copied from readonly-file data.txt (#3092), so it needs to
be adequately unlinked before starting the fallback.

0 comments on commit b587f3c

Please sign in to comment.