From 320a0ba66643798ec2e9f837dbf0968417f8ce5e Mon Sep 17 00:00:00 2001 From: ivmarkov Date: Sun, 22 Dec 2024 09:48:44 +0000 Subject: [PATCH] Raise recommended ESP IDF to 5.2.3; always print recommended build versions; exclude master and release branches from the recommendation --- build/native/cargo_driver.rs | 69 +++++++++++++++-------------- build/native/cargo_driver/config.rs | 2 +- 2 files changed, 37 insertions(+), 34 deletions(-) diff --git a/build/native/cargo_driver.rs b/build/native/cargo_driver.rs index 88746f53cb..9133298c21 100644 --- a/build/native/cargo_driver.rs +++ b/build/native/cargo_driver.rs @@ -274,40 +274,43 @@ pub fn build() -> Result { None }; - // Apply patches, only if the patches were not previously applied and if the esp-idf repo is managed. - if idf.is_managed_espidf { - let patch_set = match idf.version.as_ref().map(|v| (v.major, v.minor, v.patch)) { - // master branch - _ if { - let default_branch = idf.repository.get_default_branch()?; - let curr_branch = idf.repository.get_branch_name()?; - default_branch == curr_branch && default_branch.is_some() - } => - { - NO_PATCHES - } - Ok((5, 0, _)) => V_5_0_PATCHES, - Ok((5, _, _)) => NO_PATCHES, - Ok((4, 4, _)) => V_4_4_3_PATCHES, - Ok((major, minor, patch)) => { - cargo::print_warning(format_args!( - "esp-idf version ({major}.{minor}.{patch}) not officially supported by `esp-idf-sys`. \ - Supported versions are 'master', 'release/v5.1', 'release/v5.0', 'release/v4.4', \ - 'v5.1(.X)', 'v5.0(.X)', 'v4.4(.X)'", - )); - &[] - } - Err(err) => { - cargo::print_warning(format!( - "Could not determine patch-set for esp-idf repository: {err}" - )); - &[] - } - }; - if !patch_set.is_empty() { - idf.repository - .apply_once(patch_set.iter().map(|p| manifest_dir.join(p)))?; + #[allow(unreachable_patterns)] + let patch_set = match idf.version.as_ref().map(|v| (v.major, v.minor, v.patch)) { + // master branch + _ if { + let default_branch = idf.repository.get_default_branch()?; + let curr_branch = idf.repository.get_branch_name()?; + default_branch == curr_branch && default_branch.is_some() + } => + { + cargo::print_warning( + "Building against ESP-IDF `master` is not officially supported. \ + Supported versions are 'v5.2(.X)', 'v5.1(.X)', 'v5.0(.X)', 'v4.4(.X)'", + ); + NO_PATCHES } + Ok((4, 4, _)) => V_4_4_3_PATCHES, + Ok((5, 0, _)) => V_5_0_PATCHES, + Ok((5, 1, _)) | Ok((5, 2, _)) => NO_PATCHES, + Ok((major, minor, patch)) => { + cargo::print_warning(format_args!( + "Building against ESP-IDF version ({major}.{minor}.{patch}) is not officially supported. \ + Supported versions are 'v5.2(.X)', 'v5.1(.X)', 'v5.0(.X)', 'v4.4(.X)'", + )); + NO_PATCHES + } + Err(err) => { + cargo::print_warning(format!( + "Could not determine patch-set for ESP-IDF repository: {err}" + )); + NO_PATCHES + } + }; + + // Apply patches, only if the patches were not previously applied and if the esp-idf repo is managed. + if idf.is_managed_espidf && !patch_set.is_empty() { + idf.repository + .apply_once(patch_set.iter().map(|p| manifest_dir.join(p)))?; } env::set_var("PATH", &idf.exported_path); diff --git a/build/native/cargo_driver/config.rs b/build/native/cargo_driver/config.rs index 9c9ed09e17..711e0f564d 100644 --- a/build/native/cargo_driver/config.rs +++ b/build/native/cargo_driver/config.rs @@ -16,7 +16,7 @@ use crate::config::EspIdfSys; pub const ESP_IDF_VERSION_VAR: &str = "ESP_IDF_VERSION"; pub const ESP_IDF_REPOSITORY_VAR: &str = "ESP_IDF_REPOSITORY"; -pub const DEFAULT_ESP_IDF_VERSION: &str = "v5.2.1"; +pub const DEFAULT_ESP_IDF_VERSION: &str = "v5.2.3"; pub const DEFAULT_CMAKE_GENERATOR: cmake::Generator = { // No Ninja builds for linux=aarch64 from Espressif yet #[cfg(all(target_os = "linux", target_arch = "aarch64"))]