File tree 2 files changed +27
-2
lines changed 2 files changed +27
-2
lines changed Original file line number Diff line number Diff line change 63
63
(should-error (elisp/runfiles/rlocation " __init__.py" runfiles)
64
64
:type 'elisp/runfiles/empty )))
65
65
66
+ (ert-deftest elisp/runfiles/make/manifest/directory ()
67
+ " Check that we find runfiles in a mapped directory.
68
+ See https://github.com/bazelbuild/bazel/issues/14336 for
69
+ context."
70
+ (let* ((manifest (elisp/runfiles/rlocation
71
+ " phst_rules_elisp/elisp/runfiles/test-manifest" ))
72
+ (runfiles (elisp/runfiles/make :manifest manifest
73
+ :directory " /invalid/" )))
74
+ (should (equal (elisp/runfiles/rlocation " foo/bar/baz" runfiles)
75
+ " /:runfiles/foo/bar/baz" ))))
76
+
66
77
(ert-deftest elisp/runfiles/file-handler ()
67
78
(let ((file-name-handler-alist file-name-handler-alist))
68
79
(elisp/runfiles/install-handler)
Original file line number Diff line number Diff line change @@ -442,8 +442,22 @@ RUNFILES is a runfiles object and FILENAME the name to look up."
442
442
(let ((result (gethash filename (oref runfiles manifest))))
443
443
(cond
444
444
((not result)
445
- (signal 'elisp/runfiles/not-found
446
- (list filename (oref runfiles filename))))
445
+ ; ; Look for ancestor directory mapping. See
446
+ ; ; https://github.com/bazelbuild/bazel/issues/14336.
447
+ (let ((continue t )
448
+ (candidate filename))
449
+ (while continue
450
+ (pcase candidate
451
+ ((rx bos (let prefix (+ anything)) ?/ (+ anything) (? ?/ ) eos)
452
+ (if-let ((dir (gethash prefix (oref runfiles manifest))))
453
+ (setq result (concat dir (substring-no-properties
454
+ filename (length prefix)))
455
+ continue nil )
456
+ (setq candidate prefix)))
457
+ (_ (setq continue nil )))))
458
+ (or result
459
+ (signal 'elisp/runfiles/not-found
460
+ (list filename (oref runfiles filename)))))
447
461
((eq result :empty )
448
462
(signal 'elisp/runfiles/empty
449
463
(list filename (oref runfiles filename))))
You can’t perform that action at this time.
0 commit comments