mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-05 22:47:02 -04:00
* Move swift build scripts into xtask (#1201) * fix(ffi): use target_path from `cargo metadata` rather than guessing * ci(ffi): install necessary target arch for build-framework test * feat(xtask): copy to target without rsync.
29 lines
831 B
Rust
29 lines
831 B
Rust
use std::{env, path::PathBuf};
|
|
|
|
use serde::Deserialize;
|
|
use xshell::cmd;
|
|
|
|
use crate::Result;
|
|
|
|
pub fn root_path() -> Result<PathBuf> {
|
|
#[derive(Deserialize)]
|
|
struct Metadata {
|
|
workspace_root: PathBuf,
|
|
}
|
|
|
|
let cargo = env::var("CARGO").unwrap_or_else(|_| "cargo".to_owned());
|
|
let metadata_json = cmd!("{cargo} metadata --no-deps --format-version 1").read()?;
|
|
Ok(serde_json::from_str::<Metadata>(&metadata_json)?.workspace_root)
|
|
}
|
|
|
|
pub fn target_path() -> Result<PathBuf> {
|
|
#[derive(Deserialize)]
|
|
struct Metadata {
|
|
target_directory: PathBuf,
|
|
}
|
|
|
|
let cargo = env::var("CARGO").unwrap_or_else(|_| "cargo".to_owned());
|
|
let metadata_json = cmd!("{cargo} metadata --no-deps --format-version 1").read()?;
|
|
Ok(serde_json::from_str::<Metadata>(&metadata_json)?.target_directory)
|
|
}
|