Skip to content
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: 2 additions & 0 deletions doc/changes/fixed/13045.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Fix failure to digest installed directory targets, allowing them to be used
as dependencies to other rules. (#13045, @anmonteiro)
2 changes: 1 addition & 1 deletion src/dune_digest/cached_digest.ml
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ let remove path =

module Untracked = struct
let source_or_external_file path =
peek_or_refresh_file ~allow_dirs:false (Path.outside_build_dir path)
peek_or_refresh_file ~allow_dirs:true (Path.outside_build_dir path)
;;

let invalidate_cached_timestamp path =
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
Test installed directory targets may be depended on

$ mkdir lib app prefix
$ cat > lib/dune-project <<EOF
> (lang dune 3.21)
> (package (name foo))
> (using directory-targets 0.1)
> EOF

$ cat > lib/dune <<EOF
> (rule (target (dir some_dir))
> (action
> (progn (system "mkdir %{target}")
> (system "echo hello from file inside dir target > %{target}/inside-dir-target.txt"))))
> (library (public_name foo) (modes byte))
> (install (section lib) (dirs some_dir))
> EOF

$ dune build --root lib
Entering directory 'lib'
Leaving directory 'lib'

$ cat lib/_build/default/foo.install
lib: [
"_build/install/default/lib/foo/META"
"_build/install/default/lib/foo/dune-package"
"_build/install/default/lib/foo/foo.cma"
"_build/install/default/lib/foo/foo.cmi"
"_build/install/default/lib/foo/foo.cmt"
"_build/install/default/lib/foo/foo.ml"
"_build/install/default/lib/foo/some_dir/inside-dir-target.txt" {"some_dir/inside-dir-target.txt"}
]

$ cat lib/_build/install/default/lib/foo/dune-package | grep some_dir
(lib (META dune-package foo.cma foo.cmi foo.cmt foo.ml (dir some_dir))))

$ dune install --root lib --prefix $PWD/prefix

$ cat > app/dune-project <<EOF
> (lang dune 3.21)
> (package (name app))
> EOF
$ cat > app/dune <<EOF
> (rule
> (target hello.txt)
> (deps %{lib:foo:some_dir})
> (action (system "cp %{deps}/inside-dir-target.txt %{target}")))
> EOF

$ OCAMLPATH=$PWD/prefix/lib/:$OCAMLPATH dune build --root app hello.txt
Entering directory 'app'
Leaving directory 'app'

$ cat app/_build/default/hello.txt
hello from file inside dir target
Loading