Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
854719c
ci: smoke test Watchman with MSVC
longlho Jul 28, 2026
9a769c4
ci: preserve BCR overlay line endings
longlho Jul 28, 2026
1e67222
ci: use auto-detected MSVC toolchain
longlho Jul 28, 2026
2965747
fix: support native MSVC builds
longlho Jul 28, 2026
9cd9aff
fix: skip Folly symbolizer on Windows
longlho Jul 28, 2026
b53ceb5
fix: patch libevent Windows headers in smoke test
longlho Jul 28, 2026
7255ae7
fix: declare libevent RPC header as textual
longlho Jul 28, 2026
4173cee
fix: skip Folly symbolizer on Windows
longlho Jul 28, 2026
e3cdb51
fix: gate libdwarf outside Windows
longlho Jul 28, 2026
1efec0f
fix: disable Folly int128 with MSVC
longlho Jul 28, 2026
5f61b74
fix: declare Folly SysTypes dependency
longlho Jul 28, 2026
1b05674
fix: undefine Folly int128 on MSVC
longlho Jul 28, 2026
eb3600b
fix: disable int128 in Folly portability header
longlho Jul 28, 2026
1cf1375
fix: enable UTF-8 for MSVC builds
longlho Jul 28, 2026
f9a8927
fix: use Folly vectored I/O fallback on Windows
longlho Jul 28, 2026
122ec64
fix: disable Folly pthread support on Windows
longlho Jul 28, 2026
88e1ed9
fix: disable Folly SFMT on Windows
longlho Jul 28, 2026
4d46d1b
fix: disable Folly symbolizer features on Windows
longlho Jul 28, 2026
d3fdbd2
fix: select Watchman warnings by compiler
longlho Jul 28, 2026
c5222a2
fix: merge Watchman compiler options
longlho Jul 28, 2026
a1346d8
fix: declare Folly signal handler dependency
longlho Jul 28, 2026
b711b7c
fix: scope warning flags to Watchman
longlho Jul 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bcr/** text eol=lf
47 changes: 42 additions & 5 deletions .github/workflows/bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,22 +116,59 @@ jobs:
path: artifacts/x86_64-windows-gnu/watchman.exe
if-no-files-found: error

build-windows-host:
name: Build Windows binary on Windows
smoke-windows-msvc:
name: Smoke test (x86_64-windows-msvc)
runs-on: windows-2022
timeout-minutes: 120
env:
USE_BAZEL_VERSION: 9.2.0
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6

- uses: bazel-contrib/setup-bazel@c5acdfb288317d0b5c0bbd7a396a3dc868bb0f86 # v0.19.0
with:
bazelisk-cache: true
cache-save: ${{ github.event_name != 'pull_request' }}
disk-cache: ${{ github.workflow }}-windows-x64
disk-cache: ${{ github.workflow }}-windows-msvc
repository-cache: true

- name: Build Windows distribution
run: bazel build //:watchman-x86_64-windows-gnu
- name: Build and smoke test with MSVC
shell: pwsh
run: |
$registry = "file:///" + $env:GITHUB_WORKSPACE.Replace("\", "/") + "/bcr"
$bazelArgs = @(
"--registry=$registry"
"--registry=https://bcr.bazel.build"
"--incompatible_autoload_externally=+@rules_cc"
)

Push-Location tests/bcr
try {
bazel build @bazelArgs "@watchman//:watchman"
if ($LASTEXITCODE -ne 0) {
throw "MSVC build failed with code $LASTEXITCODE"
}

$outputs = bazel cquery @bazelArgs --output=files "@watchman//:watchman"
if ($LASTEXITCODE -ne 0) {
throw "MSVC output query failed with code $LASTEXITCODE"
}

$relativeBinary = @($outputs | Where-Object { $_ -like "*.exe" })
if ($relativeBinary.Count -ne 1) {
throw "expected one Watchman executable, got $($relativeBinary.Count)"
}

$executionRoot = bazel info execution_root
if ($LASTEXITCODE -ne 0) {
throw "Bazel execution-root query failed with code $LASTEXITCODE"
}
$watchman = Join-Path $executionRoot $relativeBinary[0]
} finally {
Pop-Location
}

./tests/watchman_smoke_test.ps1 -Watchman $watchman

smoke:
name: Smoke test (${{ matrix.triple }})
Expand Down
16 changes: 11 additions & 5 deletions bcr/modules/watchman/2026.07.06.00/overlay/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,11 @@ watchman_binary(
["watchman/**/*.h"],
exclude = ["watchman/thirdparty/deelevate_binding/**"],
),
copts = [
"-Wall",
"-Wextra",
copts = select({
"@rules_cc//cc/compiler:clang-cl": ["/W4"],
"@rules_cc//cc/compiler:msvc-cl": ["/W4"],
"//conditions:default": ["-Wall", "-Wextra"],
}) + [
"-DGLOG_NO_ABBREVIATED_SEVERITIES",
"-I.",
] + select({
Expand Down Expand Up @@ -302,7 +304,6 @@ watchman_binary(
"@folly//folly/chrono:conv",
"@folly//folly/concurrency:unbounded_queue",
"@folly//folly/concurrency/container:lock_free_ring_buffer",
"@folly//folly/debugging/symbolizer",
"@folly//folly/executors:cpu_thread_pool_executor",
"@folly//folly/futures:core",
"@folly//folly/init",
Expand All @@ -311,7 +312,6 @@ watchman_binary(
"@folly//folly/portability:fcntl",
"@folly//folly/portability:filesystem",
"@folly//folly/portability:sockets",
"@folly//folly/portability:sys_mman",
"@folly//folly/portability:sys_stat",
"@folly//folly/portability:sys_time",
"@folly//folly/portability:sys_types",
Expand All @@ -322,6 +322,12 @@ watchman_binary(
"@folly//folly/system:thread_name",
"@glog",
] + select({
":windows": [],
"//conditions:default": [
"@folly//folly/debugging/symbolizer",
"@folly//folly/portability:sys_mman",
],
}) + select({
":linux": ["@openssl//:crypto"],
"//conditions:default": [],
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,19 @@ diff --git a/watchman_binary.bzl b/watchman_binary.bzl
new file mode 100644
--- /dev/null
+++ b/watchman_binary.bzl
@@ -0,0 +1,9 @@
@@ -0,0 +1,13 @@
+"""Watchman binary rule with required transitive C++ settings."""
+
+load("@rules_cc//cc:defs.bzl", "cc_binary")
+load("@with_cfg.bzl", "with_cfg")
+
+_watchman_builder = with_cfg(cc_binary)
+_watchman_builder.extend("copt", ["-O2"])
+_watchman_builder.extend("cxxopt", ["-std=gnu++20"])
+_watchman_builder.extend("cxxopt", select({
+ "@rules_cc//cc/compiler:clang-cl": ["/std:c++20", "/utf-8"],
+ "@rules_cc//cc/compiler:msvc-cl": ["/std:c++20", "/utf-8"],
+ "//conditions:default": ["-std=gnu++20"],
+}))
+watchman_binary, _watchman_binary_internal = _watchman_builder.build()
diff --git a/watchman/ClientContext.h b/watchman/ClientContext.h
--- a/watchman/ClientContext.h
Expand Down
4 changes: 2 additions & 2 deletions bcr/modules/watchman/2026.07.06.00/source.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"integrity": "sha256-5G72uY4OpCAe9gPmKOrHgWVXOozEusEsdM2rgTxF+fc=",
"strip_prefix": "watchman-2026.07.06.00",
"overlay": {
"BUILD.bazel": "sha256-NVQROyGBD58UdLnZLQ0TdTduVYIdHaL8zW+nQvAB9uE=",
"BUILD.bazel": "sha256-NbEbc5UUuRl18tle9i9ht3bi6eC+nR8jh5ruZdW/LGc=",
"MODULE.bazel": "sha256-cofDyYwAbnAzhvgElmk6d7CJReE/v45MtgnN4lQJCNg=",
"bazel/patches/BUILD.bazel": "sha256-bMzIuyOaQOqAyg7TZ36UZjp0iHUaT9KAqHDuhenE56Q=",
"bazel/patches/edencommon-mingw.patch": "sha256-013B4B2vvHTG4aiKntIFuneADC/fIQA+2fxGargtaI4=",
Expand All @@ -13,6 +13,6 @@
},
"patch_strip": 1,
"patches": {
"watchman-bazel.patch": "sha256-ikaVrXCDr8YpYQHPqfUNAwbm7nrlkORtosQL2Z0NG/Q="
"watchman-bazel.patch": "sha256-U+ckNjBVifZu0d7iXtoCzR4lI6A3yya7QMTnbXIuus8="
}
}
5 changes: 5 additions & 0 deletions tests/bcr/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
package(default_visibility = ["//visibility:public"])

exports_files([
"folly-windows.patch",
"libevent-windows.patch",
])
15 changes: 15 additions & 0 deletions tests/bcr/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,18 @@ bazel_dep(
name = "watchman",
version = "2026.07.06.00",
)

# libevent's Windows backend includes event2/rpc.h from event_core, but the
# BCR BUILD file only declares that header on event_extra.
single_version_override(
module_name = "libevent",
patch_strip = 1,
patches = ["//:libevent-windows.patch"],
)

# Folly's init target only uses its Unix symbolizer on Linux and macOS.
single_version_override(
module_name = "folly",
patch_strip = 1,
patches = ["//:folly-windows.patch"],
)
111 changes: 111 additions & 0 deletions tests/bcr/folly-windows.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
diff --git a/folly/debugging/symbolizer/BUILD.bazel b/folly/debugging/symbolizer/BUILD.bazel
index 853a9f2..d97ff3a 100644
--- a/folly/debugging/symbolizer/BUILD.bazel
+++ b/folly/debugging/symbolizer/BUILD.bazel
@@ -32 +31,0 @@ cpp_library(
- "//folly/portability/provide:libdwarf",
@@ -33 +32,4 @@ cpp_library(
- ],
+ ] + select({
+ "@platforms//os:windows": [],
+ "//conditions:default": ["//folly/portability/provide:libdwarf"],
+ }),
diff --git a/folly/BUILD.bazel b/folly/BUILD.bazel
index d39b8ea..691e80c 100644
--- a/folly/BUILD.bazel
+++ b/folly/BUILD.bazel
@@ -275,18 +275,11 @@ cmake_configure_file(
defines = [
"FOLLY_HAVE_LIBGLOG",
"FOLLY_HAVE_LIBGFLAGS",
- "FOLLY_HAVE_PTHREAD",
- "FOLLY_HAVE_PTHREAD_ATFORK",
- "FOLLY_HAVE_PREADV",
- "FOLLY_HAVE_PWRITEV",
"FOLLY_HAVE_CLOCK_GETTIME",
"FOLLY_HAVE_UNALIGNED_ACCESS",
"FOLLY_HAVE_VLA",
"FOLLY_HAVE_WCHAR_SUPPORT",
"HAVE_VSNPRINTF_ERRORS",
- "FOLLY_HAVE_DWARF",
- "FOLLY_HAVE_SWAPCONTEXT",
- "FOLLY_HAVE_BACKTRACE",
"FOLLY_HAVE_SHADOW_LOCAL_WARNINGS",
"FOLLY_HAVE_LIBLZ4",
"FOLLY_HAVE_LIBLZMA",
@@ -298,11 +291,26 @@ cmake_configure_file(
"@platforms//os:windows": [
# TODO(kgk): What defines should be set here?
],
- "@platforms//os:macos": [],
+ "@platforms//os:macos": [
+ "FOLLY_HAVE_BACKTRACE",
+ "FOLLY_HAVE_DWARF",
+ "FOLLY_HAVE_PTHREAD",
+ "FOLLY_HAVE_PTHREAD_ATFORK",
+ "FOLLY_HAVE_PREADV",
+ "FOLLY_HAVE_PWRITEV",
+ "FOLLY_HAVE_SWAPCONTEXT",
+ ],
"@platforms//os:linux": [
"FOLLY_HAVE_ACCEPT4",
+ "FOLLY_HAVE_BACKTRACE",
+ "FOLLY_HAVE_DWARF",
"FOLLY_HAVE_GETRANDOM",
+ "FOLLY_HAVE_PTHREAD",
+ "FOLLY_HAVE_PTHREAD_ATFORK",
+ "FOLLY_HAVE_PREADV",
+ "FOLLY_HAVE_PWRITEV",
"FOLLY_HAVE_PIPE2",
+ "FOLLY_HAVE_SWAPCONTEXT",
"FOLLY_HAVE_IFUNC",
"FOLLY_HAVE_WEAK_SYMBOLS",
"FOLLY_HAVE_LINUX_VDSO",
@@ -312,11 +320,6 @@ cmake_configure_file(
"FOLLY_USE_SYMBOLIZER",
],
- }) + select({
- "@platforms//cpu:x86_64": [
- "FOLLY_HAVE_EXTRANDOM_SFMT19937",
- ],
- "//conditions:default": [],
}) + select({
":with_int128_setting": ["FOLLY_HAVE_INT128_T"],
"//conditions:default": [],
}),
diff --git a/folly/Portability.h b/folly/Portability.h
index f36cb00..fe0184a 100644
--- a/folly/Portability.h
+++ b/folly/Portability.h
@@ -25,3 +25,8 @@
+#ifdef _MSC_VER
+#undef FOLLY_HAVE_INT128_T
+#define FOLLY_HAVE_INT128_T 0
+#endif
+
#if defined(_MSC_VER)
#define FOLLY_CPLUSPLUS _MSVC_LANG
#else
diff --git a/folly/init/BUILD.bazel b/folly/init/BUILD.bazel
index 8afad13..6d6fd5f 100644
--- a/folly/init/BUILD.bazel
+++ b/folly/init/BUILD.bazel
@@ -20,6 +20,7 @@ cpp_library(
] + select({
"@platforms//os:linux": ["//folly/debugging/symbolizer:signal_handler"],
"@platforms//os:macos": ["//folly/debugging/symbolizer:signal_handler"],
+ "@platforms//os:windows": ["//folly/debugging/symbolizer:signal_handler"],
"//conditions:default": [],
}),
)
diff --git a/folly/portability/BUILD.bazel b/folly/portability/BUILD.bazel
index 9c3a4b1..c522440 100644
--- a/folly/portability/BUILD.bazel
+++ b/folly/portability/BUILD.bazel
@@ -293,5 +293,6 @@ cpp_library(
}),
deps = [
+ ":sys_types",
":windows",
"//folly:portability",
],
12 changes: 12 additions & 0 deletions tests/bcr/libevent-windows.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git a/BUILD.bazel b/BUILD.bazel
index 96132f1..5fa50fa 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -149,6 +149,7 @@ cc_library(
# arc4random.c is textually included by evutil_rand.c when
# arc4random() is not available. It is not compiled by itself.
"arc4random.c",
+ "include/event2/rpc.h",
],
visibility = ["//visibility:public"],
deps = [