Conversation
There was a problem hiding this comment.
Pull request overview
This pull request updates ostool’s “someboot build-info.toml” auto-detection to be package/features aware, so optional/transitively-disabled someboot dependencies don’t incorrectly inject cargo args/rustflags.
Changes:
- Replace global
detect_build_config(...)calls withdetect_build_config_for_package(...)in build/config preparation paths. - Add a new reachability check via
cargo treeto gate applyingsomebootbuild-info for a specific package + feature set. - Bump
ostoolversion from0.8.13to0.8.14(and updateCargo.lock).
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
ostool/src/ctx.rs |
Use package/features-aware someboot config detection when preparing build config. |
ostool/src/build/someboot.rs |
Add detect_build_config_for_package(...), cargo tree reachability helper, and a new unit test. |
ostool/src/build/cargo_builder.rs |
Use package/features-aware detection when building cargo commands. |
ostool/Cargo.toml |
Version bump to 0.8.14. |
Cargo.lock |
Lockfile updated for ostool version bump. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+80
to
+82
| let meta = read_metadata(manifest_path, false)?; | ||
| let someboot_roots = collect_someboot_roots(&meta); | ||
| if someboot_roots.is_empty() { |
Comment on lines
+194
to
+198
| let output = cmd.output().with_context(|| { | ||
| format!( | ||
| "failed to run `cargo tree` for package `{}` and target `{}`", | ||
| package, target | ||
| ) |
Comment on lines
+397
to
+398
| fs::remove_dir_all(&root).expect("failed to remove temp workspace"); | ||
| } |
Comment on lines
+367
to
+394
| fs::write( | ||
| root.join("someboot/build-info.toml"), | ||
| "[x86_64-unknown-none]\n\ | ||
| rustflags = [\"-C\", \"relocation-model=pic\"]\n\ | ||
| cargoargs = [\"-Z\", \"build-std=core,alloc\"]\n", | ||
| ) | ||
| .unwrap(); | ||
|
|
||
| let manifest_path = root.join("Cargo.toml"); | ||
|
|
||
| let without_optional = | ||
| detect_build_config_for_package(&manifest_path, "app", &[], "x86_64-unknown-none") | ||
| .unwrap(); | ||
| assert!(without_optional.is_empty()); | ||
|
|
||
| let with_optional = detect_build_config_for_package( | ||
| &manifest_path, | ||
| "app", | ||
| &["app/with-someboot".to_string()], | ||
| "x86_64-unknown-none", | ||
| ) | ||
| .unwrap(); | ||
| assert_eq!(&with_optional[0..2], ["-Z", "build-std=core,alloc"]); | ||
| assert_eq!(with_optional[2], "--config"); | ||
| assert!( | ||
| with_optional | ||
| .iter() | ||
| .any(|arg| arg.starts_with("target.x86_64-unknown-none.rustflags=")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.