Files
codeql/misc/bazel/pkg_runfiles.bzl
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

34 lines
794 B
Python

load("@rules_pkg//:mappings.bzl", "pkg_attributes", "pkg_files")
def _runfiles_group_impl(ctx):
files = []
for src in ctx.attr.srcs:
rf = src[DefaultInfo].default_runfiles
if rf != None:
files.append(rf.files)
return [
DefaultInfo(
files = depset(transitive = files),
),
]
_runfiles_group = rule(
implementation = _runfiles_group_impl,
attrs = {
"srcs": attr.label_list(),
},
)
def pkg_runfiles(*, name, srcs, **kwargs):
internal_name = "_%s_runfiles" % name
_runfiles_group(
name = internal_name,
srcs = srcs,
)
kwargs.setdefault("attributes", pkg_attributes(mode = "0755"))
pkg_files(
name = name,
srcs = [internal_name],
**kwargs
)