Skip to content

Conversation

@mekwall
Copy link
Owner

@mekwall mekwall commented Jul 5, 2025

This pull request introduces support for native Windows, including updates to workflows, build configurations, and source code adjustments. Additionally, it includes minor refactoring to improve code readability and consistency.

Native Windows Compatibility Enhancements:

  • Added a new clippy-windows job to .github/workflows/checks.yml for running Clippy checks on Windows environments.
  • Introduced a new workflow file, .github/workflows/windows-tests.yml, to run Windows-specific tests, build processes, and Clippy checks. This includes setting up dependencies like CMake and Visual Studio Build Tools.
  • Updated CMakeLists.txt to handle Windows-specific dependencies and configurations, such as using Rpcrt4 for UUID handling and setting appropriate libraries like bcrypt and crypt32. [1] [2]
  • Modified src/Context.cpp to include Windows-specific implementations for environment variables, terminal width/height detection, and color support. [1] [2] [3] [4] [5] [6] [7]
  • Added conditional compilation in various files (e.g., src/Hooks.cpp, src/commands/CmdEdit.cpp) to exclude Unix-specific headers and replace them with Windows equivalents where necessary. [1] [2]
  • Replaced logical operators (and, or, not) with standard equivalents (&&, ||, !) as they aren't recognized by MSVC when using Windows headers. [1] [2] [3] [4] [5] [6]
  • Undefining the max macro in multiple files to prevent conflicts with std::max. [1] [2] [3] [4]

Copilot AI review requested due to automatic review settings July 5, 2025 15:22
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds comprehensive Windows support by updating CI workflows, build configurations, and source code to use conditional compilation and Windows APIs.

  • Introduced Windows-specific GitHub Actions workflows and a new clippy-windows job.
  • Enhanced CMake and build.rs to link against Windows runtimes and libraries.
  • Wrapped POSIX-only calls in #ifdef _WIN32, added Windows implementations for UUIDs, console sizing, and environment lookups.

Reviewed Changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/util.h Added #ifdef _WIN32 around UUID includes
src/util.cpp Windows uuid() implementation and header guards
src/taskchampion-cpp/build.rs Windows MSVC runtime flags in Debug profile
src/taskchampion-cpp/CMakeLists.txt Formatting fix for corrosion_import_crate
src/recur.h Conditional includes for windows.h and <io.h>
src/recur.cpp Added <algorithm> and #undef max on Windows
src/main.cpp Wrapped signal(SIGPIPE) and run() call in guards
src/commands/CmdPurge.cpp Replaced and with &&
src/commands/CmdImport.cpp Replaced not/and with !/&&
src/commands/CmdEdit.cpp Swapped <unistd.h> for <direct.h> on Windows
src/commands/CmdContext.cpp Replaced or with `
src/commands/CmdBurndown.cpp Added #undef max guard
src/Task.cpp Multiple #undef max injections
src/Lexer.cpp Replaced and with &&
src/Hooks.cpp Guarded POSIX includes under #ifndef _WIN32
src/DOM.cpp Replaced and with &&
src/Context.cpp Windows console size, color detection, home dir
cmake/CXXSniffer.cmake Extended C++17 check to include WIN32
CMakeLists.txt Windows crypto libs, UUID handling, and Rpcrt4
.github/workflows/windows-tests.yml New Windows build/test workflow
.github/workflows/checks.yml Added clippy-windows job
Comments suppressed due to low confidence (2)

.github/workflows/windows-tests.yml:49

  • [nitpick] On Windows runners, use backslashes or PowerShell syntax (.\build\Debug\task.exe) to avoid path resolution issues in PowerShell/CMD.
          ./build/Debug/task.exe --version

.github/workflows/checks.yml:59

  • [nitpick] This workflow uses the master ref for the Rust toolchain action, whereas others pin to stable or a version. Consider unifying to a specific version for reproducibility.
      - uses: dtolnay/rust-toolchain@master

@mekwall mekwall changed the title Native windows support Native Windows support Jul 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants