Skip to content

Commit ea3510e

Browse files
committed
Swift: DX changes based on my new setup experience
1 parent 8664017 commit ea3510e

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

swift/README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1+
# Swift on CodeQL
2+
13
## Warning
24

3-
The Swift codeql package is an experimental and unsupported work in progress.
5+
The Swift CodeQL package is an experimental and unsupported work in progress.
46

5-
## Usage
7+
## Building the Swift extractor
68

79
First ensure you have Bazel installed, for example with
810

@@ -13,16 +15,17 @@ brew install bazelisk
1315
then from the `ql` directory run
1416

1517
```bash
16-
bazel run //swift:create-extractor-pack
18+
bazel run //swift:create-extractor-pack # --cpu=darwin_x86_64 # Uncomment on Arm-based Macs
1719
```
1820

1921
which will install `swift/extractor-pack`.
2022

21-
Using `--search-path=swift/extractor-pack` will then pick up the Swift extractor. You can also use
22-
`--search-path=.`, as the extractor pack is mentioned in the root `codeql-workspace.yml`.
23-
2423
Notice you can run `bazel run :create-extractor-pack` if you already are in the `swift` directory.
2524

25+
Using `codeql ... --search-path=swift/extractor-pack` will then pick up the Swift extractor. You can also use
26+
`--search-path=.`, as the extractor pack is mentioned in the root `codeql-workspace.yml`. Alternatively, you can
27+
set up the search path in [the per-user CodeQL configuration file](https://codeql.github.com/docs/codeql-cli/specifying-command-options-in-a-codeql-configuration-file/#using-a-codeql-configuration-file).
28+
2629
## Code generation
2730

2831
Run

swift/tools/qltest.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,7 @@ for src in *.swift; do
1010
opts=(-sdk "$CODEQL_EXTRACTOR_SWIFT_ROOT/qltest/$CODEQL_PLATFORM/sdk" -c -primary-file $src)
1111
opts+=($(sed -n '1 s=//codeql-extractor-options:==p' $src))
1212
echo -e "calling extractor with flags: ${opts[@]}\n" >> $QLTEST_LOG
13-
"$CODEQL_EXTRACTOR_SWIFT_ROOT/tools/$CODEQL_PLATFORM/extractor" "${opts[@]}" >> $QLTEST_LOG 2>&1
13+
"$CODEQL_EXTRACTOR_SWIFT_ROOT/tools/$CODEQL_PLATFORM/extractor" "${opts[@]}" >> $QLTEST_LOG 2>&1 || FAILED=1
1414
done
15+
16+
[ -z "$FAILED" ] || cat "$QLTEST_LOG" # Show compiler errors on extraction failure

0 commit comments

Comments
 (0)