Skip to content

Commit 00b0e8f

Browse files
r-barnesmeta-codesync[bot]
authored andcommitted
Runtime dependency handling - migrate from none to no_symlink
Summary: Removing `none` means that each enum option labels its own specific behaviour. `no_symlink` replaces none. Reviewed By: JakobDegen Differential Revision: D96349347 fbshipit-source-id: cedcdfc7fada33306e043e0c304395139986782d
1 parent 8c23ffd commit 00b0e8f

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

prelude/cxx/cxx_executable.bzl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,11 @@ def _get_shared_library_symlink_deps(
10041004
[d.shared_library_info for d in link_deps] +
10051005
[d.shared_library_info for d in impl_params.extra_link_roots]
10061006
)
1007+
elif impl_params.runtime_dependency_handling == RuntimeDependencyHandling("no_symlink"):
1008+
# Do not create a shared library symlink tree alongside the executable.
1009+
pass
10071010
elif impl_params.runtime_dependency_handling == RuntimeDependencyHandling("symlink"):
1011+
# Include all transitive runtime shared library deps in a symlink tree.
10081012
for linkable_node in linkable_graph.nodes.traverse():
10091013
if linkable_node.linkable == None:
10101014
continue
@@ -1013,6 +1017,7 @@ def _get_shared_library_symlink_deps(
10131017
if output_style == LibOutputStyle("shared_lib") and not linkable_node.linkable.stub:
10141018
shlib_deps.append(merge_shared_libraries(ctx.actions, node = linkable_node.linkable.shared_libs))
10151019
elif impl_params.runtime_dependency_handling == RuntimeDependencyHandling("symlink_single_level_only"):
1020+
# Include only first-level (direct) runtime shared library deps in a symlink tree.
10161021
for d in link_deps + impl_params.extra_link_roots:
10171022
if d.linkable_graph == None:
10181023
continue

prelude/cxx/cxx_toolchain_types.bzl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,6 @@ PicBehavior = enum(
216216

217217
# Additional behavior for how to handle runtime dependencies
218218
RuntimeDependencyHandling = enum(
219-
# Do no additional handling (alias for "no_symlink" - hopefully we can remove this one)
220-
"none",
221219
# Do no additional handling
222220
"no_symlink",
223221
# Always include runtime dependencies in a symlink tree, regardless
@@ -338,7 +336,7 @@ def cxx_toolchain_infos(
338336
objc_compiler_info = None,
339337
objcxx_compiler_info = None,
340338
cxx_error_handler = None,
341-
runtime_dependency_handling = RuntimeDependencyHandling("none")):
339+
runtime_dependency_handling = RuntimeDependencyHandling("no_symlink")):
342340
"""
343341
Creates the collection of cxx-toolchain Infos for a cxx toolchain.
344342

prelude/decls/cxx_common.bzl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -322,9 +322,8 @@ def _version_arg():
322322
def _runtime_dependency_handling_arg():
323323
return {
324324
"runtime_dependency_handling": attrs.option(attrs.enum(RuntimeDependencyHandling), default = None, doc = """
325-
Controls how shared library dependencies are handled at runtime. By default the `none` behaviour
326-
is used. In the future this behaviour will be named `no_symlink`. Both behaviours opt out of
327-
symlink creation. If `symlink` is specified then shared library dependencies with
325+
Controls how shared library dependencies are handled at runtime. By default the `no_symlink` behaviour
326+
is used, which opts out of symlink creation. If `symlink` is specified then shared library dependencies with
328327
`preferred_linkage = "shared"` are automatically detected and included in a symlink tree
329328
alongside the executable. Set to `symlink_single_level_only` to only include first-level runtime
330329
dependencies in a symlink tree.

prelude/toolchains/cxx.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def _cxx_toolchain_from_cxx_tools_info(ctx: AnalysisContext, cxx_tools_info: Cxx
225225
pic_behavior = pic_behavior,
226226
llvm_link = llvm_link,
227227
use_dep_files = True,
228-
runtime_dependency_handling = RuntimeDependencyHandling("none"),
228+
runtime_dependency_handling = RuntimeDependencyHandling("no_symlink"),
229229
),
230230
CxxPlatformInfo(name = target_name),
231231
]

0 commit comments

Comments
 (0)