Skip to content

Commit dfaffac

Browse files
committed
[tests] Add explicit test for synthetic edges on directory tree nodes.
- Also, add a doc note on this behavior.
1 parent 68b2954 commit dfaffac

File tree

3 files changed

+47
-0
lines changed

3 files changed

+47
-0
lines changed

docs/buildsystem-internals.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ discovers, as follows:
5959
directory, but which **are** the output of some task. The client is
6060
currently responsible for ensuring that any commands which produce output
6161
in the directory should be strongly ordered before the signature node.
62+
63+
However, clients can explicitly make additional dependencies on the
64+
directory tree by registering a phony command which produces the directory
65+
used by the tree signature, and which adds input dependencies on other
66+
nodes in the graph (for example, ones which may or may not produce content
67+
within the directory tree, and thus must be run before it).
6268
```
6369

6470
3. Recursively request directory signatures for any directories discovered as

docs/buildsystem.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,14 @@ These are the supported node types:
8181
file on disk is changed. This is useful when the client cannot easily know
8282
in advance whether the node is expected to be a file or a directory, but
8383
should be treated as a directory tree if it is one.
84+
85+
The directory tree will eagerly scan the directory as soon as any commands
86+
which produce the immediate directory are complete. This means that the build
87+
graph **MUST** contain a complete dependency graph between the tree node and
88+
any command which may produce content within the directory. If such a
89+
dependency is missing, the build system will typically end up scanning the
90+
directory before all content is produced, and this will result in the first
91+
build being incomplete, and the next build redoing the remainder of the work.
8492

8593
* Virtual Nodes: Nodes matching the name ``'<.*>'``, e.g. ``<gate-task>``, are
8694
*assumed* to be virtual nodes, and are used for adding arbitrary edges to the
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Check the ability of clients to add additional dependency on a directory tree.
2+
#
3+
4+
# This is important because currently llbuild won't necessarily try to find any
5+
# unmodeled dependency edges between outputs which fill in contents of a
6+
# directory and the directory tree node itself. Currently, clients must supply
7+
# any missing unmodeled edges explicitly.
8+
#
9+
# RUN: rm -rf %t.build
10+
# RUN: mkdir -p %t.build
11+
# RUN: cp %s %t.build/build.llbuild
12+
# RUN: echo "file" > %t.build/file
13+
# RUN: %{llbuild} buildsystem build --serial --chdir %t.build > %t.initial.out
14+
# RUN: %{FileCheck} --check-prefix=CHECK-INITIAL --input-file=%t.initial.out %s
15+
#
16+
# CHECK-INITIAL: SUBDIR-CONTENTS
17+
18+
client:
19+
name: basic
20+
21+
targets:
22+
"": ["subdir/"]
23+
24+
commands:
25+
C.subdir-dependencies:
26+
tool: phony
27+
inputs: ["<subdir-contents>"]
28+
outputs: ["subdir"]
29+
C.subdir-contents:
30+
tool: shell
31+
description: SUBDIR-CONTENTS
32+
outputs: ["<subdir-contents>"]
33+
args: mkdir -p subdir && touch subdir/foo

0 commit comments

Comments
 (0)