-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_bazel_rules_nodejs.patch
36 lines (31 loc) · 1.22 KB
/
build_bazel_rules_nodejs.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
--- internal/common/expand_into_runfiles.bzl
+++ internal/common/expand_into_runfiles.bzl
@@ -32,22 +32,28 @@ def expand_location_into_runfiles(ctx, path):
return expand_path_into_runfiles(ctx, path)
def expand_path_into_runfiles(ctx, path):
- """Expand a path into runfiles.
+ """Expand paths into runfiles.
- Given a file path that might contain a $(location) label expansion,
- provide the path to the file in runfiles.
+ Given a file path that might contain a $(location) or $(locations) label expansion,
+ provide the paths to the file in runfiles.
See https://docs.bazel.build/versions/master/skylark/lib/ctx.html#expand_location
Args:
ctx: context
- path: the path to expand
+ path: the paths to expand
Returns:
- The expanded path
+ The expanded paths
"""
targets = ctx.attr.data if hasattr(ctx.attr, "data") else []
expanded = ctx.expand_location(path, targets)
+
+ expansion = [resolve_expanded_path(ctx, exp) for exp in expanded.strip().split(" ")]
+
+ return " ".join(expansion)
+
+def resolve_expanded_path(ctx, expanded):
if expanded.startswith("../"):
return expanded[len("../"):]
if expanded.startswith(ctx.bin_dir.path):