Files
codeql/swift/BUILD.bazel
Paolo Tranquilli c2be267feb Swift: enable dynamic mode
Providing `--dynamic_mode=fully` (for example setting it in
`local.bazelrc`) will now work.

All runfiles are now copied in the extractor pack: in dynamic mode,
those will be the executable and the dynamic libraries, while in static
mode only the executable will be part of the runfiles.

Setting the correct `LD_LIBRARY_PATH` in `qltest.sh` then allows to
run tests with this pakcage. If we need something more, we can switch to
a wrapper script in place of `extractor` in the future.

Notice that `LD_LIBRARY_PATH` is also set in static mode, but that has
no consequence.
2022-05-03 12:33:24 +02:00

91 lines
1.9 KiB
Python

load("@rules_pkg//:mappings.bzl", "pkg_attributes", "pkg_filegroup", "pkg_files", "strip_prefix")
load("@rules_pkg//:install.bzl", "pkg_install")
load("//:defs.bzl", "codeql_platform")
load("//misc/bazel:pkg_runfiles.bzl", "pkg_runfiles")
filegroup(
name = "dbscheme",
srcs = ["ql/lib/swift.dbscheme"],
visibility = ["//visibility:public"],
)
pkg_files(
name = "dbscheme_files",
srcs = [
"ql/lib/swift.dbscheme.stats",
":dbscheme",
],
)
pkg_files(
name = "qltest",
srcs = ["tools/qltest.sh"],
attributes = pkg_attributes(mode = "0755"),
prefix = "tools",
)
pkg_files(
name = "tracing-config",
srcs = ["tools/tracing-config.lua"],
prefix = "tools",
)
pkg_files(
name = "manifest",
srcs = ["codeql-extractor.yml"],
)
pkg_filegroup(
name = "extractor-pack-generic",
srcs = [
":dbscheme_files",
":manifest",
":qltest",
":tracing-config",
],
visibility = ["//visibility:public"],
)
pkg_runfiles(
name = "extractor",
srcs = ["//swift/extractor"],
prefix = "tools/" + codeql_platform,
)
pkg_files(
name = "swift-test-sdk-arch",
srcs = ["//swift/tools/prebuilt:swift-test-sdk"],
prefix = "qltest/" + codeql_platform,
strip_prefix = strip_prefix.from_pkg(),
)
pkg_filegroup(
name = "extractor-pack-arch",
srcs = [
":extractor",
":swift-test-sdk-arch",
],
visibility = ["//visibility:public"],
)
pkg_filegroup(
name = "extractor-pack",
srcs = [
":extractor-pack-arch",
":extractor-pack-generic",
],
visibility = ["//visibility:public"],
)
pkg_install(
name = "_create_extractor_pack",
srcs = ["//swift:extractor-pack"],
)
py_binary(
name = "create-extractor-pack",
srcs = ["tools/create_extractor_pack.py"],
main = "tools/create_extractor_pack.py",
deps = [":_create_extractor_pack"],
)