Browse Source

Remove unnecessary external dependencies.

The main libcretonne crate should not have any external dependencies if
at all possible. Use simple substring matching instead of regular
expressions in the verifier tests to achieve this.

The tools crate no longer depends directly on glob and regex. It still
has an indirect dependency on regex through libfilecheck.
pull/3/head
Jakob Stoklund Olesen 8 years ago
parent
commit
d2e5059ab9
  1. 5
      src/libcretonne/Cargo.toml
  2. 10
      src/libcretonne/verifier.rs
  3. 10
      src/tools/Cargo.lock
  4. 2
      src/tools/Cargo.toml

5
src/libcretonne/Cargo.toml

@ -13,4 +13,7 @@ name = "cretonne"
path = "lib.rs"
[dependencies]
regex = "0.1.71"
# It is a goal of the cretonne crate to have minimal external dependencies.
# Please don't add any unless they are essential to the task of creating binary
# machine code. Integration tests that need external dependencies can be
# accomodated in src/tools/tests.

10
src/libcretonne/verifier.rs

@ -165,22 +165,18 @@ impl<'a> Verifier<'a> {
#[cfg(test)]
mod tests {
extern crate regex;
use super::*;
use ir::Function;
use ir::instructions::{InstructionData, Opcode};
use ir::types;
use self::regex::Regex;
macro_rules! assert_err_with_msg {
($e:expr, $msg:expr) => (
let err_re = Regex::new($msg).unwrap();
match $e {
Ok(_) => { panic!("Expected an error!") },
Err(Error { location, message } ) => {
if !err_re.is_match(&message) {
panic!(format!("'{}' did not contain the pattern '{}'", message, $msg));
Err(Error { message, .. } ) => {
if !message.contains($msg) {
panic!(format!("'{}' did not contain the substring '{}'", message, $msg));
}
}
}

10
src/tools/Cargo.lock

@ -6,8 +6,6 @@ dependencies = [
"cretonne-reader 0.0.0",
"docopt 0.6.80 (registry+https://github.com/rust-lang/crates.io-index)",
"filecheck 0.0.0",
"glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 0.1.71 (registry+https://github.com/rust-lang/crates.io-index)",
"rustc-serialize 0.3.19 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -22,9 +20,6 @@ dependencies = [
[[package]]
name = "cretonne"
version = "0.0.0"
dependencies = [
"regex 0.1.71 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "cretonne-reader"
@ -50,11 +45,6 @@ dependencies = [
"regex 0.1.71 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "glob"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "kernel32-sys"
version = "0.2.2"

2
src/tools/Cargo.toml

@ -15,5 +15,3 @@ cretonne-reader = { path = "../libreader" }
filecheck = { path = "../libfilecheck" }
docopt = "0.6.80"
rustc-serialize = "0.3.19"
regex = "0.1.71"
glob = "0.2.11"

Loading…
Cancel
Save