Skip to content

Commit 157aebc

Browse files
committed
[dev-script] Add a new script called at-to-filelist.
This script in combination with <(...) can be used to speed up creating reproductions from command lines that use '@' files to define their inputs. An example use case: Consider a swiftc command line that uses the @ symbol. swiftc @/foo/bar/baz.txt When this is run, the @ command is expanded into a filelist in a temporary file. This doesn't work with -### since -### outputs the command line with a temporary file for the filelist, but uses a path to a temporary file that doesn't exist, e.g.: swift -frontend -filelist /tmp/tmp.filelist ... To run this command, you use the at-to-filelist command as follows: swift -frontend -filelist <(at-to-filelist /foo/bar/baz.txt)
1 parent 4c9190e commit 157aebc

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

utils/dev-scripts/at-to-filelist

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
3+
# Transform an @ file into a file list.
4+
#
5+
# The intended use case is given an @ path passed to swift, use this script and
6+
# bash to automagically expand the @ path by transforming:
7+
#
8+
# @/foo/bar/baz.txt
9+
#
10+
# =>
11+
#
12+
# <(at-to-filelist /foo/bar/baz.txt)
13+
#
14+
# For those unaware, <(...) causes bash to output the subshell's output into a
15+
# file and then replace <(...) with the path to that temporary file.
16+
#
17+
# Example:
18+
#
19+
# Consider a swiftc command line that uses the @ symbol.
20+
#
21+
# swiftc @/foo/bar/baz.txt
22+
#
23+
# When this is run, the @ command is expanded into a filelist in a temporary
24+
# file. This doesn't work with -### since -### outputs the command line with a
25+
# temporary file for the filelist, but uses a path to a temporary file that
26+
# doesn't exist, e.g.:
27+
#
28+
# swift -frontend -filelist /tmp/tmp.filelist ...
29+
#
30+
# To run this command, you use the at-to-filelist command as follows:
31+
#
32+
# swift -frontend -filelist <(at-to-filelist /foo/bar/baz.txt)
33+
cat ${1} | tr -s ";" "\n"
34+
35+
echo

0 commit comments

Comments
 (0)