-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Windows support and make the top-level buildozer target public #17
Conversation
Thanks for the suggestion! I so far haven't exposed this target publicly since referencing it with anything that isn't We could fix this by hardcoding the rlocationpath in Line 23 in 7871d11
|
Ah yes right you are. If we going to render we can also support Windows. I'll render the shell script and batch script when I get back to a Windows PC. |
@fmeum should be good to go |
private/buildozer.template.sh
Outdated
@@ -20,7 +16,8 @@ source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \ | |||
{ echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e | |||
# --- end runfiles.bash initialization v3 --- | |||
|
|||
buildozer_path=$(rlocation $BUILDOZER_RLOCATIONPATH) | |||
BUILDOZER_RLOCATIONPATH=%%BUILDOZER_RLOCATIONPATH%% | |||
buildozer_path=$(rlocation "$BUILDOZER_RLOCATIONPATH") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of injecting this variable, we should be able to just use buildozer_binary/buildozer
(plus the OS-dependent extension). That avoids having to stamp in the path, which in turn allows us to avoid the .bat
script. It looks pretty good (thanks for giving me an idea of what that would look like!), but I'm not sure that it fully follows the runfiles discovery process - for example, what if someone builds with runfiles enabled on Windows?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having an inner repo for the binary requires a rendered script. As far as I know, there is no other way to locate the binary when runfiles are disabled - which is the default state of a Windows box.
When running in command prompt, batch is also required. Here is a stock windows box with bazelisk only:
C:\Users\clzdg\Projects\buildozer>bazel run @buildozer -- -h
WARNING: Build option --enable_runfiles has changed, discarding analysis cache (this can be expensive, see https://bazel.build/advanced/performance/iteration-speed).
INFO: Analyzed target //:buildozer (1 packages loaded, 7 targets configured).
INFO: Found 1 target...
Target @@+buildozer_binary+buildozer_binary//:source_buildozer up-to-date:
bazel-bin/external/+buildozer_binary+buildozer_binary/source_buildozer.sh
INFO: Elapsed time: 0.618s, Critical Path: 0.02s
INFO: 5 processes: 5 internal.
INFO: Build completed successfully, 5 total actions
INFO: Running command line: bazel-bin/external/+buildozer_binary+buildozer_binary/source_buildozer.sh <args omitted>
FATAL: ExecuteProgram(C:\users\clzdg\_bazel_clzdg\2qmadfcc\execroot\_main\bazel-out\x64_windows-fastbuild\bin\external\+buildozer_binary+buildozer_binary\source_buildozer.sh) failed: ERROR: src/main/native/windows/process.cc(202): CreateProcessW("C:\users\clzdg\_bazel_clzdg\2qmadfcc\execroot\_main\bazel-out\x64_windows-fastbuild\bin\external\+buildozer_binary+buildozer_binary\source_buildozer.sh" -h): %1 is not a valid Win32 application.
(error: 193)
I updated the batch file to be a bit smarter. This is generally modeled after https://github.com/bazelbuild/bazel-skylib/blob/main/rules/diff_test.bzl, but unfortunately the test wrapper provides the runfiles envvars that make their runfiles discovery simpler, so we have a sillier MANIFEST direct lookup.
I think we need a batch runfiles library, only 10k lines of batch and you've got a repo mapping baby.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The batch script looks pretty accurate now, but I think that we can still avoid it. Please take a look at #23, which is based on your PR but hardcodes the rlocationpath with an apparent repository name. It doesn't work on 6.2.0 as the runfiles library had a bug, but it works on 6.x.
We should support
I think this makes more sense than bringing buildozer_binary into scope in my module