Skip to content

Commit

Permalink
fix: windows functionality and tests (#334)
Browse files Browse the repository at this point in the history
There are four issues when running on windows:

1.
#330
2.
#331
3.
#332
4.
#333

This PR fixes 3 and 4.

There are related PRs in bazel-skylib and bazel-starlib. There is no
dependency -- the PRs can close in any order.
- cgrindel/bazel-starlib#446 (fixes 1)
- bazelbuild/bazel-skylib#527 (fixes 2)

### Test results:
Before:
--enable_runfiles: 0 pass
--noenable_runfiles: 0 pass

After this PR:
--enable_runfiles: 52 pass, 19 failures
--noenable_runfiles: 51 pass, 20 failures (17 are doc diff-tests due to
bazel-starlib)

After this PR, together with wip PRs for 1 and 2:
--enable_runfiles: 71 pass, 0 failures
--noenable_runfiles: 51 pass, 20 failures (all due to bazel-starlib)
  • Loading branch information
peakschris authored Jul 3, 2024
1 parent 2d514c3 commit b40e501
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 20 deletions.
6 changes: 6 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ bazel_dep(name = "rules_python", version = "0.19.0")
bazel_dep(name = "platforms", version = "0.0.7")
bazel_dep(name = "cgrindel_bazel_starlib", version = "0.18.0")

# not a direct dependency, but required here for bazel starlib's difftest macros to work
bazel_dep(
name = "buildifier_prebuilt",
version = "6.1.2",
)

register_toolchains("@bazel_tools//tools/python:autodetecting_toolchain")

# Must keep the Bazel version listed in WORKSPACE in sync with those loaded
Expand Down
65 changes: 45 additions & 20 deletions MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions shared.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,10 @@ common --color=auto --curses=auto

# Enable bzlmod
common --enable_bzlmod

# Required for windows
startup --windows_enable_symlinks

# this library requires runfiles for the bzlformat_lint_test
# but this is off by default on windows. Switch it on.
common --enable_runfiles
4 changes: 4 additions & 0 deletions tests/tools_tests/remove_child_wksp_bazel_symlinks_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ child_a_bazel_out="${bazel_out}/child_a"
child_b_bazel_out="${bazel_out}/child_b"
mkdir -p "${bazel_out}" "${child_a_bazel_out}" "${child_b_bazel_out}" "${parent_bazel_out}"

# Windows requires this for msys to create real symlinks
# https://superuser.com/questions/1097481/msys2-create-a-sym-link-into-windows-folder-location
export MSYS=winsymlinks:nativestrict

# Add bazel symlinks
parent_symlink="${parent_dir}/bazel-parent"
child_a_symlink="${child_a_dir}/bazel-child_a"
Expand Down

0 comments on commit b40e501

Please sign in to comment.