Skip to content

Commit

Permalink
Raise recommended ESP IDF to 5.2.3; always print recommended build ve…
Browse files Browse the repository at this point in the history
…rsions; exclude master and release branches from the recommendation
  • Loading branch information
ivmarkov committed Dec 22, 2024
1 parent 93c031d commit 320a0ba
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 34 deletions.
69 changes: 36 additions & 33 deletions build/native/cargo_driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,40 +274,43 @@ pub fn build() -> Result<EspIdfBuildOutput> {
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);
Expand Down
2 changes: 1 addition & 1 deletion build/native/cargo_driver/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"))]
Expand Down

0 comments on commit 320a0ba

Please sign in to comment.