Skip to content

Resolve relative --config paths in xtask#835

Merged
bunnie merged 1 commit intobetrusted-io:devfrom
sbellem:xtask-cargo-config-fix
Mar 19, 2026
Merged

Resolve relative --config paths in xtask#835
bunnie merged 1 commit intobetrusted-io:devfrom
sbellem:xtask-cargo-config-fix

Conversation

@sbellem
Copy link
Copy Markdown
Contributor

@sbellem sbellem commented Mar 18, 2026

Problem: relative cargo .toml config paths don't resolve when cargo is invoked from a subdirectory like kernel/.

Solution: convert relative paths to absolute against the project root in the cargo() helper.

@bunnie
Copy link
Copy Markdown
Member

bunnie commented Mar 18, 2026

For some reason the CI isn't running the formatting checks at this stage. Can you please run cargo +nights fmt --check on your PR to see if any differences pop out? This is what I got after merging the last PR:

Run cargo +nightly fmt --check
Diff in /home/runner/work/xous-core/xous-core/xtask/src/builder.rs:1524:
 }
 
 pub fn project_root() -> PathBuf {
-    Path::new(&std::env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set — this binary must be run via cargo")).ancestors().nth(1).unwrap().to_path_buf()
+    Path::new(
+        &std::env::var("CARGO_MANIFEST_DIR")
+            .expect("CARGO_MANIFEST_DIR not set — this binary must be run via cargo"),
+    )
+    .ancestors()
+    .nth(1)
+    .unwrap()
+    .to_path_buf()
 }
 
 use std::fs::File;
Diff in /home/runner/work/xous-core/xous-core/xtask/src/utils.rs:401:
     Ok(())
 }
 
-pub(crate) fn track_language_changes(last_lang: &str, cargo_configs: &[String]) -> Result<(), crate::DynError> {
+pub(crate) fn track_language_changes(
+    last_lang: &str,
+    cargo_configs: &[String],
+) -> Result<(), crate::DynError> {
     let last_config = "target/LAST_LANG";
     let mut contents = String::new();

Problem: relative .toml config paths don't resolve
when cargo is invoked from a subdirectory like kernel/.

Solution: convert relative paths to absolute against
the project root in the cargo() helper.
@sbellem sbellem force-pushed the xtask-cargo-config-fix branch from 1288d09 to fa7e34d Compare March 18, 2026 16:54
@sbellem
Copy link
Copy Markdown
Contributor Author

sbellem commented Mar 18, 2026

For some reason the CI isn't running the formatting checks at this stage. Can you please run cargo +nights fmt --check on your PR to see if any differences pop out?

Yes, forgot to run cargo fmt. Just did, and pushed the now correctly formatted code.

@bunnie bunnie merged commit d254e41 into betrusted-io:dev Mar 19, 2026
9 checks passed
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