This commit is contained in:
swrup 2025-11-11 02:07:51 +01:00
parent aa2ff7b2f0
commit 2f3113f55d
11742 changed files with 1223940 additions and 0 deletions

View file

@ -0,0 +1,11 @@
open Dune_action_plugin.V1
let action =
let open Dune_action_plugin.V1.O in
let switch = read_file ~path:(Path.of_string "foo_or_bar") in
stage switch ~f:(fun file ->
let+ data = read_file ~path:(Path.of_string file) in
print_endline data)
;;
let () = run action

View file

@ -0,0 +1,3 @@
(executables
(names client)
(libraries dune-action-plugin))

View file

@ -0,0 +1,3 @@
(cram
(deps
(glob_files bin/*.exe)))

View file

@ -0,0 +1,57 @@
This test checks that in case the dependency of multi staged computation changes,
only the dependencies up to this stage are rebuilt.
$ cat > dune-project << EOF
> (lang dune 2.0)
> (using action-plugin 0.1)
> EOF
$ cat > dune << EOF
> (rule
> (deps bar_source)
> (target bar)
> (action
> (progn
> (echo "Building bar!\n")
> (copy %{deps} %{target}))))
> \
> (rule
> (deps foo_source)
> (target foo)
> (action
> (progn
> (echo "Building foo!\n")
> (copy %{deps} %{target}))))
> \
> (rule
> (deps foo_or_bar_source)
> (target foo_or_bar)
> (action
> (progn
> (echo "Building foo_or_bar!\n")
> (copy %{deps} %{target}))))
> \
> (rule
> (alias runtest)
> (action (dynamic-run ./client.exe)))
> EOF
$ cp ./bin/client.exe ./
$ printf "foo" > foo_or_bar_source
$ printf "Hello from foo!" > foo_source
$ printf "SHOULD NOT BE PRINTED!" > bar_source
$ dune runtest
Building foo_or_bar!
Building foo!
Hello from foo!
$ printf "bar" > foo_or_bar_source
$ printf "SHOULD NOT BE PRINTED!" > foo_source
$ printf "Hello from bar!" > bar_source
$ dune runtest
Building foo_or_bar!
Building bar!
Hello from bar!