Skip to content

Commit

Permalink
handle alternate target directories
Browse files Browse the repository at this point in the history
  • Loading branch information
iliana committed May 14, 2024
1 parent f491f2f commit bf93834
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions dev-tools/releng/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ license = "MPL-2.0"
anyhow.workspace = true
camino.workspace = true
camino-tempfile.workspace = true
cargo_metadata = "0.18.1"
chrono.workspace = true
clap.workspace = true
fs-err = { workspace = true, features = ["tokio"] }
Expand Down
17 changes: 14 additions & 3 deletions dev-tools/releng/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,13 @@ fn main() -> Result<()> {
std::env::set_current_dir(&*WORKSPACE_DIR)
.context("failed to change working directory to workspace root")?;

// Determine the target directory.
let target_dir = cargo_metadata::MetadataCommand::new()
.no_deps()
.exec()
.context("failed to get cargo metadata")?
.target_directory;

// Unset `$CARGO`, `$CARGO_MANIFEST_DIR`, and `$RUSTUP_TOOLCHAIN` (all
// set by cargo or its rustup proxy), which will interfere with various
// tools we're about to run. (This needs to come _after_ we read from
Expand All @@ -183,11 +190,15 @@ fn main() -> Result<()> {
// Now that we're done mucking about with our environment (something that's
// not necessarily safe in multi-threaded programs), create a Tokio runtime
// and call `do_run`.
do_run(logger, args)
do_run(logger, args, target_dir)
}

#[tokio::main]
async fn do_run(logger: Logger, args: Args) -> Result<()> {
async fn do_run(
logger: Logger,
args: Args,
target_dir: Utf8PathBuf,
) -> Result<()> {
let permits = Arc::new(Semaphore::new(
std::thread::available_parallelism()
.context("couldn't get available parallelism")?
Expand Down Expand Up @@ -382,7 +393,7 @@ async fn do_run(logger: Logger, args: Args) -> Result<()> {
"omicron-package",
]),
);
WORKSPACE_DIR.join("target/release/omicron-package")
target_dir.join("release/omicron-package")
};

// Generate `omicron-package stamp` jobs for a list of packages as a nested
Expand Down

0 comments on commit bf93834

Please sign in to comment.