Skip to content

Commit

Permalink
Split bindgen binary into new sub-crate
Browse files Browse the repository at this point in the history
- Removed most direct dependencies, with clang-sys still to go
- Moved binary-focused tests into sub-crate, but don't expect them to
work yet
  • Loading branch information
jdub committed Nov 4, 2016
1 parent 82bb363 commit 195be87
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 29 deletions.
11 changes: 0 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ readme = "README.md"
repository = "https://github.com/servo/rust-bindgen"
version = "0.17.0"

[[bin]]
doc = false
name = "bindgen"

[build-dependencies]
quasi_codegen = "0.20"

Expand Down Expand Up @@ -57,10 +53,3 @@ llvm_stable = []
static = []
# This feature only exists for CI -- don't use it!
_docs = []

[lib]
name = "bindgen"
path = "src/lib.rs"

[[test]]
name = "tests"
24 changes: 24 additions & 0 deletions bindgen_bin/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[package]
authors = [
"Jyun-Yan You <jyyou.tw@gmail.com>",
"Emilio Cobos Álvarez <ecoal95@gmail.com>",
"The Servo project developers",
]
description = "A binding generator for Rust"
homepage = "https://github.com/servo/rust-bindgen"
keywords = ["bindings", "ffi", "code-generation"]
license = "BSD-3-Clause"
name = "bindgen_bin"
readme = "README.md"
repository = "https://github.com/servo/rust-bindgen"
version = "0.17.0"

[[bin]]
name = "bindgen"

[dependencies]
bindgen = { path = "../" }
clang-sys = "0.8.0"

[features]
llvm_stable = ["bindgen/llvm_stable"]
21 changes: 3 additions & 18 deletions src/bin/bindgen.rs → bindgen_bin/src/main.rs
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
#![crate_name = "bindgen"]
#![crate_type = "bin"]

extern crate bindgen;
extern crate env_logger;
#[macro_use]
extern crate log;
extern crate clang_sys;
extern crate rustc_serialize;

use bindgen::{BindgenOptions, Bindings, ClangVersion, LinkType, clang_version};
use std::default::Default;
Expand Down Expand Up @@ -222,14 +215,6 @@ fn parse_args_or_exit(args: Vec<String>) -> (BindgenOptions, Box<io::Write>) {
}

pub fn main() {
log::set_logger(|max_log_level| {
use env_logger::Logger;
let env_logger = Logger::new();
max_log_level.set(env_logger.filter());
Box::new(env_logger)
})
.expect("Failed to set logger.");

let mut bind_args: Vec<_> = env::args().collect();

let version = clang_version();
Expand All @@ -239,12 +224,12 @@ pub fn main() {
(3, 9)
};

info!("Clang Version: {}", version.full);
println!("Clang Version: {}", version.full);

match version.parsed {
None => warn!("Couldn't parse libclang version"),
None => println!("Couldn't parse libclang version"),
Some(version) if version != expected_version => {
error!("Using clang {:?}, expected {:?}",
println!("Using clang {:?}, expected {:?}",
version,
expected_version);
}
Expand Down
File renamed without changes.
File renamed without changes.

0 comments on commit 195be87

Please sign in to comment.