Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

insert LIB and INCLUDE #1118

Merged
merged 2 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/script.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@
@chcp 65001 > nul
@echo on
IF "%CONDA_BUILD%" == "" (
@rem special behavior from conda-build for Windows
call ((script_path))
)
@rem re-enable echo because the activation scripts might have messed with it
Expand All @@ -373,7 +374,16 @@

let build_script = format!(
"{}\n{}",
CMDEXE_PREAMBLE.replace("((script_path))", &build_env_path.to_string_lossy()),
CMDEXE_PREAMBLE
.replace("((script_path))", &build_env_path.to_string_lossy())
.replace(
"((LIBRARY_INC))",
&args.env_vars.get("LIBRARY_INC").unwrap_or(&"".to_string())

Check failure on line 381 in src/script.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

[clippy] reported by reviewdog 🐶 error: this expression creates a reference which is immediately dereferenced by the compiler --> src/script.rs:381:21 | 381 | &args.env_vars.get("LIBRARY_INC").unwrap_or(&"".to_string()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `args.env_vars.get("LIBRARY_INC").unwrap_or(&"".to_string())` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow = note: `-D clippy::needless-borrow` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_borrow)]` Raw Output: src/script.rs:381:21:e:error: this expression creates a reference which is immediately dereferenced by the compiler --> src/script.rs:381:21 | 381 | &args.env_vars.get("LIBRARY_INC").unwrap_or(&"".to_string()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `args.env_vars.get("LIBRARY_INC").unwrap_or(&"".to_string())` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow = note: `-D clippy::needless-borrow` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_borrow)]` __END__

Check failure on line 381 in src/script.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

[clippy] reported by reviewdog 🐶 error: this expression creates a reference which is immediately dereferenced by the compiler --> src/script.rs:381:21 | 381 | &args.env_vars.get("LIBRARY_INC").unwrap_or(&"".to_string()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `args.env_vars.get("LIBRARY_INC").unwrap_or(&"".to_string())` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow = note: `-D clippy::needless-borrow` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_borrow)]` Raw Output: src/script.rs:381:21:e:error: this expression creates a reference which is immediately dereferenced by the compiler --> src/script.rs:381:21 | 381 | &args.env_vars.get("LIBRARY_INC").unwrap_or(&"".to_string()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `args.env_vars.get("LIBRARY_INC").unwrap_or(&"".to_string())` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow = note: `-D clippy::needless-borrow` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_borrow)]` __END__

Check failure on line 381 in src/script.rs

View workflow job for this annotation

GitHub Actions / test (macos-latest)

[clippy] reported by reviewdog 🐶 error: this expression creates a reference which is immediately dereferenced by the compiler --> src/script.rs:381:21 | 381 | &args.env_vars.get("LIBRARY_INC").unwrap_or(&"".to_string()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `args.env_vars.get("LIBRARY_INC").unwrap_or(&"".to_string())` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow = note: `-D clippy::needless-borrow` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_borrow)]` Raw Output: src/script.rs:381:21:e:error: this expression creates a reference which is immediately dereferenced by the compiler --> src/script.rs:381:21 | 381 | &args.env_vars.get("LIBRARY_INC").unwrap_or(&"".to_string()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `args.env_vars.get("LIBRARY_INC").unwrap_or(&"".to_string())` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow = note: `-D clippy::needless-borrow` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_borrow)]` __END__

Check failure on line 381 in src/script.rs

View workflow job for this annotation

GitHub Actions / test (macos-latest)

[clippy] reported by reviewdog 🐶 error: this expression creates a reference which is immediately dereferenced by the compiler --> src/script.rs:381:21 | 381 | &args.env_vars.get("LIBRARY_INC").unwrap_or(&"".to_string()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `args.env_vars.get("LIBRARY_INC").unwrap_or(&"".to_string())` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow = note: `-D clippy::needless-borrow` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_borrow)]` Raw Output: src/script.rs:381:21:e:error: this expression creates a reference which is immediately dereferenced by the compiler --> src/script.rs:381:21 | 381 | &args.env_vars.get("LIBRARY_INC").unwrap_or(&"".to_string()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `args.env_vars.get("LIBRARY_INC").unwrap_or(&"".to_string())` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow = note: `-D clippy::needless-borrow` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::needless_borrow)]` __END__
)
.replace(
"((LIBRARY_LIB))",
&args.env_vars.get("LIBRARY_LIB").unwrap_or(&"".to_string())

Check failure on line 385 in src/script.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

[clippy] reported by reviewdog 🐶 error: this expression creates a reference which is immediately dereferenced by the compiler --> src/script.rs:385:21 | 385 | &args.env_vars.get("LIBRARY_LIB").unwrap_or(&"".to_string()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `args.env_vars.get("LIBRARY_LIB").unwrap_or(&"".to_string())` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow Raw Output: src/script.rs:385:21:e:error: this expression creates a reference which is immediately dereferenced by the compiler --> src/script.rs:385:21 | 385 | &args.env_vars.get("LIBRARY_LIB").unwrap_or(&"".to_string()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `args.env_vars.get("LIBRARY_LIB").unwrap_or(&"".to_string())` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow __END__

Check failure on line 385 in src/script.rs

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

[clippy] reported by reviewdog 🐶 error: this expression creates a reference which is immediately dereferenced by the compiler --> src/script.rs:385:21 | 385 | &args.env_vars.get("LIBRARY_LIB").unwrap_or(&"".to_string()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `args.env_vars.get("LIBRARY_LIB").unwrap_or(&"".to_string())` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow Raw Output: src/script.rs:385:21:e:error: this expression creates a reference which is immediately dereferenced by the compiler --> src/script.rs:385:21 | 385 | &args.env_vars.get("LIBRARY_LIB").unwrap_or(&"".to_string()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `args.env_vars.get("LIBRARY_LIB").unwrap_or(&"".to_string())` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow __END__

Check failure on line 385 in src/script.rs

View workflow job for this annotation

GitHub Actions / test (macos-latest)

[clippy] reported by reviewdog 🐶 error: this expression creates a reference which is immediately dereferenced by the compiler --> src/script.rs:385:21 | 385 | &args.env_vars.get("LIBRARY_LIB").unwrap_or(&"".to_string()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `args.env_vars.get("LIBRARY_LIB").unwrap_or(&"".to_string())` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow Raw Output: src/script.rs:385:21:e:error: this expression creates a reference which is immediately dereferenced by the compiler --> src/script.rs:385:21 | 385 | &args.env_vars.get("LIBRARY_LIB").unwrap_or(&"".to_string()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `args.env_vars.get("LIBRARY_LIB").unwrap_or(&"".to_string())` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow __END__

Check failure on line 385 in src/script.rs

View workflow job for this annotation

GitHub Actions / test (macos-latest)

[clippy] reported by reviewdog 🐶 error: this expression creates a reference which is immediately dereferenced by the compiler --> src/script.rs:385:21 | 385 | &args.env_vars.get("LIBRARY_LIB").unwrap_or(&"".to_string()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `args.env_vars.get("LIBRARY_LIB").unwrap_or(&"".to_string())` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow Raw Output: src/script.rs:385:21:e:error: this expression creates a reference which is immediately dereferenced by the compiler --> src/script.rs:385:21 | 385 | &args.env_vars.get("LIBRARY_LIB").unwrap_or(&"".to_string()) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: change this to: `args.env_vars.get("LIBRARY_LIB").unwrap_or(&"".to_string())` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow __END__
),
args.script.script()
);
tokio::fs::write(
Expand Down
26 changes: 21 additions & 5 deletions src/windows/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,39 @@ pub fn default_env_vars(
let mut vars = HashMap::<String, Option<String>>::new();
vars.insert(
"SCRIPTS".to_string(),
Some(prefix.join("Scripts").to_string_lossy().to_string()),
Some(prefix.join("Scripts").display().to_string()),
);
vars.insert(
"LIBRARY_PREFIX".to_string(),
Some(library_prefix.to_string_lossy().to_string()),
Some(library_prefix.display().to_string()),
);
vars.insert(
"LIBRARY_BIN".to_string(),
Some(library_prefix.join("bin").to_string_lossy().to_string()),
Some(library_prefix.join("bin").display().to_string()),
);
let library_lib = library_prefix.join("lib");
let library_inc = library_prefix.join("include");
vars.insert(
"LIBRARY_INC".to_string(),
Some(library_prefix.join("include").to_string_lossy().to_string()),
Some(library_inc.display().to_string()),
);
vars.insert(
"LIBRARY_LIB".to_string(),
Some(library_prefix.join("lib").to_string_lossy().to_string()),
Some(library_lib.display().to_string()),
);

// This adds the LIB and INCLUDE vars. It would not be entirely correct if someone
// overwrites the LIBRARY_LIB or LIBRARY_INCLUDE variables from the variants.yaml
// but I think for now this is fine.
let lib_var = std::env::var("LIB").ok().unwrap_or_default();
let include_var = std::env::var("INCLUDE").ok().unwrap_or_default();
vars.insert(
"LIB".to_string(),
Some(format!("{};{}", library_lib.display(), lib_var)),
);
vars.insert(
"INCLUDE".to_string(),
Some(format!("{};{}", library_inc.display(), include_var)),
);

let default_vars = vec![
Expand Down
Loading