Skip to content

Commit

Permalink
xtask lsp: optionally source app.toml from HUBRIS_APP
Browse files Browse the repository at this point in the history
If a HUBRIS_APP environment variable is defined and points to an
app.toml file, cargo xtask lsp will assume this is the app you'd like to
use for build context.
  • Loading branch information
cbiffle committed May 2, 2024
1 parent 6f4fb31 commit a19d9c6
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions build/xtask/src/lsp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,13 +346,17 @@ fn inner(file: &PathBuf, clients: &[LspClient]) -> Result<LspConfig> {
}
}

let preferred_apps = [
"app/gimlet/rev-c.toml",
"app/sidecar/rev-b.toml",
"app/psc/rev-b.toml",
];
let preferred_apps = if let Ok(toml) = std::env::var("HUBRIS_APP") {
vec![toml]
} else {
vec![
"app/gimlet/rev-c.toml".to_string(),
"app/sidecar/rev-b.toml".to_string(),
"app/psc/rev-b.toml".to_string(),
]
};
for app_name in preferred_apps {
let file = root.join(app_name);
let file = root.join(&app_name);
let app_cfg = PackageConfig::new(&file, false, false)
.context(format!("could not open {file:?}"))?;

Expand All @@ -365,7 +369,7 @@ fn inner(file: &PathBuf, clients: &[LspClient]) -> Result<LspConfig> {
check_task(
&package_name,
task_name,
app_name,
&app_name,
&app_cfg,
&packages,
)
Expand Down

0 comments on commit a19d9c6

Please sign in to comment.