Repository navigation
make builds resolve gitignored deps from the primary git worktree - #18030
Conversation
A freshly added `git worktree` has empty dependency directories -- node,
gwtproject, quarto, etc. are gitignored and only ever populated in the
primary checkout -- so cmake configure failed (panmirror/quarto) and npm
steps used a stray system node. src/gwt/build.xml already handled this via
${git.main.worktree}; this extends the same idea to the other tools.
- cmake/git-worktree.cmake: resolve the primary worktree via
`git rev-parse --git-common-dir` (RSTUDIO_GIT_MAIN_WORKTREE)
- globals.cmake: fall back to the primary worktree's dependencies dir when
this checkout has none; auto-enable ccache for development builds, but only
a genuine ccache (a 'ccache' that is really sccache -- e.g. symlinked --
breaks cmake's -E probes, so verify `ccache --version`)
- session/CMakeLists.txt: fall back to the primary worktree for the
gitignored panmirror/quarto script
- CMakeNodeTools.txt: fall back to the primary worktree's node toolchain
- e2e/rstudio dev harness: prepend the pinned node (resolved the same way)
to PATH so spawned npm/electron-forge use the project node, not a
mismatched system node
All changes are additive and gated: CI/official builders resolve their
existing paths first and are unaffected.
Generalize the dev compiler-cache detection: - search /opt/homebrew/bin on Apple Silicon (and /usr/local/bin otherwise) first, so a native ccache/sccache is preferred over an x86_64 binary in the Intel-Homebrew tree - accept either ccache or sccache as the launcher (both work as CMAKE_<LANG>_COMPILER_LAUNCHER), preferring ccache. Each is validated by an anchored `--version` match, which rejects a 'ccache' that is really a symlink to sccache (sccache invoked under the name 'ccache' misparses cmake's -E probes and breaks the build) -- the real sccache is then found by its own name, which works correctly. Verified: configure selects /opt/homebrew/bin/ccache (genuine arm64 4.13.6), and a rstudio-core build engages it (196/196 cacheable calls) with no breakage.
The package builds (package/osx, package/linux) already opt into sccache via SCCACHE_ENABLED, wired through cmake/modules/sccache.cmake. They also pass -DRSTUDIO_TARGET, so RSTUDIO_DEVELOPMENT is unset and the dev auto-ccache block never runs there -- but guard it explicitly against SCCACHE_ENABLED too, so the two mechanisms can never both configure a compiler launcher (e.g. a developer who sets SCCACHE_ENABLED locally). With SCCACHE_ENABLED the dev block defers and sccache.cmake wins; without it, dev builds auto-select ccache as before.
🍎 macOS Desktop E2E · ARM64❌ 1 test(s) failed
📥 Download Playwright report⬇️ playwright-report.zip — extract and open
2 shards · macos-26 ARM64 · commit |
🪟 Windows Desktop E2E · Server 2025 x64✅ All tests passed!
📥 Download Playwright report⬇️ playwright-report.zip — extract and open
2 shards · Windows Server 2025 x64 · commit |
Code review findingsActionable items from an automated multi-agent review. Strengths, dismissed findings, and ratings Important
Suggestions
|
- dev-common.ts: gate the '-arm64' node dir suffix on Darwin (macOS-only convention); on Linux aarch64 node lives in an unsuffixed dir. - dev-common.ts: warn when no pinned node is found before falling back to the system node on PATH. - CMakeNodeTools.txt: resolve the arm64 node via find_program so a missing path leaves the var empty and trips the clear "not found" error rather than deferring the failure to first use. - globals.cmake: collapse the ccache/sccache detection into a foreach loop (preserves ccache-preferred ordering and the anchored symlink-rejection), and note that an explicit -DRSTUDIO_TARGET=Development is intentionally outside the auto-enable gate. - rstudio-update-nodejs skill: track the PINNED_NODE_VERSION constant in dev-common.ts so a future node bump updates it.
* resolve panmirror dependency from primary worktree in gwt build Completes #18030: lib.dir and node.dir gained a ${git.main.worktree} fallback so a fresh git worktree can borrow the primary checkout's gitignored deps, but panmirror.dir did not. Add the same fallback so 'ant draft' (and the cmake-driven GWT build) work in a secondary worktree instead of failing with '${panmirror.dir} does not exist'. * re-enable the View() close/open race playwright test The View()/documentCloseAllNoSave variant of the source-pane open-during-close race (#17738) was left as test.fixme when #17740 landed, because the data viewer iframe failed to finish loading even with the WindowFrame HIDE-state recovery. The data-viewer mount path has since been reworked and the race no longer reproduces -- the test passes reliably (20/20 stress runs on macOS desktop).
Summary
Building from a secondary
git worktreedid not work out of the box: a freshly added worktree has empty dependency directories (node, gwtproject, quarto, etc. are gitignored and only populated in the primary checkout). This caused:cmakeconfigure to fail on the panmirror/quarto script (session/CMakeLists.txt), requiring a manual symlink;nodewas on the developer's PATH — a mismatched system node (e.g. v26 vs the pinned 22.22.2) breaksnpmpostinstall.src/gwt/build.xmlalready solved this for ant via${git.main.worktree}. This PR extends the same idea to the other build entry points so worktree builds "just work" with no symlinks or manual node management.Changes (all additive and gated)
cmake/git-worktree.cmake(new): resolves the primary checkout viagit rev-parse --path-format=absolute --git-common-dirintoRSTUDIO_GIT_MAIN_WORKTREE(empty when not in a git checkout; callers tolerate that).cmake/globals.cmake: when this checkout'sdependencies/has no downloaded content, borrow the primary worktree's. Also auto-enable a compiler cache for development builds (see below).src/cpp/session/CMakeLists.txt: fall back to the primary worktree for the gitignored panmirror/quartomd-writer.lua(the hard configure failure).src/node/CMakeNodeTools.txt: fall back to the primary worktree's node toolchain (the Apple arm64 branch had no fallback at all).e2e/rstudio/scripts/dev-common.ts: prepend the pinned node (resolved local → primary worktree → tools) toPATHfor spawnednpx/npm run start, so the dev e2e flow uses the project node, not a stray system node.CI/official builders resolve their existing paths first (global tools dir / source tree), so they are unaffected.
Compiler cache (ccache / sccache)
For development builds only, auto-enable a compiler cache when available (opt out with
-DRSTUDIO_USE_CCACHE=OFF):/opt/homebrew/binon Apple Silicon,/usr/local/binotherwise) so a native tool wins over an x86_64 one in the Intel-Homebrew tree.CMAKE_<LANG>_COMPILER_LAUNCHER); prefers ccache.--versionmatch. This rejects accachethat is actually a symlink to sccache — sccache invoked under the nameccachemisparses cmake's-Efeature probes and breaks the build; the realsccacheis then found by its own name and used safely.Coexistence with the existing
SCCACHE_ENABLEDmechanism: package/CI builds (package/osx,package/linux) already opt into sccache via theSCCACHE_ENABLEDenv/cmake var, wired throughcmake/modules/sccache.cmake. Those builds also pass-DRSTUDIO_TARGET, soRSTUDIO_DEVELOPMENTis unset and this dev block never runs there. As belt-and-suspenders, the dev block also explicitly defers whenSCCACHE_ENABLEDis set, so the two mechanisms can never both configure a launcher (verified: withSCCACHE_ENABLED=1,sccache.cmakewins; without it, dev builds auto-select ccache).Verification
In a clean secondary worktree (no manual setup):
cmakeconfigure succeeds with no quarto symlink (resolves the primary worktree + its deps).rsession): 878/879 steps, 0 errors./opt/homebrew/bin/ccache; arstudio-corebuild engages it (196/196 cacheable calls) with no breakage; the broken x86ccache→sccachesymlink is correctly rejected;SCCACHE_ENABLED=1correctly defers tosccache.cmake.CMakeNodeToolsnode resolution and thedev-commonnode resolution each verified to resolve to the primary checkout's node (the full packaged-desktop build was not run; the dev e2e flow usesnpm run start, where thedev-commonPATH pinning applies).package/osx(dual-arch x86_64 + arm64): unaffected —RSTUDIO_TARGET=Electrondisables the dev cache block, and the deps/quarto/node fallbacks are inert when packaging from the main checkout.Developer-ergonomics change; no associated issue.