-
Notifications
You must be signed in to change notification settings - Fork 125
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
build cargo_driver: update embuild to support non-git IDF_PATH
#353
Conversation
}; | ||
|
||
let idf_path = config.native.idf_path.as_deref(); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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:
idf_path
, theesp-idf
source directory aka$IDF_PATH
used byembuild::EspIdf
, returned asidf
idf_tools_install_dir
, the tool installation directory (no source code), returned astools_install_dir
.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I read this correctly, before these 2 PRs,
esp-idf-sys
would read idf_path from (a) env ofIDF_PATH
, (b)package.metadata.esp-idf-sys.idf_path
in cargo.toml.- while
embuild
would only readIDF_PATH
from (a) env ofIDF_PATH
Suppose we specify idf_path from (b)
[package.metadata.esp-idf-sys]
idf_path = "/path/to/my/idf-checkout"
embuild
would never know idf_path
is set to /path/to/my/idf-checkout
, so we need to pass this information to embuild. And now there's 2 way to achieve this
- passing as an argument to
embuild::EspIdf::from_env
, as @denbeigh2000 do in this PR. - set environment variable using
std::env::set_var
, not sure if there's other side effects.
@ivmarkov hope this helps.
@@ -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 { |
There was a problem hiding this comment.
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
?
There was a problem hiding this comment.
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?)
@denbeigh2000 Sorry for the delay. Actually not sure if the ball is in my garden now or yours? I think we have two outstanding items:
|
No problem, my day job has also kept me busy.
Yup, this is on me, I'll fix this up.
This might be asking two questions, and I want to make sure I address both:
What should
|
@denbeigh2000 I have the feeling I'm threading water here simply because the current code in However, this is not fair to the work you've put in this and the
Thanks again for your work. Closing in favor of #356 |
* build cargo_driver: update embuild to support non-git `IDF_PATH` * Leave a TODO that we need to cleanup the code that deals with an activated ESP IDF environment --------- Co-authored-by: Denbeigh Stevens <[email protected]>
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:
embuild
shouldn't requiregit
or.git
to exist in order to build the project embuild#81 (comment)