build: add opt-in sccache arguments to dev.ps1 #1242
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1249"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:27:54Z.
Change
AI-assisted. Adds an opt-in compiler cache to the Windows developer shell script.
tools/dev.ps1does not callcmakeitself, so it cannot add arguments to a configure command. Instead, withX2W_USE_SCCACHE=1andsccacheonPATH, it sets the global$X2wSccacheCmakeArgsto four definitions:CMAKE_C_COMPILER_LAUNCHER=sccache,CMAKE_CXX_COMPILER_LAUNCHER=sccache,CMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded(so/Zidoes not block the cache) andCMAKE_POLICY_DEFAULT_CMP0141=NEW. The fourth is needed because the project declarescmake_minimum_required(3.21), where CMP0141 is OLD and CMake ignores the format variable. If the variable is 1 butsccacheis missing, the script callsWrite-Warningand continues without it. Otherwise the global is removed and nothing else changes. The presets set neither the launchers nor the debug format, so there is nothing to override.Try it:
$env:X2W_USE_SCCACHE = '1'; .\tools\dev.ps1; cmake --preset dev @X2wSccacheCmakeArgsFiles:
tools/dev.ps1,tests/dev_ps1_sccache_check.py,docs/experiments.md, plus one step in.github/workflows/windows.yml(thepixel-binaryjob) so the check runs. This is outside the CPU targets.Verification
python3 -B tests/dev_ps1_sccache_check.py <pwsh 7.7.0>on Linux:dev.ps1 sccache opt-in: ok (executed with pwsh). It parses the whole script with the PowerShell parser and runs the block for seven environments: unset (with and without sccache),0,true, empty (no arguments, no warning),1with a stubsccacheon PATH (exactly the four definitions), and1without it (no arguments, warning).origin/main'sdev.ps1exits 1 (dev.ps1 has no x2w-sccache block). Four mutated copies of the block (Z7 instead of Embedded, always on, no warning, missing policy) are each rejected.pwshthe test falls back to checking the block text.Evidence and follow-up
The 3.51 s to 0.29 s (about 12x) figure is an outside maintainer's measurement on Windows Server 2025, MSVC 14.44, sccache 0.20.0. It is not mine and I did not repeat it. The Windows node should run
X2W_USE_SCCACHE=1and unset configures and compare.Checklist
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T05:39:21Z.
Review: COMMENTED
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
c51633e8daℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:40:52Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:40:54Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:41:28Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:41:30Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T05:46:34Z.
Review: COMMENTED
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
9c39e2be7aℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:47:33Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:47:53Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T05:55:03Z.
Review: COMMENTED
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit:
64b4a53bceℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:56:54Z.
Review: COMMENTED
No description provided.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:31:37Z.
Verified on Windows Server 2025 (Build 26100, MSVC 14.44.35207 / 19.44.35230.0, AMD Ryzen 5 PRO 5650U) at HEAD
c51633e8da582e050a264d5e94744d0798488f50:X2W_USE_SCCACHE):. .\tools\dev.ps1:$X2wSccacheCmakeArgsis unset (Test-Path variable:global:X2wSccacheCmakeArgs->False).cmake --preset dev(freshCMakeCache.txt): configured cleanly; neitherCMAKE_C_COMPILER_LAUNCHERnorCMAKE_CXX_COMPILER_LAUNCHERis set inCMakeCache.txt.X2W_USE_SCCACHE=1withsccacheonPATH):. .\tools\dev.ps1:$X2wSccacheCmakeArgsis set to-DCMAKE_C_COMPILER_LAUNCHER=sccache,-DCMAKE_CXX_COMPILER_LAUNCHER=sccache,-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded,-DCMAKE_POLICY_DEFAULT_CMP0141=NEW.cmake --preset dev @X2wSccacheCmakeArgs(freshCMakeCache.txt): configured cleanly with all four entries recorded inCMakeCache.txt.cmake --build --preset dev --target startup_stub_xg_xs -- -j 6: builtxg_xs.dll(Compile requests: 1,Cache misses: 1,Cache errors: 0).cmake --build --preset dev --target startup_stub_xg_xs --clean-first -- -j 6: clean rebuild hit the cache (Compile requests: 2,Cache hits: 1,Cache misses: 1,Cache errors: 0,Compilation failures: 0).python -B tests/dev_ps1_sccache_check.py:dev.ps1 sccache opt-in: ok (text only)(exit code 0).Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:40:58Z.
AI-assisted update: with X2W_USE_SCCACHE=1 and sccache missing, dev.ps1 now passes empty compiler-launcher definitions so an earlier cached launcher is cleared; the test stub is a .cmd file on Windows. Behavior without the variable is unchanged. python3 -B tests/dev_ps1_sccache_check.py passes (text-only here, pwsh absent) and fails against the previous dev.ps1.
@codex review
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:41:32Z.
Fixed both P2 findings in
9c39e2be: the missing-sccache fallback now clears both launcher cache entries, and the test stub is a .cmd on Windows. @codex reviewImported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:47:35Z.
Fixed the SystemRoot lookup in
64b4a53b. @codex reviewImported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:47:55Z.
AI-assisted: the Windows KeyError in the sccache check is fixed in
64b4a53b(SystemRoot is read from os.environ). @codex reviewImported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:51:21Z.
Verified on Windows Server 2025 (Build 26100, MSVC 14.44) at commit
64b4a53bce2e33d6b107f5ea9de78d2d5d170964:python -B tests/dev_ps1_sccache_check.py powershell:dev.ps1 sccache opt-in: ok (executed with pwsh)(exit code 0)Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:56:56Z.
Addressed the isolated-PATH finding in
33234dd9. The test now keeps pwsh's own directory out of PATH. AI-assisted. @codex reviewImported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T06:01:39Z.
Codex Review: Didn't find any major issues. Chef's kiss.
Reviewed commit:
33234dd961ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T05:30:49Z.
Codex Review Summary: ✅ Completed
This comment shows the latest Codex review activity on this pull request.
33234ddℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T05:39:21Z.
Code review location:
tools/dev.ps1; line 53If the preset was configured once with sccache and a later shell no longer has it on PATH, this fallback does not actually remove the launcher.
CMakePresets.json:7reusesout/build/dev, andcmake --helpdefines-Das “Create or update a cmake cache entry,” soCMAKE_CXX_COMPILER_LAUNCHER=sccachesurvives reconfiguration with the empty argument list. The next build therefore invokes the missing executable despite this warning promising otherwise. I reproduced that failure with CMake 3.28/Ninja in a minimal C++ project; clearing the launcher cache entries fixes it. Supply cache-clearing arguments or require an explicit cache reset in this fallback.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T05:39:21Z.
Code review location:
tests/dev_ps1_sccache_check.py; line 41On the x64 Windows build environment documented in
AGENTS.md, running the advertised Python check withpwshinstalled creates an extensionless POSIX shell script for the “sccache present” cases. With normal Windows executable-extension settings, that file is not discoverable as an application, so the block'sGet-Command sccache -CommandType Applicationtakes the missing-cache branch and the("1", True, ...)case fails even thoughdev.ps1is correct. Create a Windows.cmdor.exefixture on Windows rather than using the Unix shell stub unconditionally.AGENTS.md reference: AGENTS.md:L38-L40
Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:40:52Z.
Code review location:
tools/dev.ps1; line 53Fixed in
9c39e2beImported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:40:54Z.
Code review location:
tests/dev_ps1_sccache_check.py; line 41Fixed in
9c39e2beImported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:41:28Z.
Code review location:
tools/dev.ps1; line 53Fixed in
9c39e2beImported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:41:30Z.
Code review location:
tests/dev_ps1_sccache_check.py; line 41Fixed in
9c39e2beImported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T05:46:34Z.
Code review location:
tests/dev_ps1_sccache_check.py; line 49When this check runs on Windows with
pwshinstalled,os.environyields uppercase keys, and the comprehension above copies them into a normal, case-sensitive dictionary. Consequently,envcontainsSYSTEMROOT, notSystemRoot, and this lookup raisesKeyErrorbefore the first PowerShell block executes. The new.cmdfixture therefore cannot be exercised on the documented Windows platform. Read the value fromos.environ["SystemRoot"]or useenv["SYSTEMROOT"].AGENTS.md reference: AGENTS.md:L38-L40
Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:47:33Z.
Code review location:
tests/dev_ps1_sccache_check.py; line 49Fixed in
64b4a53bImported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:47:53Z.
Code review location:
tests/dev_ps1_sccache_check.py; line 49Fixed in
64b4a53bImported from R0Y00/Xbox2Windows. Originally posted by chatgpt-codex-connector[bot] on 2026-11-24T05:55:03Z.
Code review location:
tests/dev_ps1_sccache_check.py; line 48If
pwshandsccachelive in the same bin directory, such as/usr/binor a Homebrew prefix, this exposes the realsccacheeven whenwith_sccache=False. Consequently, the("1", False, CLEARED, True)case takes the sccache-present branch, returns the four definitions without a warning, and fails despite the developer script being correct. Since the subprocess already invokes PowerShell by its resolved path, omit its directory from the isolatedPATHor otherwise prevent sibling executables from leaking into the missing-tool case.Useful? React with 👍 / 👎.
Imported from R0Y00/Xbox2Windows. Originally posted by tedin7 on 2026-11-24T05:56:54Z.
Code review location:
tests/dev_ps1_sccache_check.py; line 48Fixed in
33234dd9: the isolated PATH now holds only the stub directory (plus System32 on Windows); pwsh is started by absolute path.