Skip to content

Commit

Permalink
Merge pull request #43 from bnjjj/master
Browse files Browse the repository at this point in the history
feat(CargoBuild): add env method to add environment variable to the cargo cmd
  • Loading branch information
epage committed Mar 25, 2021
2 parents 61b1da7 + 74ff4b3 commit 9b6964d
Showing 1 changed file with 12 additions and 1 deletion.
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

0 comments on commit 9b6964d

Please sign in to comment.