Commit Graph

8 Commits

Author SHA1 Message Date
Ben Hillis
b7735bba18 Replace pre-commit hook with CMake-generated clang-format check (#40136)
* Replace pre-commit hook with CMake-generated clang-format check

Replace the old pre-commit hook that shelled out to PowerShell and
never blocked commits (-NoFail) with a CMake-generated hook that
calls clang-format directly on staged C/C++ files.

- Add tools/hooks/pre-commit.in as a CMake template
- CMake resolves the clang-format path at configure time via
  LLVM_INSTALL_DIR, matching the existing FormatSource.ps1.in pattern
- Hook blocks commits on formatting errors, skips gracefully if
  clang-format is not available (cmake not yet run)
- ~5x faster than the old PowerShell approach (~0.5s vs ~2.6s)

* Make pre-commit hook behavior configurable via WSL_PRE_COMMIT_MODE

Add WSL_PRE_COMMIT_MODE CMake cache variable with three modes:
- warn (default): report formatting issues without blocking commit
- error: block commit when formatting issues are found
- fix: auto-format files and re-stage them

Also addresses PR feedback:
- Generate hook into build tree, copy to source tree for out-of-source builds
- Use repo-local tools/clang-format.exe instead of LLVM_INSTALL_DIR path
- Use @ONLY in configure_file to avoid shell variable substitution issues
- Document modes in dev-loop.md and UserConfig.cmake.sample

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-09 13:31:21 -07:00
Ben Hillis
8496b4051c Add /attachdebugger option to automatically launch WinDbgX for test debugging (#40116)
* Add /attachdebugger option to automatically launch WinDbgX for test debugging

When /attachdebugger is passed to test.bat, run-tests.ps1 now:
- Starts te.exe with /waitfordebugger in the background
- Polls for the TE.ProcessHost.exe child process via WMI
- Launches WinDbgX attached directly to the test host PID
- With /inproc, attaches to TE.exe itself instead

This replaces the manual workflow of running /waitfordebugger, reading
the PID from the output, and launching WinDbgX separately.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* run-tests: use /inproc with /attachdebugger, simplify exit

Per review feedback from @OneBlue:
- Add /inproc when /attachdebugger is set so WinDbgX attaches
  directly to TE.exe instead of polling for TE.ProcessHost.exe
- Simplify exit to pass through TE.exe exit code directly

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* docs: update /attachdebugger to reflect /inproc behavior

The script now always adds /inproc, so update the README to match:
WinDbgX attaches directly to TE.exe, no ProcessHost polling.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-07 18:45:37 -07:00
Ben Hillis
2856dc3d88 Enable VS 2026 solution generation and improve ARM64 developer experience (#14283)
- Auto-detect host architecture when TARGET_PLATFORM and CMAKE_GENERATOR_PLATFORM are unset, defaulting to ARM64 on ARM64 hosts
- Fix trailing '|' in platform regex that made the else branch unreachable
- Refactor Visual Studio detection to prefer VS2022 and fall back to VS2026 with a clang-format warning- Document x64 .NET 6.0 runtime setup required for WiX on ARM64

Co-authored-by: Ben Hillis <benhill@ntdev.microsoft.com>
2026-02-25 17:32:22 -08:00
Blue
dc82161f7a Document various tips to iterate faster when building & deploying WSL (#14146) 2026-02-03 11:07:27 -08:00
Masanari Mizuno
f3125bb3a3 docs: Fix version typos in dev-loop.md (#13950) 2025-12-22 11:47:19 -08:00
Jerry Jones
3524feba77 grammar docfixes (#13314) 2025-07-31 08:19:42 -07:00
Hayden Barnes
7d6a44bbe8 Update docs to include Developer Mode or Admin (#12924) 2025-05-22 10:50:45 -07:00
WSL Team
697572d664 Initial open source commit for WSL.
Many Microsoft employees have contributed to the Windows Subsystem for Linux, this commit is the result of their work since 2016.

The entire history of the Windows Subsystem for Linux can't be shared here, but here's an overview of WSL's history after it moved to it own repository in 2021:

Number of commits on the main branch: 2930
Number of contributors: 31

Head over https://github.com/microsoft/WSL/releases for a more detailed history of the features added to WSL since 2021.
2025-05-15 12:09:45 -07:00