Skip to content

Conversation

@crazywhalecc
Copy link
Owner

@crazywhalecc crazywhalecc commented Dec 11, 2025

What does this PR do?

  • Refactored PHP target package code into OS-specific traits (unix.php, windows.php)
  • Implemented Windows build toolchain with MSVC support and Visual Studio detection via vswhere
  • Added WindowsCMakeExecutor for building libraries on Windows
  • Enhanced shell execution layer to support Windows-specific commands with proper environment and working directory handling
  • Added Windows-specific doctor checks and artifact extraction logic
  • Add git auto-match versioning branches (closes Automatically get latest gRPC source #909)

Checklist before merging

If your PR involves the changes mentioned below and completed the action, please tick the corresponding option.
If a modification is not involved, please skip it directly.

  • If you modified *.php or *.json, run them locally to ensure your changes are valid:
    • composer cs-fix
    • composer analyse
    • composer test
    • bin/spc dev:sort-config
  • If it's an extension or dependency update, please ensure the following:
    • Add your test combination to src/globals/test-extensions.php.
    • If adding new or fixing bugs, add commit message containing extension test or test extensions to trigger full test suite.

Copy link
Contributor

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 platform support to the StaticPHP codebase, implementing Windows-specific build toolchain, executors, and utilities.

Key Changes:

  • Refactored PHP target package code into OS-specific traits (unix.php, windows.php)
  • Implemented Windows build toolchain with MSVC support and Visual Studio detection via vswhere
  • Added WindowsCMakeExecutor for building libraries on Windows
  • Enhanced shell execution layer to support Windows-specific commands with proper environment and working directory handling
  • Added Windows-specific doctor checks and artifact extraction logic

Reviewed changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
src/Package/Target/php.php Refactored to use unix and windows traits, removing OS-specific code
src/Package/Target/php/unix.php Extracted Unix-specific PHP build logic into separate trait
src/Package/Target/php/windows.php New Windows-specific PHP build logic with MSVC toolchain support
src/StaticPHP/Util/System/WindowsUtil.php Updated Visual Studio detection to use vswhere.exe with JSON parsing
src/StaticPHP/Runtime/Executor/WindowsCMakeExecutor.php New CMake executor for Windows library builds
src/StaticPHP/Toolchain/MSVCToolchain.php Implemented MSVC toolchain with vcvarsall.bat integration
src/StaticPHP/Runtime/Shell/WindowsCmd.php Simplified by removing duplicate passthru method, now uses parent implementation
src/StaticPHP/Runtime/Shell/UnixShell.php Updated to pass cwd parameter to passthru
src/StaticPHP/Runtime/Shell/Shell.php Enhanced passthru to accept cwd and env parameters for proc_open
src/StaticPHP/Runtime/Shell/DefaultShell.php Updated archive extraction with match expressions and Windows tar support
src/StaticPHP/Registry/PackageLoader.php Added OS-specific stage validation logic
src/StaticPHP/Package/Package.php Added hasBuildFunctionForCurrentOS method
src/StaticPHP/Util/SourcePatcher.php Added patchPhpSrc method for Windows micro patches
src/StaticPHP/Util/FileSystem.php Enhanced with Windows file removal fallback and class existence check
src/StaticPHP/Util/GlobalEnvManager.php Added Windows PATH manipulation support
src/StaticPHP/Package/PackageBuilder.php Moved toolchain init to PackageInstaller, added Windows UPX and debug info handling
src/StaticPHP/Package/PackageInstaller.php Calls GlobalEnvManager::afterInit() before build
src/StaticPHP/Doctor/Item/WindowsToolCheck.php New doctor checks for Windows tools (VS, perl, nasm, SDK)
src/StaticPHP/Artifact/ArtifactExtractor.php Added file extraction support and Windows-specific extraction logic
src/StaticPHP/Artifact/Artifact.php Enhanced to detect single file vs directory extraction
src/StaticPHP/Artifact/Downloader/DownloadResult.php Added file cache type and archive detection
src/StaticPHP/Command/Dev/EnvCommand.php New command to display environment variables
src/StaticPHP/Command/BaseCommand.php Changed debug detection to VERBOSITY_DEBUG level
src/StaticPHP/Util/InteractiveTerm.php Added debug logging and log level parameter
src/StaticPHP/Exception/ExceptionHandler.php Pass error level to InteractiveTerm::plain
src/StaticPHP/Command/DoctorCommand.php Skip toolchain check during doctor command
src/Package/Library/onig.php Added Windows CMake build support
src/Package/Library/imap.php Fixed method reference to patchUnixEmbedScripts
config/artifact.json Updated strawberry-perl artifact with extract path
config/pkg.target.json Added vswhere static binary configuration
captainhook.json Updated with Windows-style paths
tests/StaticPHP/Registry/PackageLoaderTest.php Added test for OS-specific stage validation and whitespace formatting fix

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@crazywhalecc crazywhalecc merged commit c1c31a7 into v3-dev Dec 11, 2025
1 check passed
@crazywhalecc crazywhalecc deleted the v3-feat/win branch December 11, 2025 08:09
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