mirror of
https://github.com/github/codeql.git
synced 2026-07-31 07:22:56 +02:00
The extractor shells out to a separate `swift-syntax-parse` binary, but
nothing placed it in the extractor pack, so a shipped Swift extraction
failed at the first spawn. Package it next to the extractor, the same
way `//swift/extractor` ships its Swift-linked binary: a small wrapper
points the dynamic loader at its own directory and execs the real
binary, whose Swift runtime libraries travel alongside it.
- `swift-syntax-parse.sh`: wrapper that sets `LD_LIBRARY_PATH` /
`DYLD_LIBRARY_PATH` to its directory and execs
`swift-syntax-parse.real`
(mirrors `swift/extractor/extractor.sh`).
- `runtime.bzl`: a `swift_runtime_libs` rule that selects just the Linux
Swift runtime shared objects (`usr/lib/swift/linux/*.so`) out of the
full toolchain, so only they — not the whole toolchain — travel with
the binary.
- `swift-syntax-rs/BUILD.bazel`: the `rust_binary` becomes
`swift-syntax-parse.real`
and carries the runtime libraries as runfiles on Linux; a `sh_binary`
(`swift-syntax-parse`) is the wrapper; `codeql_pkg_runfiles` flattens
the three (wrapper, real binary, runtime) into one directory.
- `BUILD.bazel`: ship that group under `tools/{CODEQL_PLATFORM}` next to
the extractor, on the platforms where swift-syntax builds
(Linux/macOS).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
13 lines
380 B
Bash
Executable File
13 lines
380 B
Bash
Executable File
#!/bin/bash
|
|
|
|
# Wrapper that lets the shipped `swift-syntax-parse` find its Swift runtime
|
|
# libraries, which are packaged in the same directory as this script (and the
|
|
# real binary). Mirrors `swift/extractor/extractor.sh`.
|
|
if [[ "$(uname)" == Darwin ]]; then
|
|
export DYLD_LIBRARY_PATH=$(dirname "$0")
|
|
else
|
|
export LD_LIBRARY_PATH=$(dirname "$0")
|
|
fi
|
|
|
|
exec -a "$0" "$0.real" "$@"
|