Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test(melange): show dependency cycle depending on runtime_deps in target dir #7322

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/dune_rules/melange/melange_rules.ml
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ let eval_runtime_deps ~expander (deps : Dep_conf.t list) =
(* TODO loc *)
User_error.raise [ Pp.text "sandbox settings are not allowed" ]);
let open Memo.O in
let+ paths, _ = Action_builder.run runtime_deps Eager in
let+ paths, _ = Action_builder.run runtime_deps Lazy in
paths

let setup_runtime_assets_rules sctx ~dir ~target_dir ~mode
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ Rules created for the assets in the output directory
[1]

$ dune build @mel --display=short
bash some_dir
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a separate PR, it would be good to switch this test to sh unless you need some special bash features.

melc .output.mobjs/melange/melange__Main.{cmi,cmj,cmt}
bash some_dir
melc output/main.js
Error: Is a directory
-> required by _build/default/output/some_dir
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,9 @@ The runtime_dep index.txt was copied to the build folder
hello from file




Test depending on non-existing paths

$ mkdir another
$ mkdir -p another/another-output/another
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had only ran the action builder eagerly because of this test, but it looks like creating its target dir in source makes the error pop up again, so it's rather an instance of #7207 and the recursive alias work that's gonna come after it.

$ dune clean
$ cat > another/dune <<EOF
> (melange.emit
Expand All @@ -66,9 +64,13 @@ Test depending on non-existing paths
> (runtime_deps doesnt-exist.txt))
> EOF

$ dune build @non-existing-mel --display=short
$ dune build @non-existing-mel
File "another/dune", line 1, characters 0-98:
1 | (melange.emit
2 | (alias non-existing-mel)
3 | (target another-output)
4 | (runtime_deps doesnt-exist.txt))
Error: No rule found for another/doesnt-exist.txt
-> required by alias another/non-existing-mel
[1]

Test depending on paths that "escape" the melange.emit directory
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@

$ cat > dune-project << EOF
> (lang dune 3.7)
> (using melange 0.1)
> EOF
$ mkdir output

$ cat > output/foo.txt <<EOF
> hello foo
> EOF
$ cat > dune << EOF
> (melange.emit
> (target output)
> (alias melange)
> (runtime_deps output/foo.txt))
> EOF

$ dune build @melange

$ ls _build/default/output
foo.txt
output
$ ls _build/default/output/output
foo.txt