Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build cargo_driver: update embuild to support non-git IDF_PATH #353

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

denbeigh2000
Copy link

Updates the version of embuild, and the way it gets invoked, so that we can make use of the changes in esp-rs/embuild#95.

This will allow the end user to provide an IDF_PATH that is not a git checkout.

See this comment for testing methodology

Closes #241.
Not sure about #184, but it will at least remove some blockers to that end.

cc/ @ivmarkov

See also:

@@ -35,7 +35,7 @@ build-time = "0.1" # For esp_app_desc!()
const_format = "0.2" # For esp_app_desc!()

[build-dependencies]
embuild = { version = "0.32", features = ["glob", "kconfig", "cmake", "espidf"] }
embuild = { git = "https://github.com/denbeigh2000/embuild", rev = "be687ce7dc78fd4cba6f0defd513e0ebb32aac73", version = "0.32", features = ["glob", "kconfig", "cmake", "espidf"] }
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will update and un-draft following the merge of esp-rs/embuild#95

};

let idf_path = config.native.idf_path.as_deref();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As in the other PR (embuild), I'm struggling to understand why this line is necessary.
Can you elaborate a bit on it? How come we need it now, but we did not need it before?

Copy link
Author

@denbeigh2000 denbeigh2000 Dec 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These refer to two paths with different purposes that eventually get returned on line 127:

Before this PR, the only way to set a custom IDF checkout was to set the $IDF_PATH environment variable - this has been changed to use config.native.idf_path, which respects both documented ways to configure ESP-IDF when constructed.

Note

This change might also fix an existing bug where this config in Cargo.toml isn't respected? 🤔

[package.metadata.esp-idf-sys]
idf_path = "/path/to/my/idf-checkout"

I'm happy to add a comment and/or update variable names if there's something you find clearer.

@@ -274,13 +277,12 @@ 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 {
if let SourceTree::Git(repository) = &idf.esp_idf_dir {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm, is this change OK? This way you'll also patch external, user-supplied repositories which might not be ideal (i.e. making changes to a user-supplied directory).

Why can't we just use the old logic with is_managed_espidf?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm you're correct - this is checking if the dir is a git repo, instead of if it's managed by EspIdf. Will fix this in next commit (tomorrow?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants