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

feat(CargoBuild): add env method to add environment variable to the cargo cmd #43

Merged
merged 1 commit into from Mar 25, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/build.rs
@@ -1,4 +1,4 @@
use std::ffi;
use std::ffi::{self, OsStr};
use std::process;

use crate::cargo::Cargo;
Expand Down Expand Up @@ -177,6 +177,17 @@ impl CargoBuild {
self.arg("--release")
}

/// Inserts or updates an environment variable mapping.
pub fn env<K, V>(mut self, key: K, val: V) -> Self
where
K: AsRef<OsStr>,
V: AsRef<OsStr>,
{
self.cmd.env(key, val);

self
}

/// Build artifacts in release mode if the current process has, with optimizations.
#[cfg(debug_assertions)]
pub fn current_release(self) -> Self {
Expand Down