Skip to content
Merged
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
72 changes: 72 additions & 0 deletions .github/workflows/check-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -167,3 +167,75 @@ jobs:
throw "Warm check did not reuse the verified source launcher"
}
# The hosted runner discards RUNNER_TEMP after the job.

- name: Windows long-path repair and fallback smoke
shell: pwsh
run: |
$ErrorActionPreference = 'Stop'
$registry = 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem'
$original = Get-ItemPropertyValue -Path $registry -Name LongPathsEnabled -ErrorAction SilentlyContinue
$buildOutput = @(& soldr cargo build -p fbuild-cli -p fbuild-daemon --bins --message-format=json)
if ($LASTEXITCODE -ne 0) {
$buildOutput | Write-Output
throw 'could not build the Windows smoke binaries'
}
$binPaths = @{}
foreach ($line in $buildOutput) {
if (-not $line.StartsWith('{')) { continue }
$artifact = $line | ConvertFrom-Json
if ($artifact.reason -eq 'compiler-artifact' -and ($artifact.target.kind -contains 'bin') -and $artifact.executable) {
$binPaths[$artifact.target.name] = $artifact.executable
}
}
foreach ($name in @('fbuild', 'fbuild-daemon')) {
if (-not $binPaths.ContainsKey($name) -or -not (Test-Path -LiteralPath $binPaths[$name] -PathType Leaf)) {
throw "missing Windows smoke executable: $name"
}
}
$cli = $binPaths['fbuild']
$daemon = $binPaths['fbuild-daemon']
foreach ($binary in @($cli, $daemon)) {
$image = [Text.Encoding]::UTF8.GetString([IO.File]::ReadAllBytes($binary))
if ($image -notmatch 'longPathAware[^>]*>true</' -or $image -notmatch 'level="asInvoker"') {
throw "Missing Windows manifest in $binary"
}
}
try {
# This disposable hosted runner is already elevated. Exercise the
# fixed helper without requiring an interactive UAC desktop.
New-ItemProperty -Path $registry -Name LongPathsEnabled -PropertyType DWord -Value 0 -Force | Out-Null
& $cli --__fix-win-helper
if ($LASTEXITCODE -ne 0) { throw 'long-path helper failed' }
if ((Get-ItemPropertyValue -Path $registry -Name LongPathsEnabled) -ne 1) {
throw 'long-path helper did not verify its change'
}
& $cli --fix-win --no-update-check
if ($LASTEXITCODE -ne 0) { throw 'already-enabled repair failed' }
$env:FBUILD_DEV_MODE = '0'
$env:RUNNING_PROCESS_DISABLE = '1'
& $cli --no-update-check build tests/platform/uno --dry-run
if ($LASTEXITCODE -ne 0) { throw 'enabled daemon startup failed' }
$before = Get-Content (Join-Path $env:USERPROFILE '.fbuild\prod\daemon\root-owner.json') -Raw | ConvertFrom-Json
New-ItemProperty -Path $registry -Name LongPathsEnabled -PropertyType DWord -Value 0 -Force | Out-Null
$env:CI = 'true'
$output = & $cli --no-update-check install tests/platform/esp32dev --dry-run --json 2> long-path-warning.txt
$code = $LASTEXITCODE
if ($code -ne 0) { throw "fallback package preview failed: $code" }
$output | ConvertFrom-Json | Out-Null
$warning = Get-Content long-path-warning.txt -Raw
if ($warning -notmatch 'WARNING:' -or $warning -notmatch 'fix-win' -or $warning.Contains([char]27)) {
throw 'fallback warning is missing or contains ANSI in redirected stderr'
}
& $cli --no-update-check build tests/platform/uno --dry-run
if ($LASTEXITCODE -ne 0) { throw 'disabled-policy daemon handoff failed' }
$after = Get-Content (Join-Path $env:USERPROFILE '.fbuild\prod\daemon\root-owner.json') -Raw | ConvertFrom-Json
if ($before.pid -eq $after.pid) { throw 'daemon was reused after the registry changed' }
& $cli --no-update-check daemon stop
if ($LASTEXITCODE -ne 0) { throw 'smoke daemon did not stop' }
} finally {
if ($null -eq $original) {
Remove-ItemProperty -Path $registry -Name LongPathsEnabled -ErrorAction SilentlyContinue
} else {
New-ItemProperty -Path $registry -Name LongPathsEnabled -PropertyType DWord -Value $original -Force | Out-Null
}
}
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ pip install fbuild
For source installs, platform notes, and first-run cache behavior, start with
the [getting started guide](docs/getting-started/README.md).

On Windows, `fbuild --fix-win` enables long paths with administrator approval.
Interactive ESP32 commands offer this repair when needed; declining uses a
short cache and prints a yellow warning. See [Windows setup](docs/getting-started/README.md#windows-long-paths).

## Command Quick Start

fbuild reads the same `platformio.ini` files as PlatformIO. Use these commands
Expand Down
95 changes: 75 additions & 20 deletions ci/platform_boundary_research.tsv
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@ crates/fbuild-core/src/platform/linux/device.rs 33 native_path std::os::unix::fs
crates/fbuild-core/src/platform/linux/device.rs 41 native_path libc:: process host_mechanic
crates/fbuild-core/src/platform/linux/device.rs 41 native_path libc:: process host_mechanic
crates/fbuild-core/src/platform/linux/fs.rs 2 native_path std::os::unix::fs::PermissionsExt fs host_mechanic
crates/fbuild-core/src/platform/linux/fs.rs 13 native_path std::os::unix::fs::MetadataExt fs host_mechanic
crates/fbuild-core/src/platform/linux/fs.rs 57 native_path std::os::unix::fs::symlink fs host_mechanic
crates/fbuild-core/src/platform/linux/fs.rs 61 native_path std::os::unix::fs::symlink fs host_mechanic
crates/fbuild-core/src/platform/linux/fs.rs 105 native_path std::os::unix::ffi::OsStrExt process host_mechanic
crates/fbuild-core/src/platform/linux/fs.rs 110 native_path libc:: process host_mechanic
crates/fbuild-core/src/platform/linux/fs.rs 112 native_path libc:: process host_mechanic
crates/fbuild-core/src/platform/linux/fs.rs 122 native_path libc:: process host_mechanic
crates/fbuild-core/src/platform/linux/fs.rs 31 native_path std::os::unix::fs fs host_mechanic
crates/fbuild-core/src/platform/linux/fs.rs 51 native_path libc:: process host_mechanic
crates/fbuild-core/src/platform/linux/fs.rs 51 native_path libc:: process host_mechanic
crates/fbuild-core/src/platform/linux/fs.rs 54 native_path libc:: process host_mechanic
crates/fbuild-core/src/platform/linux/fs.rs 68 native_path std::os::unix::fs::MetadataExt fs host_mechanic
crates/fbuild-core/src/platform/linux/fs.rs 112 native_path std::os::unix::fs::symlink fs host_mechanic
crates/fbuild-core/src/platform/linux/fs.rs 116 native_path std::os::unix::fs::symlink fs host_mechanic
crates/fbuild-core/src/platform/linux/fs.rs 158 native_path std::os::unix::ffi::OsStrExt process host_mechanic
crates/fbuild-core/src/platform/linux/fs.rs 163 native_path libc:: process host_mechanic
crates/fbuild-core/src/platform/linux/fs.rs 165 native_path libc:: process host_mechanic
crates/fbuild-core/src/platform/linux/fs.rs 175 native_path libc:: process host_mechanic
crates/fbuild-core/src/platform/linux/ipc.rs 1 native_path interprocess::local_socket ipc host_mechanic
crates/fbuild-core/src/platform/linux/ipc.rs 2 native_path interprocess::local_socket ipc host_mechanic
crates/fbuild-core/src/platform/linux/ipc.rs 3 native_path interprocess::os::unix ipc host_mechanic
Expand All @@ -25,13 +29,17 @@ crates/fbuild-core/src/platform/linux/ipc.rs 66 native_path std::os::unix::fs::P
crates/fbuild-core/src/platform/linux/mod.rs 14 compile_host_fact std::env::consts::ARCH host host_mechanic
crates/fbuild-core/src/platform/linux/process.rs 1 native_path std::os::unix::process::ExitStatusExt process host_mechanic
crates/fbuild-core/src/platform/macos/fs.rs 2 native_path std::os::unix::fs::PermissionsExt fs host_mechanic
crates/fbuild-core/src/platform/macos/fs.rs 13 native_path std::os::unix::fs::MetadataExt fs host_mechanic
crates/fbuild-core/src/platform/macos/fs.rs 57 native_path std::os::unix::fs::symlink fs host_mechanic
crates/fbuild-core/src/platform/macos/fs.rs 61 native_path std::os::unix::fs::symlink fs host_mechanic
crates/fbuild-core/src/platform/macos/fs.rs 105 native_path std::os::unix::ffi::OsStrExt process host_mechanic
crates/fbuild-core/src/platform/macos/fs.rs 110 native_path libc:: process host_mechanic
crates/fbuild-core/src/platform/macos/fs.rs 112 native_path libc:: process host_mechanic
crates/fbuild-core/src/platform/macos/fs.rs 122 native_path libc:: process host_mechanic
crates/fbuild-core/src/platform/macos/fs.rs 31 native_path std::os::unix::fs fs host_mechanic
crates/fbuild-core/src/platform/macos/fs.rs 51 native_path libc:: process host_mechanic
crates/fbuild-core/src/platform/macos/fs.rs 51 native_path libc:: process host_mechanic
crates/fbuild-core/src/platform/macos/fs.rs 54 native_path libc:: process host_mechanic
crates/fbuild-core/src/platform/macos/fs.rs 68 native_path std::os::unix::fs::MetadataExt fs host_mechanic
crates/fbuild-core/src/platform/macos/fs.rs 112 native_path std::os::unix::fs::symlink fs host_mechanic
crates/fbuild-core/src/platform/macos/fs.rs 116 native_path std::os::unix::fs::symlink fs host_mechanic
crates/fbuild-core/src/platform/macos/fs.rs 158 native_path std::os::unix::ffi::OsStrExt process host_mechanic
crates/fbuild-core/src/platform/macos/fs.rs 163 native_path libc:: process host_mechanic
crates/fbuild-core/src/platform/macos/fs.rs 165 native_path libc:: process host_mechanic
crates/fbuild-core/src/platform/macos/fs.rs 175 native_path libc:: process host_mechanic
crates/fbuild-core/src/platform/macos/ipc.rs 1 native_path interprocess::local_socket ipc host_mechanic
crates/fbuild-core/src/platform/macos/ipc.rs 2 native_path interprocess::local_socket ipc host_mechanic
crates/fbuild-core/src/platform/macos/ipc.rs 3 native_path socket2:: ipc host_mechanic
Expand All @@ -47,18 +55,65 @@ crates/fbuild-core/src/platform/windows/device.rs 35 native_path windows_sys:: p
crates/fbuild-core/src/platform/windows/fs.rs 2 native_path std::os::windows::ffi::OsStrExt process host_mechanic
crates/fbuild-core/src/platform/windows/fs.rs 3 native_path std::os::windows::fs fs host_mechanic
crates/fbuild-core/src/platform/windows/fs.rs 4 native_path std::os::windows::io::AsRawHandle process host_mechanic
crates/fbuild-core/src/platform/windows/fs.rs 60 native_path std::os::windows::fs::symlink_dir fs host_mechanic
crates/fbuild-core/src/platform/windows/fs.rs 64 native_path std::os::windows::fs::symlink_file fs host_mechanic
crates/fbuild-core/src/platform/windows/fs.rs 92 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/fs.rs 147 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/fs.rs 191 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/fs.rs 12 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/fs.rs 16 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/fs.rs 38 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/fs.rs 47 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/fs.rs 81 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/fs.rs 82 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/fs.rs 116 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/fs.rs 156 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/fs.rs 260 native_path std::os::windows::fs::symlink_dir fs host_mechanic
crates/fbuild-core/src/platform/windows/fs.rs 264 native_path std::os::windows::fs::symlink_file fs host_mechanic
crates/fbuild-core/src/platform/windows/fs.rs 292 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/fs.rs 352 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/fs.rs 394 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/fs.rs 405 attr_cfg #[cfg(windows)] host host_mechanic
crates/fbuild-core/src/platform/windows/fs.rs 417 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/fs.rs 418 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/fs.rs 438 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/fs.rs 439 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/fs.rs 458 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/ipc.rs 1 native_path interprocess::local_socket ipc host_mechanic
crates/fbuild-core/src/platform/windows/ipc.rs 2 native_path interprocess::local_socket ipc host_mechanic
crates/fbuild-core/src/platform/windows/ipc.rs 3 native_path interprocess::os::windows ipc host_mechanic
crates/fbuild-core/src/platform/windows/ipc.rs 4 native_path interprocess::os::windows ipc host_mechanic
crates/fbuild-core/src/platform/windows/ipc.rs 5 native_path socket2:: ipc host_mechanic
crates/fbuild-core/src/platform/windows/ipc.rs 6 native_path std::os::windows::io::AsRawSocket ipc host_mechanic
crates/fbuild-core/src/platform/windows/mod.rs 13 compile_host_fact std::env::consts::ARCH host host_mechanic
crates/fbuild-core/src/platform/windows/mod.rs 14 compile_host_fact std::env::consts::ARCH host host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 3 native_path std::os::windows::ffi::OsStrExt process host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 8 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 13 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 23 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 30 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 32 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 36 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 37 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 38 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 55 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 81 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 85 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 180 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 181 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 222 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 232 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 250 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 251 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 287 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 290 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 363 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 377 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 385 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 386 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 387 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 493 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 494 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 537 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 538 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 568 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 599 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 600 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/private_directory.rs 604 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/process.rs 87 native_path std::os::windows::ffi::OsStrExt process host_mechanic
crates/fbuild-core/src/platform/windows/process.rs 89 native_path windows_sys:: process host_mechanic
crates/fbuild-core/src/platform/windows/process.rs 92 native_path windows_sys:: process host_mechanic
Expand Down
3 changes: 3 additions & 0 deletions crates/fbuild-build-engine/src/compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,9 @@ pub async fn compile_source(
let output_buf = absolute_from_cwd(output);
let source = source_buf.as_path();
let output = output_buf.as_path();
for path in [compiler, source, output] {
fbuild_paths::long_paths::validate_legacy_path(path)?;
}

if let Some(parent) = output.parent() {
std::fs::create_dir_all(parent)?;
Expand Down
3 changes: 3 additions & 0 deletions crates/fbuild-build-engine/src/pipeline/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ impl BuildContext {
) -> Result<Self> {
let project_dir = &params.project_dir;
let env_name = &params.env_name;
fbuild_paths::long_paths::validate_legacy_path(project_dir)?;
fbuild_paths::long_paths::validate_legacy_path(&params.build_dir)?;
fbuild_paths::long_paths::prepare_build_directory(&params.build_dir)?;

// 1. Parse platformio.ini, attaching any forwarded `PLATFORMIO_*` env
// var overrides from the CLI caller (the daemon does not inherit
Expand Down
8 changes: 8 additions & 0 deletions crates/fbuild-cli/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,13 @@ fn main() {
let target = std::env::var("TARGET").unwrap_or_default();
if target.contains("pc-windows-msvc") {
println!("cargo:rustc-link-arg-bin=fbuild=/STACK:8388608");
let manifest = std::path::Path::new(&std::env::var("CARGO_MANIFEST_DIR").unwrap())
.join("../fbuild-core/src/platform/windows/long-paths.manifest");
println!("cargo:rerun-if-changed={}", manifest.display());
println!("cargo:rustc-link-arg-bin=fbuild=/MANIFEST:EMBED");
println!(
"cargo:rustc-link-arg-bin=fbuild=/MANIFESTINPUT:{}",
manifest.display()
);
}
}
1 change: 1 addition & 0 deletions crates/fbuild-cli/src/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ here and is dispatched from `cli::async_main`.
- **`reset.rs`** -- `run_reset`
- **`lnk.rs`** -- `run_lnk` (pull / check / add)
- **`install.rs`** -- `run_install`: in-process `fbuild install` over `fbuild_build::provision_env`, text / JSON rendering, `--check` exit codes (FastLED/fbuild#1433)
- **`windows_long_paths.rs`** -- Windows preflight, explicit UAC repair, fresh command restart, and graceful daemon handoff (#1673)
- **`tests.rs`** -- unit tests for argument normalization and `fbuild ci` parsing
8 changes: 8 additions & 0 deletions crates/fbuild-cli/src/cli/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,14 @@ pub struct Cli {
/// (`CI=true`) is auto-suppressed. See FastLED/fbuild#626.
#[arg(long = "no-update-check")]
pub no_update_check: bool,

/// Enable Windows long paths with administrator approval (UAC)
#[arg(long, global = true)]
pub fix_win: bool,

/// Fixed, one-shot registry repair helper; never starts a daemon.
#[arg(long = "__fix-win-helper", hide = true, conflicts_with = "fix_win")]
pub fix_win_helper: bool,
}

#[derive(Subcommand)]
Expand Down
Loading
Loading