Browse Source

rename cc to cc_wrapper

cl-test
fedor 7 years ago
parent
commit
09117f0d53
  1. 28
      src/lib.rs

28
src/lib.rs

@ -167,8 +167,8 @@ impl From<io::Error> for Error {
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct Tool { pub struct Tool {
path: PathBuf, path: PathBuf,
cc_path: Option<PathBuf>, cc_wrapper_path: Option<PathBuf>,
cc_args: Vec<OsString>, cc_wrapper_args: Vec<OsString>,
args: Vec<OsString>, args: Vec<OsString>,
env: Vec<(OsString, OsString)>, env: Vec<(OsString, OsString)>,
family: ToolFamily, family: ToolFamily,
@ -1373,10 +1373,10 @@ impl Build {
.map(|(tool, cc, args)| { .map(|(tool, cc, args)| {
let mut t = Tool::new(PathBuf::from(tool)); let mut t = Tool::new(PathBuf::from(tool));
if let Some(cc) = cc { if let Some(cc) = cc {
t.cc_path = Some(PathBuf::from(cc)); t.cc_wrapper_path = Some(PathBuf::from(cc));
} }
for arg in args { for arg in args {
t.cc_args.push(arg.into()); t.cc_wrapper_args.push(arg.into());
} }
t t
}) })
@ -1645,8 +1645,8 @@ impl Tool {
}; };
Tool { Tool {
path: path, path: path,
cc_path: None, cc_wrapper_path: None,
cc_args: Vec::new(), cc_wrapper_args: Vec::new(),
args: Vec::new(), args: Vec::new(),
env: Vec::new(), env: Vec::new(),
family: family, family: family,
@ -1659,11 +1659,11 @@ impl Tool {
/// command returned will already have the initial arguments and environment /// command returned will already have the initial arguments and environment
/// variables configured. /// variables configured.
pub fn to_command(&self) -> Command { pub fn to_command(&self) -> Command {
let mut cmd = match self.cc_path { let mut cmd = match self.cc_wrapper_path {
Some(ref cc_path) => { Some(ref cc_wrapper_path) => {
let mut cmd = Command::new(&cc_path); let mut cmd = Command::new(&cc_wrapper_path);
cmd.arg(&self.path); cmd.arg(&self.path);
cmd.args(&self.cc_args); cmd.args(&self.cc_wrapper_args);
cmd cmd
}, },
None => Command::new(&self.path) None => Command::new(&self.path)
@ -1702,12 +1702,12 @@ impl Tool {
/// ///
/// This is typically used by configure script /// This is typically used by configure script
pub fn cc_env(&self) -> OsString { pub fn cc_env(&self) -> OsString {
match self.cc_path { match self.cc_wrapper_path {
Some(ref cc_path) => { Some(ref cc_wrapper_path) => {
let mut cc_env = cc_path.as_os_str().to_owned(); let mut cc_env = cc_wrapper_path.as_os_str().to_owned();
cc_env.push(" "); cc_env.push(" ");
cc_env.push(self.path.to_path_buf().into_os_string()); cc_env.push(self.path.to_path_buf().into_os_string());
for arg in self.cc_args.iter() { for arg in self.cc_wrapper_args.iter() {
cc_env.push(" "); cc_env.push(" ");
cc_env.push(arg); cc_env.push(arg);
} }

Loading…
Cancel
Save