From c9b4b0f6b0de227f4faaedf8e667f572da07329e Mon Sep 17 00:00:00 2001 From: Daria Sukhonina Date: Sat, 23 Sep 2023 01:53:58 +0300 Subject: [PATCH] fix ci --- .github/workflows/build.yml | 2 ++ build.rs | 35 ++++++++++++++++++++++------------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 91ee4a4..24f8736 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -162,6 +162,8 @@ jobs: override: true - name: Run clippy + env: + VITASDK: /opt/vitasdk run: | cargo clippy --tests --workspace -- -Dclippy::all -Dwarnings diff --git a/build.rs b/build.rs index b410758..068557a 100644 --- a/build.rs +++ b/build.rs @@ -12,19 +12,28 @@ fn main() { env_logger::init(); println!("cargo:rerun-if-env-changed=VITASDK"); - let vitasdk = Utf8PathBuf::from(env::var("VITASDK").expect( - "Vitasdk isn't installed or VITASDK environment variable isn't set to a valid unicode", - )); - let sysroot = vitasdk.join("arm-vita-eabi"); - - assert!( - sysroot.exists(), - "VITASDK's sysroot does not exist, please install or update vitasdk first" - ); - - let lib = sysroot.join("lib"); - assert!(lib.exists(), "VITASDK's `lib` directory does not exist"); - println!("cargo:rustc-link-search=native={lib}"); + match env::var("VITASDK") { + Ok(vitasdk) => { + let sysroot = Utf8PathBuf::from(vitasdk).join("arm-vita-eabi"); + + assert!( + sysroot.exists(), + "VITASDK's sysroot does not exist, please install or update vitasdk first" + ); + + let lib = sysroot.join("lib"); + assert!(lib.exists(), "VITASDK's `lib` directory does not exist"); + println!("cargo:rustc-link-search=native={lib}"); + } + Err(env::VarError::NotPresent) => { + if env::var("DOCS_RS").is_err() { + panic!("VITASDK env var is not set") + } + } + Err(env::VarError::NotUnicode(s)) => { + panic!("VITASDK env var is not a valid unicode but got: {s:?}") + } + } let vita_headers_submodule = Utf8Path::new("vita-headers");