File: order-only-deps.ninja

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (55 lines) | stat: -rw-r--r-- 1,859 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# Test the behavior of order-only dependencies.

# We run the build in a sandbox in the temp directory to ensure we don't
# interact with the source dirs.
#
# RUN: rm -rf %t.build
# RUN: mkdir -p %t.build
# RUN: cp %s %t.build/build.ninja
# RUN: echo "input-1" > %t.build/input-1
# RUN: echo "input-2" > %t.build/input-2
# RUN: echo "input-3" > %t.build/input-3
# RUN: %{llbuild} ninja build --jobs 1 --chdir %t.build &> %t1.out
# RUN: %{FileCheck} --check-prefix=CHECK-INITIAL --input-file=%t1.out %s
# RUN: %{FileCheck} --check-prefix=CHECK-INITIAL-OUTPUT --input-file=%t.build/output %s

# Verify that the first build builds output-2 after output-1 and output-3.
#
# CHECK-INITIAL: [1/{{.*}}] "cp input-1 output-1"
# CHECK-INITIAL: [2/{{.*}}] "cp input-3 output-3"
# CHECK-INITIAL: [3/{{.*}}] "cp input-2 output-2"
# CHECK-INITIAL: [4/{{.*}}] "cat output-1 output-2 output-3 > output"
#
# Verify the output matches expectations.
#
# CHECK-INITIAL-OUTPUT: input-1
# CHECK-INITIAL-OUTPUT-NEXT: input-2
# CHECK-INITIAL-OUTPUT-NEXT: input-3


# Run a second build, after modifying "input-1". Only output-1 and the final
# output should rebuild, since the dependencies are order only.
#
# RUN: echo "input-1-mod" >> %t.build/input-1
# RUN: %{llbuild} ninja build --strict --jobs 1 --chdir %t.build &> %t2.out
# RUN: %{FileCheck} --check-prefix=CHECK-AFTER-MOD --input-file=%t2.out %s

# Check the second build.
#
# CHECK-AFTER-MOD: [1/{{.*}}] "cp input-1 output-1"
# CHECK-AFTER-MOD: [2/{{.*}}] "cat output-1 output-2 output-3 > output"


rule CP
     command = cp ${in} ${out}
     description = "${command}"
rule CAT
     command = cat ${in} > ${out}
     description = "${command}"

build output-1: CP input-1
build output-2: CP input-2 || output-1 output-3
build output-3: CP input-3 || output-1
build output: CAT output-1 output-2 output-3

default output