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

How to set esp-idf-sys to rebuild when a C component changes? #316

Closed
Maldus512 opened this issue Jun 14, 2024 · 3 comments
Closed

How to set esp-idf-sys to rebuild when a C component changes? #316

Maldus512 opened this issue Jun 14, 2024 · 3 comments

Comments

@Maldus512
Copy link

I successfully set up an extra C component in my Rust project. I noticed however that cargo build does not rebuilds esp-idf-sys when any of the C sources is modified.
I try adding a pertinent rerun-if-changed directive to build.rs but I don't think that esp-idf-sys recognizes that the C component has changed (not sure about any of this, forgive my ignorance).

Is there a way to rebuild esp-idf-sys depending on an extra C component?

@Vollbrecht
Copy link
Collaborator

Vollbrecht commented Jun 14, 2024

adding a remote component can't be detected by cargo as its not changing anything that it know about in the past. That always need a cargo clean -p esp-idf-sys and then cargo b

the second case is now what you are wishing for - monitor an already added component from cargo. That is still a bit tricky but not completely hopeless. We don't currently support that but there were changes in the "bindgen" dependency that allows for tracking of c/c++ header files and act if they changed. You can look at the PR that added it in bindgen here. But that would not monitor changes you do in any .c file. For that i don't now about a simple solution, as we would again need full information about every file you are providing in the component. Since you only want to rebuild esp-idf-sys i would go with the cargo clean -p esp-idf-sys option as it only then would rebuild esp-idf-sys and dont recompile the rest.

@Maldus512
Copy link
Author

Thank you, I understand.

@Vollbrecht
Copy link
Collaborator

closing this for now, as we don't plan on implementing automatic detection, and a sufficient "workaround" was presented, If someone wants to pick up from here, feel free to reopen it up.

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

No branches or pull requests

2 participants