From e0db38988af0f606a6aea1999d89b3abf62dae24 Mon Sep 17 00:00:00 2001 From: Melody Horn Date: Tue, 20 Apr 2021 19:30:49 -0600 Subject: skip more things on posix that aren't needed there --- src/makefile/command_line.rs | 12 ++++++++++-- src/makefile/input.rs | 6 +++++- src/makefile/mod.rs | 6 +++++- 3 files changed, 20 insertions(+), 4 deletions(-) (limited to 'src/makefile') diff --git a/src/makefile/command_line.rs b/src/makefile/command_line.rs index 7d4915d..6a45c18 100644 --- a/src/makefile/command_line.rs +++ b/src/makefile/command_line.rs @@ -3,9 +3,12 @@ use std::fmt; use std::process::{Command, ExitStatus}; use eyre::{bail, Error}; +#[cfg(feature = "full")] use lazy_static::lazy_static; +#[cfg(feature = "full")] use regex::Regex; +#[cfg(feature = "full")] use super::r#macro::Set as MacroSet; use super::target::Target; use super::token::{Token, TokenString}; @@ -15,7 +18,7 @@ use super::Makefile; fn execute_command_line( command_line: &str, ignore_errors: bool, - macros: &MacroSet, + #[cfg(feature = "full")] macros: &MacroSet, ) -> Result { let (program, args) = if cfg!(windows) { let cmd = env::var("COMSPEC").unwrap_or_else(|_| "cmd.exe".into()); @@ -147,7 +150,12 @@ impl CommandLine { return Ok(()); } - let return_value = execute_command_line(&execution_line, ignore_error, &file.macros); + let return_value = execute_command_line( + &execution_line, + ignore_error, + #[cfg(feature = "full")] + &file.macros, + ); let errored = return_value.map_or(true, |status| !status.success()); if errored { // apparently there was an error. do we care? diff --git a/src/makefile/input.rs b/src/makefile/input.rs index c2f8e7b..318493b 100644 --- a/src/makefile/input.rs +++ b/src/makefile/input.rs @@ -2,7 +2,9 @@ use std::cell::{Cell, RefCell}; use std::collections::HashMap; use std::error::Error as StdError; use std::fs::File; -use std::io::{BufRead, BufReader, Cursor, Error as IoError, ErrorKind as IoErrorKind, Lines}; +#[cfg(feature = "full")] +use std::io::Cursor; +use std::io::{BufRead, BufReader, Error as IoError, ErrorKind as IoErrorKind, Lines}; use std::iter::Peekable; use std::path::Path; use std::rc::Rc; @@ -961,6 +963,8 @@ pub struct FinishedMakefileReader { mod test { use super::*; + use std::io::Cursor; + type R = Result<()>; #[test] diff --git a/src/makefile/mod.rs b/src/makefile/mod.rs index 277fbd3..74f1f4b 100644 --- a/src/makefile/mod.rs +++ b/src/makefile/mod.rs @@ -31,10 +31,14 @@ mod token; #[derive(Debug, Clone, Eq, PartialEq)] pub enum ItemSource { - File { name: String, line: usize }, + File { + name: String, + line: usize, + }, CommandLineOrMakeflags, Environment, Builtin, + #[cfg(feature = "full")] FunctionCall, } -- cgit v1.2.3