From 2c3af75d508d0a183dc14a88ce6062d16819835c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laurenz=20Altenm=C3=BCller?= Date: Thu, 31 Oct 2024 16:30:11 +0100 Subject: [PATCH 1/2] Support `--legacy_external_runfiles` --- perl/perl.bzl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/perl/perl.bzl b/perl/perl.bzl index 5115402..2d619eb 100644 --- a/perl/perl.bzl +++ b/perl/perl.bzl @@ -102,7 +102,10 @@ def transitive_deps(ctx, extra_files = [], extra_deps = []): def _include_paths(ctx): """Calculate the PERL5LIB paths for a perl_library rule's includes.""" - package_root = (ctx.label.workspace_root + "/" + ctx.label.package).strip("/") or "." + workspace_root = ctx.label.workspace_root + if workspace_root.startswith("external/"): + workspace_root = "../" + workspace_root[9:] + package_root = (workspace_root + "/" + ctx.label.package).strip("/") or "." include_paths = [package_root] if "." in ctx.attr.includes else [] include_paths.extend([package_root + "/" + include for include in ctx.attr.includes if include != "."]) for dep in ctx.attr.deps: From 9907df76dc5aef1774eb542926d07c027e5fb0c5 Mon Sep 17 00:00:00 2001 From: Laurenz Date: Thu, 31 Oct 2024 21:23:16 +0100 Subject: [PATCH 2/2] Update perl/perl.bzl Co-authored-by: Fabian Meumertzheim --- perl/perl.bzl | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/perl/perl.bzl b/perl/perl.bzl index 2d619eb..60e5b1e 100644 --- a/perl/perl.bzl +++ b/perl/perl.bzl @@ -102,9 +102,11 @@ def transitive_deps(ctx, extra_files = [], extra_deps = []): def _include_paths(ctx): """Calculate the PERL5LIB paths for a perl_library rule's includes.""" - workspace_root = ctx.label.workspace_root - if workspace_root.startswith("external/"): - workspace_root = "../" + workspace_root[9:] + workspace_name = ctx.label.workspace_name + if workspace_name: + workspace_root = "../" + workspace_name + else: + workspace_root = "" package_root = (workspace_root + "/" + ctx.label.package).strip("/") or "." include_paths = [package_root] if "." in ctx.attr.includes else [] include_paths.extend([package_root + "/" + include for include in ctx.attr.includes if include != "."])