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
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ owo-colors = "4"
running-process = { version = "4.5.7", default-features = false, features = ["client-async"] }

[profile.dev]
debug = 0
debug = "line-tables-only"
# Cargo's dev defaults: opt-level = 0 for first-party (fast compile +
# fast link), incremental = true (cargo + linker keep state across
# builds), codegen-units = 256 (parallel compile units). We accept
Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in

This file was deleted.

91 changes: 0 additions & 91 deletions build_backend.py

This file was deleted.

5 changes: 4 additions & 1 deletion crates/fbuild-build-esp/src/esp32/orchestrator/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,10 @@ impl BuildOrchestrator for Esp32Orchestrator {
if params.clean_all {
let _g = perf.phase("core-cache-remove");
match std::fs::remove_dir_all(core_cache.path()) {
Ok(()) => tracing::info!("removed framework core cache {}", core_cache.path().display()),
Ok(()) => tracing::info!(
"removed framework core cache {}",
core_cache.path().display()
),
Err(error) if error.kind() == std::io::ErrorKind::NotFound => {}
Err(error) => tracing::warn!(
"failed to remove framework core cache {}: {}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,10 @@ mod tests {

let hydrated = tmp.path().join("hydrated");
assert_eq!(cache.hydrate(&hydrated).unwrap(), 1);
assert_eq!(std::fs::read(hydrated.join("libwifi.a")).unwrap(), b"archive");
assert_eq!(
std::fs::read(hydrated.join("libwifi.a")).unwrap(),
b"archive"
);
assert!(cache.has_failed("matter"));
cache.remove().unwrap();
assert!(!cache.has_failed("matter"));
Expand Down
10 changes: 8 additions & 2 deletions crates/fbuild-build-esp/src/esp32/orchestrator/framework_libs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,9 @@ pub(super) async fn compile_framework_builtin_libs(
if params.clean_all {
match framework_cache.remove() {
Ok(()) => tracing::info!("removed ESP32 framework library cache"),
Err(error) => tracing::warn!("failed to remove ESP32 framework library cache: {}", error),
Err(error) => {
tracing::warn!("failed to remove ESP32 framework library cache: {}", error)
}
}
}
match framework_cache.hydrate(&fw_libs_build_dir) {
Expand Down Expand Up @@ -260,7 +262,11 @@ pub(super) async fn compile_framework_builtin_libs(
tracing::debug!("framework library {} failed to compile: {}", lib_name, e);
record_failed_framework_lib(&failure_marker, &fw_signature, &e.to_string());
if let Err(error) = framework_cache.record_failure(&lib_name) {
tracing::warn!("failed to cache framework library failure {}: {}", lib_name, error);
tracing::warn!(
"failed to cache framework library failure {}: {}",
lib_name,
error
);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/fbuild-build-esp/src/esp32/orchestrator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ mod cdc;
mod embed;
mod embed_stage;
mod fingerprint;
mod framework_libs;
mod framework_library_cache;
mod framework_libs;
mod helpers;
mod local_libs;
mod packages;
Expand Down
1 change: 1 addition & 0 deletions crates/fbuild-build/tests/avr_build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ fn uno_build_params(project_dir: &Path, build_dir: PathBuf, clean: bool) -> Buil
project_dir: project_dir.to_path_buf(),
env_name: "uno".to_string(),
clean,
clean_all: false,
profile: BuildProfile::Release,
build_dir,
verbose: false,
Expand Down
8 changes: 7 additions & 1 deletion crates/fbuild-cli/src/cli/dispatch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,13 @@ pub async fn async_main() {
}) => {
let project_dir = resolve_project_dir(project_dir, &top_level_project_dir);
if platformio {
pio_build(&project_dir, environment.as_deref(), clean || clean_all, verbose).await
pio_build(
&project_dir,
environment.as_deref(),
clean || clean_all,
verbose,
)
.await
} else {
run_build(
project_dir,
Expand Down
5 changes: 4 additions & 1 deletion crates/fbuild-cli/src/cli/port_scan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ fn run_scan(offline: bool) -> Result<()> {
if !problem_devices.is_empty() {
// This is actionable final command output. Keep it visible under the
// default tracing filter instead of requiring users to set RUST_LOG.
output::diagnostic(format!("warning: {}", format_usb_problem_warning(&problem_devices)));
output::diagnostic(format!(
"warning: {}",
format_usb_problem_warning(&problem_devices)
));
}
Ok(())
}
Expand Down
56 changes: 28 additions & 28 deletions crates/fbuild-deploy/src/rp2040.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ fn timeout_from_env(var_name: &str, default: Duration) -> Duration {
}

fn rp2040_post_deploy_timeout() -> Duration {
let timing = fbuild_serial::boards::BoardFamily::NativeUsbCdcReset1200Bps
.handoff_timing();
let timing = fbuild_serial::boards::BoardFamily::NativeUsbCdcReset1200Bps.handoff_timing();
timeout_from_env(
POST_DEPLOY_TIMEOUT_ENV,
Duration::from_millis(u64::from(timing.application_cdc_timeout_ms)),
Expand Down Expand Up @@ -1127,15 +1126,15 @@ fn resolve_post_flash_cdc(
Err(CdcWaitError::Timeout(diagnostics)) if flash_confirmed => {
tracing::warn!(diagnostics = %diagnostics.diagnostics(), "RP2040 runtime CDC did not return before the confirmed-flash deadline");
Ok(PostFlashCdc::Unconfirmed(format!(
"the firmware was flashed and accepted, but the runtime CDC port did not reappear within {}s; first-plug driver installation can exceed this window — the board is likely healthy (extend the window with {POST_DEPLOY_TIMEOUT_ENV})",
window.as_secs()
"the firmware was flashed and accepted, but the runtime CDC port did not reappear within {}s; first-plug driver installation can exceed this window — the board is likely healthy (extend the window with {POST_DEPLOY_TIMEOUT_ENV})",
window.as_secs()
)))
}
Err(CdcWaitError::Timeout(diagnostics)) => {
tracing::warn!(diagnostics = %diagnostics.diagnostics(), "RP2040 runtime CDC did not return before the unconfirmed-flash deadline");
Err(FbuildError::DeployFailed(format!(
"RP2040 firmware was transferred, but no catalogue-identified runtime CDC port appeared within {}s; verify that the firmware enables USB serial and that FastLED/boards USB data is current (extend the window with {POST_DEPLOY_TIMEOUT_ENV})",
window.as_secs()
"RP2040 firmware was transferred, but no catalogue-identified runtime CDC port appeared within {}s; verify that the firmware enables USB serial and that FastLED/boards USB data is current (extend the window with {POST_DEPLOY_TIMEOUT_ENV})",
window.as_secs()
)))
}
}
Expand Down Expand Up @@ -2069,18 +2068,17 @@ mod tests {

#[test]
fn cdc_timeout_after_confirmed_flash_downgrades_to_unconfirmed_success() {
let outcome =
resolve_post_flash_cdc(
true,
Err(CdcWaitError::Timeout(CdcWaitTimeout {
elapsed: Duration::from_secs(15),
previous_port: Some("COM7".to_string()),
requested_serial: Some("serial".to_string()),
candidates: Vec::new(),
})),
Duration::from_secs(15),
)
.unwrap();
let outcome = resolve_post_flash_cdc(
true,
Err(CdcWaitError::Timeout(CdcWaitTimeout {
elapsed: Duration::from_secs(15),
previous_port: Some("COM7".to_string()),
requested_serial: Some("serial".to_string()),
candidates: Vec::new(),
})),
Duration::from_secs(15),
)
.unwrap();
let PostFlashCdc::Unconfirmed(note) = outcome else {
panic!("expected an unconfirmed-CDC downgrade, got {outcome:?}");
};
Expand Down Expand Up @@ -2203,16 +2201,18 @@ mod tests {
None,
&BTreeSet::new(),
Duration::ZERO,
|| Ok(vec![
PicoCdcPort {
name: "COM12".to_string(),
serial_number: None,
},
PicoCdcPort {
name: "COM13".to_string(),
serial_number: None,
},
]),
|| {
Ok(vec![
PicoCdcPort {
name: "COM12".to_string(),
serial_number: None,
},
PicoCdcPort {
name: "COM13".to_string(),
serial_number: None,
},
])
},
|| Duration::ZERO,
|_| {},
);
Expand Down
43 changes: 22 additions & 21 deletions crates/fbuild-serial/src/ports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ mod imp {
use serialport::{SerialPortInfo, SerialPortType, UsbPortInfo};
use windows_sys::Win32::Devices::DeviceAndDriverInstallation::{
CM_Get_DevNode_Status, CM_Get_Device_IDW, CM_Get_Parent, CR_SUCCESS, DICS_FLAG_GLOBAL,
DIGCF_PRESENT, DIREG_DEV, GUID_DEVCLASS_USB, HDEVINFO, MAX_DEVICE_ID_LEN,
SP_DEVINFO_DATA, SPDRP_FRIENDLYNAME, SPDRP_HARDWAREID, SPDRP_LOCATION_INFORMATION,
SPDRP_MFG, SetupDiClassGuidsFromNameW, SetupDiDestroyDeviceInfoList, SetupDiEnumDeviceInfo,
DIGCF_PRESENT, DIREG_DEV, GUID_DEVCLASS_USB, HDEVINFO, MAX_DEVICE_ID_LEN, SP_DEVINFO_DATA,
SPDRP_FRIENDLYNAME, SPDRP_HARDWAREID, SPDRP_LOCATION_INFORMATION, SPDRP_MFG,
SetupDiClassGuidsFromNameW, SetupDiDestroyDeviceInfoList, SetupDiEnumDeviceInfo,
SetupDiGetClassDevsW, SetupDiGetDeviceInstanceIdW, SetupDiGetDeviceRegistryPropertyW,
SetupDiOpenDevRegKey,
};
Expand Down Expand Up @@ -440,13 +440,15 @@ mod imp {
break;
}
let mut buffer = [0u16; MAX_DEVICE_ID_LEN as usize];
let result = unsafe {
CM_Get_Device_IDW(parent, buffer.as_mut_ptr(), buffer.len() as u32, 0)
};
let result =
unsafe { CM_Get_Device_IDW(parent, buffer.as_mut_ptr(), buffer.len() as u32, 0) };
if result != CR_SUCCESS {
break;
}
let length = buffer.iter().position(|&unit| unit == 0).unwrap_or(buffer.len());
let length = buffer
.iter()
.position(|&unit| unit == 0)
.unwrap_or(buffer.len());
ids.push(String::from_utf16_lossy(&buffer[..length]));
current = parent;
}
Expand All @@ -455,24 +457,18 @@ mod imp {

fn classify_usb_ancestry(devinst: u32) -> Option<bool> {
let ancestors = ancestor_ids(devinst);
let root_index = ancestors.iter().position(|id| {
id.to_ascii_uppercase().starts_with("USB\\ROOT_HUB")
})?;
let root_index = ancestors
.iter()
.position(|id| id.to_ascii_uppercase().starts_with("USB\\ROOT_HUB"))?;
Some(ancestors[..root_index].iter().any(|id| {
let upper = id.to_ascii_uppercase();
upper.starts_with("USB\\VID_") && upper.contains("&PID_")
}))
}

pub(super) fn present_usb_problem_devices() -> Vec<UsbProblemDevice> {
let hdi = unsafe {
SetupDiGetClassDevsW(
&GUID_DEVCLASS_USB,
std::ptr::null(),
0,
DIGCF_PRESENT,
)
};
let hdi =
unsafe { SetupDiGetClassDevsW(&GUID_DEVCLASS_USB, std::ptr::null(), 0, DIGCF_PRESENT) };
if hdi == INVALID_HANDLE_VALUE {
return Vec::new();
}
Expand Down Expand Up @@ -535,7 +531,10 @@ mod imp {
if ok == FALSE {
return None;
}
let length = buffer.iter().position(|&unit| unit == 0).unwrap_or(buffer.len());
let length = buffer
.iter()
.position(|&unit| unit == 0)
.unwrap_or(buffer.len());
Some(String::from_utf16_lossy(&buffer[..length]))
}

Expand All @@ -560,7 +559,10 @@ mod imp {
if ok == FALSE || value_type != REG_SZ {
return None;
}
let length = buffer.iter().position(|&unit| unit == 0).unwrap_or(buffer.len());
let length = buffer
.iter()
.position(|&unit| unit == 0)
.unwrap_or(buffer.len());
let value = String::from_utf16_lossy(&buffer[..length]);
(!value.is_empty()).then_some(value)
}
Expand Down Expand Up @@ -750,6 +752,5 @@ mod imp {
assert_eq!(info.interface, None);
assert_eq!(info.serial_number.as_deref(), Some("B4:3A:45:B0:08:24"));
}

}
}
4 changes: 2 additions & 2 deletions docs/getting-started/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ keeps local rebuilds quick. To explicitly build an optimized Rust wheel, pass
the PEP 517 backend setting:

```bash
pip install . --config-settings fbuild-profile=release
pip install . --config-settings profile=release
```

`pip install . -- --release` is not supported: pip does not forward arbitrary
arguments after `--` to a PEP 517 backend. The `fbuild-profile` setting (or
arguments after `--` to a PEP 517 backend. The `profile=release` setting (or
`FBUILD_BUILD_RELEASE=1`) is the supported release override.

## First Project
Expand Down
Loading
Loading