bazel: http_archive doesn't work well for Windows
The following scenario is not well supported on Windows:
- declare an
http_archive
which contains top-level files - one of the top-level files in the
http_archvie
is invoked by a bazel command
The bazel command only succeeds if it’s a clean build, otherwise fails with an error similar to:
ERROR: Source forest creation failed: D:/b/sdlshnzi/execroot/io_bazel/_tmp/2713b7a92d8298dcf32c3b44de75c8b1/root/sb26b24g/execroot/main/external/remote_java_tools/JavaBuilder_deploy.jar (Permission denied)
IIUC this is because Bazel tries to remove all non-symlink directories/files from the execroot tree. On Windows there are no symlinks for regular files and bazel uses copies of the original files, so bazel tries to remove all the files downloaded from http_archive
. If they are already in use by some process (this happens if they were already invoked/used by previous bazel runs) bazel fails to delete them.
This issue is a generalization of #7440, which was fixed by placing all top-level files under a directory in the http_archive
.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 17 (17 by maintainers)
No updates. But I don’t think a
WORKSPACE
file is problematic: no process will hold it open. The problem is with files that we run as subprocesses or otherwise hold open handles to.Yes it does. If no subprocess holds this file open, you’re fine. (Jar files and data files of persistent workers are risky.)
@meteorcloudy Great, then it is already fixed. 😃