Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1102,6 +1102,17 @@ jobs:
with:
tool: cargo-nextest

# Keep fixtures outside runner.temp: setup-node writes an .npmrc there,
# which Yarn Classic discovers when walking parent directories.
- name: Create NTFS snapshot temp directory
id: snapshot-temp
shell: pwsh
run: |
$volume = [System.IO.Path]::GetPathRoot($env:RUNNER_TEMP)
$snapshotTemp = Join-Path $volume ('vp-snapshots-' + [guid]::NewGuid().ToString('N'))
New-Item -ItemType Directory -Path $snapshotTemp | Out-Null
"directory=$snapshotTemp" >> $env:GITHUB_OUTPUT

# `cargo-nextest` is invoked directly so the job never depends on the
# runner's Rust toolchain. --workspace-remap makes nextest rewrite
# CARGO_MANIFEST_DIR and CARGO_BIN_EXE_vpt to this checkout, which is
Expand All @@ -1124,6 +1135,10 @@ jobs:
cargo-nextest nextest run --archive-file windows-snapshot-tests.tar.zst --workspace-remap . --no-fail-fast --partition hash:${{ matrix.shard }}/3
env:
RUST_BACKTRACE: '1'
# Rust's GetTempPath2 ignores TEMP/TMP under the SYSTEM account.
# Use the runner's NTFS workspace volume: C:\Windows\SystemTemp
# rejects the case-sensitive directory flag on these hosts.
SystemTemp: ${{ steps.snapshot-temp.outputs.directory }}
# Keep Windows env parity with the `test` recipe in justfile.
__COMPAT_LAYER: RunAsInvoker

Expand Down
3 changes: 1 addition & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,11 @@ rolldown_watcher = { path = "./rolldown/crates/rolldown_watcher" }
rolldown_workspace = { path = "./rolldown/crates/rolldown_workspace" }
string_wizard = { path = "./rolldown/crates/string_wizard", features = ["serde"] }

[patch.crates-io]
# Resolve Windows shims in case-sensitive directories for all which callers.
# Remove this patch after https://github.com/harryfei/which-rs/pull/131 is released.
which = { git = "https://github.com/fengmk2/which-rs.git", rev = "4f6f1b81b23f2887409bf838f4369690f9c2e336" }

# =============================================================================
# Local Development Patches
# =============================================================================
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const fs = require('node:fs');

fs.mkdirSync('node_modules/.bin', { recursive: true });
fs.writeFileSync('node_modules/.bin/astro.CMD', '@echo wrong workspace shim %*\r\n');
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "case-sensitive-shims",
"private": true,
"packageManager": "pnpm@12.4.1",
"scripts": {
"probe": "vp run --filter @fixture/app probe"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "@fixture/app",
"private": true,
"scripts": {
"probe": "astro --version"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log('local shim', ...process.argv.slice(2));
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export default {
run: {
tasks: {
cached: {
command: "astro cached",
},
},
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
packages:
- packages/*
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const assert = require('node:assert/strict');
const { execFileSync } = require('node:child_process');
const fs = require('node:fs');
const path = require('node:path');

const bin = path.resolve('packages/app/node_modules/.bin');
fs.mkdirSync(bin, { recursive: true });
// The directory must be empty when case sensitivity is enabled. Do not depend
// on the checkout's NTFS flags or the casing chosen by a package manager.
execFileSync('fsutil.exe', ['file', 'setCaseSensitiveInfo', bin, 'enable'], { stdio: 'inherit' });
fs.writeFileSync(path.join(bin, 'astro.cmd'), '@echo off\r\nnode "%~dp0/../../print.cjs" %*\r\n');
assert.equal(fs.existsSync(path.join(bin, 'astro.CMD')), false);
assert.equal(process.env.PATHEXT, '.COM;.EXE;.BAT;.CMD');
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[[case]]
name = "windows_case_sensitive_shims"
vp = ["local", "global"]
skip-platforms = ["linux", "macos"]
env = { PATHEXT = ".COM;.EXE;.BAT;.CMD" }
steps = [
{ argv = ["node", "setup.cjs"], snapshot = false },
{ argv = ["vp", "run", "probe"], tty = false, comment = "Nested task planning resolves the lowercase shim with uppercase PATHEXT." },
{ argv = ["vp", "exec", "astro", "--version"], cwd = "packages/app", tty = false },
{ argv = ["node", "later-shim.cjs"], snapshot = false },
{ argv = ["vp", "run", "probe"], tty = false, comment = "The earlier package-local lowercase shim wins over a later uppercase shim." },
{ argv = ["vp", "exec", "astro", "--version"], cwd = "packages/app", tty = false },
{ argv = ["vp", "run", "cached"], cwd = "packages/app", tty = false },
{ argv = ["vp", "run", "cached"], cwd = "packages/app", tty = false, comment = "Resolving the program keeps the task's cache behavior." },
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# windows_case_sensitive_shims

## `node setup.cjs`


## `vp run probe`

Nested task planning resolves the lowercase shim with uppercase PATHEXT.

```
~/packages/app$ astro --version ⊘ cache disabled
local shim --version
```

## `cd packages/app && vp exec astro --version`

```
local shim --version
```

## `node later-shim.cjs`


## `vp run probe`

The earlier package-local lowercase shim wins over a later uppercase shim.

```
~/packages/app$ astro --version ⊘ cache disabled
local shim --version
```

## `cd packages/app && vp exec astro --version`

```
local shim --version
```

## `cd packages/app && vp run cached`

```
~/packages/app$ astro cached
local shim cached
```

## `cd packages/app && vp run cached`

Resolving the program keeps the task's cache behavior.

```
~/packages/app$ astro cached ◉ cache hit, replaying
local shim cached

---
vp run: cache hit, <duration> saved.
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# windows_case_sensitive_shims

## `node setup.cjs`


## `vp run probe`

Nested task planning resolves the lowercase shim with uppercase PATHEXT.

```
~/packages/app$ astro --version ⊘ cache disabled
local shim --version
```

## `cd packages/app && vp exec astro --version`

```
local shim --version
```

## `node later-shim.cjs`


## `vp run probe`

The earlier package-local lowercase shim wins over a later uppercase shim.

```
~/packages/app$ astro --version ⊘ cache disabled
local shim --version
```

## `cd packages/app && vp exec astro --version`

```
local shim --version
```

## `cd packages/app && vp run cached`

```
~/packages/app$ astro cached
local shim cached
```

## `cd packages/app && vp run cached`

Resolving the program keeps the task's cache behavior.

```
~/packages/app$ astro cached ◉ cache hit, replaying
local shim cached

---
vp run: cache hit, <duration> saved.
```
Loading