File: directory-input-and-output.llbuild

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 (140 lines) | stat: -rw-r--r-- 3,819 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# Some files are written to /tmp/raw/
# TaskA reads /tmp/raw/ and produces /tmp/headers/
# TaskB reads /tmp/headers/ and produces /tmp/headers-copy/
# TaskC reads /tmp/headers-copy/libX.fake-h and produces /tmp/libX-from-TaskC.fake-h
#
# This test check many things at once and is intended for overall sanity check of all pieces.
#
# raw/
#  |   libX.fake-h <-- written on disk (initial state)
#  |   libY.fake-h <-- written on disk (initial state)
#  |   libZ.fake-h <-- written on disk (initial state)
#  v
# [TaskA] (verbatim copy; mixed case)
#  |
#  v
# headers/
#  |   libX.fake-h
#  |   libY.fake-h
#  |   libZ.fake-h
#  v
# [TaskB] (modified copy; ALL CAPS)
#  |
#  v
# headers-copy/
#      libX.fake-h
#  ,-- libY.fake-h (will be automatically amended to outputs of TaskB)
#  |   libZ.fake-h
#  v
# [TaskC] (modified copy; all lower case)
#  |
#  v
# libY-from-TaskC.fake-h
#
# RUN: rm -rf "%t.build"
# RUN: mkdir -p "%t.build/raw"
# RUN: echo "Contents of libX.fake-h" > "%t.build/raw/libX.fake-h"
# RUN: echo "Contents of libY.fake-h" > "%t.build/raw/libY.fake-h"
# RUN: echo "Contents of libZ.fake-h" > "%t.build/raw/libZ.fake-h"
# RUN: cat %s > "%t.build/build.llbuild"
# RUN: %{llbuild} buildsystem build --serial --chdir %t.build --trace %t.trace > %t.out
# RUN: %{FileCheck} --input-file=%t.out %s
#
# CHECK: TaskA
# CHECK: Contents of libX.fake-h
# CHECK: Contents of libY.fake-h
# CHECK: Contents of libZ.fake-h
# CHECK: TaskB
# CHECK: CONTENTS OF LIBX.FAKE-H
# CHECK: CONTENTS OF LIBY.FAKE-H
# CHECK: CONTENTS OF LIBZ.FAKE-H
# CHECK: TaskC
# CHECK: contents of liby.fake-h
#
# Check that a null build does nothing.
#
# RUN: %{llbuild} buildsystem build --serial --chdir %t.build --trace %t.trace > %t2.out
# RUN: echo "PREVENT-EMPTY-FILE" >> %t2.out
# RUN: %{FileCheck} --input-file=%t2.out %s --check-prefix=CHECK-NULL
# CHECK-NULL-NOT: TaskA
# CHECK-NULL-NOT: TaskB
# CHECK-NULL-NOT: TaskC
#
# Check modifying libY.fake-h rebuilds TaskC
#
# RUN: echo "Updated contents of libY.fake-h" > "%t.build/raw/libY.fake-h"
# RUN: %{llbuild} buildsystem build --serial --chdir %t.build --trace %t.trace > %t3.out
# RUN: %{FileCheck} --input-file=%t3.out %s --check-prefix=CHECK-UPDATE-Y
# CHECK-UPDATE-Y: TaskA
# CHECK-UPDATE-Y: Updated contents of libY.fake-h
# CHECK-UPDATE-Y: TaskB
# CHECK-UPDATE-Y: UPDATED CONTENTS OF LIBY.FAKE-H
# CHECK-UPDATE-Y: TaskC
# CHECK-UPDATE-Y: updated contents of liby.fake-h

client:
  name: basic
  file-system: default
  perform-ownership-analysis: yes

targets:
  basic: ["libY-from-TaskC.fake-h/"]

# define the default target to execute when this manifest is loaded.
default: basic

commands:
  taskC:
    tool: shell
    inputs: ["headers-processed/libY.fake-h/"]
    outputs: ["libY-from-TaskC.fake-h/"]
    description: "TaskC"
    args: '
      set -o errexit
      set -o nounset

      [ -f "headers-processed/libY.fake-h" ]
      cat "headers-processed/libY.fake-h" | tr A-Z a-z > libY-from-TaskC.fake-h
      cat libY-from-TaskC.fake-h
      '

  taskB:
    tool: shell
    inputs: ["headers/"]
    outputs: ["headers-processed/"]
    description: "TaskB"
    args: '
      set -o errexit
      set -o nounset

      mkdir -p "headers-processed/"
      for headerFile in headers/*.fake-h
      do
          outputFile=headers-processed/$(basename "$headerFile")
          cat "$headerFile" | tr a-z A-Z > "$outputFile"
          cat $outputFile
      done
      '
    repair-via-ownership-analysis: true

  taskA:
    tool: shell
    inputs: ["raw/"]
    outputs: ["headers/"]
    description: "TaskA"
    args: '
      set -o errexit
      set -o nounset

      mkdir -p headers/
      cd headers/

      for headerFile in ../raw/*.fake-h
      do
          cp "$headerFile" .
      done

      ls .
      cat *
      '
    repair-via-ownership-analysis: true