Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(builtin): reduce linker debug string allocations #3309

Merged
merged 1 commit into from
Feb 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions internal/linker/link_node_modules.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ runtimes to locate all the first-party packages.
load("//internal/providers:external_npm_package_info.bzl", "ExternalNpmPackageInfo")
load("@rules_nodejs//nodejs:providers.bzl", "LinkablePackageInfo")

def _debug(vars, *args):
def _debug(vars, format, args_tuple):
if "VERBOSE_LOGS" in vars.keys():
print("[link_node_modules.bzl]", *args)
print("[link_node_modules.bzl]", format % args_tuple)

LinkerPackageMappingInfo = provider(
doc = """Provider capturing package mappings for the linker to consume.""",
Expand Down Expand Up @@ -194,9 +194,9 @@ def _get_linker_package_mapping_info(target, ctx):
# Look for LinkablePackageInfo mapping in this node
# LinkablePackageInfo may be provided without a package_name so check for that case as well
if not LinkablePackageInfo in target:
_debug(ctx.var, "No LinkablePackageInfo for", target.label)
_debug(ctx.var, "No LinkablePackageInfo for %s", (target.label))
elif not target[LinkablePackageInfo].package_name:
_debug(ctx.var, "No package_name in LinkablePackageInfo for", target.label)
_debug(ctx.var, "No package_name in LinkablePackageInfo for %s", (target.label))
else:
linkable_package_info = target[LinkablePackageInfo]
package_path = linkable_package_info.package_path if hasattr(linkable_package_info, "package_path") else ""
Expand All @@ -207,7 +207,7 @@ def _get_linker_package_mapping_info(target, ctx):
link_path = linkable_package_info.path,
),
)
_debug(ctx.var, "target %s (package path: %s) adding module mapping %s: %s" % (
_debug(ctx.var, "target %s (package path: %s) adding module mapping %s: %s", (
target.label,
package_path,
linkable_package_info.package_name,
Expand Down