You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Windows: "data" dependencies does not link to ".runfiles" #3881
P3We're not considering working on this, but happy to review a PR. (No assignee)area-WindowsWindows-specific issues and feature requestsplatform: windowsteam-OSSIssues for the Bazel OSS team: installation, release processBazel packaging, websitetype: feature request
Thanks.
Unfortunately this solution does not align nicely with "multiple-build-system" concept: use different build systems should use the same source code.
Perhaps, least intrusive way is to update $location behavior, or make an alternative to it.
Since reading files pointed in manifest already breaks the concept of sandboxing, it won't make the things worse, if $location would point to absolute file path.
Such change would instantly fix my project build on Windows (without touching neither BUILD files, nor sources)
Since reading files pointed in manifest already breaks the concept of sandboxing,
No, it does not. In the same way, under Linux inside sandbox the application can use readlink to discover where symlink points - that does not "break the concept of sandboxing".
it won't make the things worse, if $location would point to absolute file path.
No it would. The result of $location is a part of a command line generated during analysis. That command line should be "relocatable", so no absolute paths.
However one possible way to allow automatic translation might be within the API of (just added) Args object
How about optional copying of data deps when symlinking is not available (windows)?
It seems that there is no way to hack this around using just Skylark. The only way to alter build graph using the information form the outer world is exec_result, but it is available only for repository rules...
Other solution could be creating resource file with environment info, but it touches project sources too much (almost the same way as reading manifest) =(
Another tiny problem with runfiles resolving is that "workspace" path part should be either guessed or ignored. Two lines of code, but also a potential bug, as there could be name collisions.
import fnmatch
import os
import os.path
from shutil import copyfile
matches = []
# replace with your project path
for root, dirnames, filenames in os.walk('bazel-bin\\java\\org\\brotli'):
for filename in fnmatch.filter(filenames, '*.runfiles_manifest'):
matches.append(os.path.join(root, filename))
for match in matches:
runfiles = match[:-len('_manifest')]
with open(match) as manifest:
for entry in manifest:
entry = entry.strip()
if not entry.startswith("org_brotli"): # workspace id
continue
if entry.startswith('org_brotli/external'): #workspace id
continue
(alias, space, link) = entry.partition(' ')
if alias.endswith('.jar') or alias.endswith('.exe'):
continue
link = link.replace('/', '\\')
alias = alias.replace('/', '\\')
dst = os.path.join(runfiles, alias)
if not os.path.exists(dst):
print(link + ' -> ' + dst)
parent = os.path.dirname(dst)
if not os.path.exists(parent):
os.makedirs(parent)
copyfile(link, dst)
I'm closing this issue, because Bazel is working fine. $(location) returns the runfiles path of the target. You have to pass that to the runfiles library's rlocation function. Here's more info:
P3We're not considering working on this, but happy to review a PR. (No assignee)area-WindowsWindows-specific issues and feature requestsplatform: windowsteam-OSSIssues for the Bazel OSS team: installation, release processBazel packaging, websitetype: feature request
Activity
eustas commentedon Oct 10, 2017
Correct entry appears in
.runfiles_manifest. But this doesn't help at all, as there is no API to use it.dslomov commentedon Oct 10, 2017
We do not have an API to read
.runfiles_manifestbut it is fairly trivial:bazel/src/main/java/com/google/devtools/build/lib/windows/runfiles/WindowsRunfiles.java
Line 27 in 259c9e8
eustas commentedon Oct 10, 2017
Thanks.
Unfortunately this solution does not align nicely with "multiple-build-system" concept: use different build systems should use the same source code.
dslomov commentedon Oct 10, 2017
We are open to suggestions on how to fix it.
Creating symlinks on Windows is not really an option as it requires admin privileges.
eustas commentedon Oct 10, 2017
Perhaps, least intrusive way is to update
$locationbehavior, or make an alternative to it.Since reading files pointed in manifest already breaks the concept of sandboxing, it won't make the things worse, if
$locationwould point to absolute file path.Such change would instantly fix my project build on Windows (without touching neither BUILD files, nor sources)
dslomov commentedon Oct 10, 2017
No, it does not. In the same way, under Linux inside sandbox the application can use
readlinkto discover where symlink points - that does not "break the concept of sandboxing".No it would. The result of
$locationis a part of a command line generated during analysis. That command line should be "relocatable", so no absolute paths.However one possible way to allow automatic translation might be within the API of (just added) Args object
eustas commentedon Oct 10, 2017
It seems that Args object should fit my requirements. Thanks.
dslomov commentedon Oct 10, 2017
I am not saying we are doing this yet, so do not hold your breath, but I'll think about it.
eustas commentedon Oct 11, 2017
How about optional copying of data deps when symlinking is not available (windows)?
It seems that there is no way to hack this around using just Skylark. The only way to alter build graph using the information form the outer world is exec_result, but it is available only for repository rules...
Other solution could be creating resource file with environment info, but it touches project sources too much (almost the same way as reading manifest) =(
eustas commentedon Oct 11, 2017
Another tiny problem with runfiles resolving is that "workspace" path part should be either guessed or ignored. Two lines of code, but also a potential bug, as there could be name collisions.
eustas commentedon Oct 11, 2017
My current workaround:
Just run it between build and test.
laszlocsomor commentedon Feb 28, 2019
I'm closing this issue, because Bazel is working fine.
$(location)returns the runfiles path of the target. You have to pass that to the runfiles library'srlocationfunction. Here's more info:bazel/tools/python/runfiles/runfiles.py
Lines 16 to 59 in e5735fd