mirror of
https://github.com/ParkerTenBroeck/hdl_sim.git
synced 2026-06-06 21:24:06 -04:00
fixed artifact dep
This commit is contained in:
parent
d979e99ce5
commit
53eb596861
7 changed files with 18 additions and 57 deletions
2
.cargo/config.toml
Normal file
2
.cargo/config.toml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
[unstable]
|
||||||
|
bindeps = true
|
||||||
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -464,6 +464,7 @@ version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"axum",
|
"axum",
|
||||||
"futures-util",
|
"futures-util",
|
||||||
|
"libvhdl_conn",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"tokio",
|
"tokio",
|
||||||
|
|
|
||||||
|
|
@ -10,3 +10,6 @@ tower-http = { version = "0.6", features = ["fs", "trace"] }
|
||||||
futures-util = "0.3"
|
futures-util = "0.3"
|
||||||
serde = { version = "1", features = ["derive"] }
|
serde = { version = "1", features = ["derive"] }
|
||||||
serde_json = "1"
|
serde_json = "1"
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
libvhdl_conn = { path = "../libvhdl_conn", artifact = "staticlib" }
|
||||||
|
|
|
||||||
|
|
@ -1,58 +1,12 @@
|
||||||
use std::path::PathBuf;
|
use std::env;
|
||||||
use std::process::Command;
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// silly hack of sorts because bindeps are unstable
|
let artifact_path = env::var_os("CARGO_STATICLIB_FILE_LIBVHDL_CONN")
|
||||||
|
.expect("missing staticlib artifact for build-dependency `libvhdl_conn`");
|
||||||
|
|
||||||
|
println!("cargo:rerun-if-changed={}", artifact_path.display());
|
||||||
let manifest_dir = PathBuf::from(
|
println!(
|
||||||
std::env::var("CARGO_MANIFEST_DIR")
|
"cargo:rustc-env=EMBEDDED_VHDL_CONN_LIB_PATH={}",
|
||||||
.expect("CARGO_MANIFEST_DIR was not set by Cargo"),
|
artifact_path.display()
|
||||||
);
|
|
||||||
let workspace_root = manifest_dir
|
|
||||||
.parent()
|
|
||||||
.expect("relay crate should live under a workspace root");
|
|
||||||
|
|
||||||
println!("cargo:rerun-if-changed={}", workspace_root.join("conn").display());
|
|
||||||
|
|
||||||
let isolated_target_dir = workspace_root.join("target").join("conn-build");
|
|
||||||
|
|
||||||
let status = Command::new("cargo")
|
|
||||||
.arg("build")
|
|
||||||
.arg("--package")
|
|
||||||
.arg("libvhdl_conn")
|
|
||||||
.arg("--release")
|
|
||||||
.arg("--lib")
|
|
||||||
.arg("--target-dir")
|
|
||||||
.arg(&isolated_target_dir)
|
|
||||||
.current_dir(workspace_root)
|
|
||||||
.status()
|
|
||||||
.expect("failed to spawn cargo build for conn");
|
|
||||||
|
|
||||||
if !status.success() {
|
|
||||||
panic!(
|
|
||||||
"build script failed: `cargo build --package conn --release --lib` exited with {status}"
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy the built staticlib into the workspace release target path used by relay/src/build.rs.
|
|
||||||
let isolated_release_dir = isolated_target_dir.join("release");
|
|
||||||
let out_release_dir = workspace_root.join("target").join("release");
|
|
||||||
std::fs::create_dir_all(&out_release_dir).expect("failed to create workspace target/release");
|
|
||||||
|
|
||||||
// conn currently builds as libvhdl_conn.a; keep a compatibility alias for relay/src/build.rs (libvhdl_ui.a).
|
|
||||||
let src_lib = isolated_release_dir.join("libvhdl_conn.a");
|
|
||||||
if !src_lib.exists() {
|
|
||||||
panic!(
|
|
||||||
"build script failed: expected static library not found at {}",
|
|
||||||
src_lib.display()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
let dst_conn = out_release_dir.join("libvhdl_conn.a");
|
|
||||||
std::fs::copy(&src_lib, &dst_conn).expect("failed to copy libconn.a into workspace target/release");
|
|
||||||
|
|
||||||
let dst_compat = out_release_dir.join("libvhdl_conn.a");
|
|
||||||
std::fs::copy(&src_lib, &dst_compat)
|
|
||||||
.expect("failed to copy compatibility libvhdl_conn.a into workspace target/release");
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,7 @@ use tokio::process::{Child, Command};
|
||||||
|
|
||||||
use crate::HResult;
|
use crate::HResult;
|
||||||
|
|
||||||
const EMBEDDED_VHDL_UI_LIB: &[u8] =
|
const EMBEDDED_VHDL_UI_LIB: &[u8] = include_bytes!(env!("EMBEDDED_VHDL_CONN_LIB_PATH"));
|
||||||
include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/../target/release/libvhdl_conn.a"));
|
|
||||||
|
|
||||||
async fn ensure_ok(child: Child) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
async fn ensure_ok(child: Child) -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
|
||||||
let result = child.wait_with_output().await?;
|
let result = child.wait_with_output().await?;
|
||||||
|
|
|
||||||
|
|
@ -3,5 +3,5 @@ set -euo pipefail
|
||||||
|
|
||||||
|
|
||||||
pushd relay >/dev/null
|
pushd relay >/dev/null
|
||||||
cargo run --release -- "$@"
|
cargo +nightly run -Z bindeps --release -- "$@"
|
||||||
popd >/dev/null
|
popd >/dev/null
|
||||||
|
|
|
||||||
2
rust-toolchain.toml
Normal file
2
rust-toolchain.toml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
[toolchain]
|
||||||
|
channel = "nightly"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue