-
Notifications
You must be signed in to change notification settings - Fork 415
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[merlin] Cleanup leftover merlin files (#4261)
* Make Build_system delete left-over `.merlin` files * simplify code managing the Promoted_to_delete db * Add a test for merlin files cleanup Signed-off-by: Ulysse Gérard <[email protected]> Co-authored-by: Arseniy Alekseyev <[email protected]>
- Loading branch information
1 parent
f839fc1
commit 20df2de
Showing
4 changed files
with
138 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
test/blackbox-tests/test-cases/promote/merlin-files.t/dune-project
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
(lang dune 2.8) |
Empty file.
59 changes: 59 additions & 0 deletions
59
test/blackbox-tests/test-cases/promote/merlin-files.t/run.t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
To mimic the behavior of Dune < 2.8 we add rules generating and promoting | ||
until-clean .merlin files in both source folders (root and subfolder subdir) | ||
We also add an other promotion that should not be impacted by these changes. | ||
$ cat >dune <<EOF | ||
> (executable | ||
> (name foo) | ||
> (promote (until-clean))) | ||
> | ||
> (rule | ||
> (targets .merlin) | ||
> (action (with-stdout-to .merlin (echo "test"))) | ||
> (mode (promote (until-clean)))) | ||
> EOF | ||
|
||
$ mkdir subdir | ||
|
||
$ cat >subdir/dune <<EOF | ||
> (rule | ||
> (targets .merlin) | ||
> (action (with-stdout-to .merlin (echo "test"))) | ||
> (mode (promote (until-clean)))) | ||
> EOF | ||
|
||
Building the project will promote .merlin files and foo.exe | ||
$ dune build | ||
$ ls -a | grep -i -e .merlin -e foo.exe | ||
.merlin | ||
foo.exe | ||
|
||
$ ls -a subdir | grep -i -e .merlin -e foo.exe | ||
.merlin | ||
|
||
Nothing happen on rebuild, rules are still in place, promoted files remain | ||
$ dune build --verbose 2>&1 | grep "left-over" | ||
[1] | ||
|
||
$ ls -a | grep -i -e .merlin -e foo.exe | ||
.merlin | ||
foo.exe | ||
|
||
$ ls -a subdir | grep -i -e .merlin -e foo.exe | ||
.merlin | ||
|
||
Now we remove the rules with promotions | ||
$ cat >dune <<EOF | ||
> EOF | ||
$ cat >subdir/dune <<EOF | ||
> EOF | ||
|
||
Next build Dune will delete the leftover .merlin but not foo.exe | ||
$ dune build --verbose 2>&1 | grep "left-over" | ||
Deleting left-over Merlin file .merlin. | ||
Deleting left-over Merlin file subdir/.merlin. | ||
|
||
$ ls -a | grep -i -e .merlin -e foo.exe | ||
foo.exe | ||
|
||
$ ls -a subdir | grep -i -e .merlin -e foo.exe | ||
[1] |