From 7a659cfe6e0dac4a6a320085cf27897e6db7ec79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Casta=C3=B1o=20Arteaga?= Date: Mon, 30 Oct 2023 13:46:51 +0100 Subject: [PATCH] Update cargo-dist config and build script (#314) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sergio Castaño Arteaga --- Cargo.lock | 16 +++- Cargo.toml | 9 +-- build.rs | 8 ++ wix/main.wxs | 215 --------------------------------------------------- 4 files changed, 26 insertions(+), 222 deletions(-) delete mode 100644 wix/main.wxs diff --git a/Cargo.lock b/Cargo.lock index b1de5663..da767793 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1355,7 +1355,7 @@ dependencies = [ "thiserror", "tungstenite", "url", - "which", + "which 4.4.2", "winreg 0.51.0", ] @@ -1684,6 +1684,7 @@ dependencies = [ "url", "usvg", "walkdir", + "which 5.0.0", ] [[package]] @@ -3711,6 +3712,19 @@ dependencies = [ "rustix", ] +[[package]] +name = "which" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bf3ea8596f3a0dd5980b46430f2058dfe2c36a27ccfbb1845d6fbfcd9ba6e14" +dependencies = [ + "either", + "home", + "once_cell", + "rustix", + "windows-sys", +] + [[package]] name = "winapi" version = "0.3.9" diff --git a/Cargo.toml b/Cargo.toml index cff1e31b..a5157852 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,10 +8,6 @@ rust-version = "1.70" repository = "https://github.com/cncf/landscape2" authors = ["Sergio Castaño Arteaga", "Cintia Sanchez Garcia"] -[package.metadata.wix] -upgrade-guid = "8B8B47D4-B0F2-4755-9288-1C5FCFCA9F92" -path-guid = "5A454C4A-3A81-4F07-91A2-D8A181CC98B7" - [dependencies] anyhow = "1.0.75" askama = { version = "0.12.1", features = ["serde-json"] } @@ -66,6 +62,7 @@ mockall = "0.11.4" [build-dependencies] anyhow = "1.0.75" +which = "5.0.0" # The profile that 'cargo dist' will build with [profile.dist] @@ -79,11 +76,11 @@ cargo-dist-version = "0.4.0" # CI backends to support ci = ["github"] # The installers to generate for each app -installers = ["shell", "powershell", "homebrew", "msi"] +installers = ["shell", "homebrew"] # A GitHub repo to push Homebrew formulas to tap = "cncf/homebrew-landscape2" # Target platforms to build apps for (Rust target-triple syntax) -targets = ["x86_64-unknown-linux-gnu", "aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-musl", "x86_64-pc-windows-msvc"] +targets = ["x86_64-unknown-linux-gnu", "aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-unknown-linux-musl"] # Publish jobs to run in CI publish-jobs = ["homebrew"] # Publish jobs to run in CI diff --git a/build.rs b/build.rs index 049d1837..f69fc3f1 100644 --- a/build.rs +++ b/build.rs @@ -1,5 +1,6 @@ use anyhow::{format_err, Result}; use std::process::{Command, Output}; +use which::which; fn main() -> Result<()> { // Tell Cargo to rerun this build script if the web app changes @@ -7,6 +8,13 @@ fn main() -> Result<()> { println!("cargo:rerun-if-changed=web/static"); println!("cargo:rerun-if-changed=web/index.html"); + // Check if required external tools are available + if which("yarn").is_err() { + return Err(format_err!( + "yarn not found in PATH (it is required to build the web application)" + )); + } + // Build web application let error = |cmd: &str, output: Output| { Err(format_err!( diff --git a/wix/main.wxs b/wix/main.wxs deleted file mode 100644 index f8a9daf5..00000000 --- a/wix/main.wxs +++ /dev/null @@ -1,215 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -