Skip to content

Commit 195be87

Browse files
committed
Split bindgen binary into new sub-crate
- 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
1 parent 82bb363 commit 195be87

File tree

5 files changed

+27
-29
lines changed

5 files changed

+27
-29
lines changed

Cargo.toml

-11
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ readme = "README.md"
1414
repository = "https://github.com/servo/rust-bindgen"
1515
version = "0.17.0"
1616

17-
[[bin]]
18-
doc = false
19-
name = "bindgen"
20-
2117
[build-dependencies]
2218
quasi_codegen = "0.20"
2319

@@ -57,10 +53,3 @@ llvm_stable = []
5753
static = []
5854
# This feature only exists for CI -- don't use it!
5955
_docs = []
60-
61-
[lib]
62-
name = "bindgen"
63-
path = "src/lib.rs"
64-
65-
[[test]]
66-
name = "tests"

bindgen_bin/Cargo.toml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
[package]
2+
authors = [
3+
"Jyun-Yan You <[email protected]>",
4+
"Emilio Cobos Álvarez <[email protected]>",
5+
"The Servo project developers",
6+
]
7+
description = "A binding generator for Rust"
8+
homepage = "https://github.com/servo/rust-bindgen"
9+
keywords = ["bindings", "ffi", "code-generation"]
10+
license = "BSD-3-Clause"
11+
name = "bindgen_bin"
12+
readme = "README.md"
13+
repository = "https://github.com/servo/rust-bindgen"
14+
version = "0.17.0"
15+
16+
[[bin]]
17+
name = "bindgen"
18+
19+
[dependencies]
20+
bindgen = { path = "../" }
21+
clang-sys = "0.8.0"
22+
23+
[features]
24+
llvm_stable = ["bindgen/llvm_stable"]

src/bin/bindgen.rs renamed to bindgen_bin/src/main.rs

+3-18
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
1-
#![crate_name = "bindgen"]
2-
#![crate_type = "bin"]
3-
41
extern crate bindgen;
5-
extern crate env_logger;
6-
#[macro_use]
7-
extern crate log;
82
extern crate clang_sys;
9-
extern crate rustc_serialize;
103

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

224217
pub fn main() {
225-
log::set_logger(|max_log_level| {
226-
use env_logger::Logger;
227-
let env_logger = Logger::new();
228-
max_log_level.set(env_logger.filter());
229-
Box::new(env_logger)
230-
})
231-
.expect("Failed to set logger.");
232-
233218
let mut bind_args: Vec<_> = env::args().collect();
234219

235220
let version = clang_version();
@@ -239,12 +224,12 @@ pub fn main() {
239224
(3, 9)
240225
};
241226

242-
info!("Clang Version: {}", version.full);
227+
println!("Clang Version: {}", version.full);
243228

244229
match version.parsed {
245-
None => warn!("Couldn't parse libclang version"),
230+
None => println!("Couldn't parse libclang version"),
246231
Some(version) if version != expected_version => {
247-
error!("Using clang {:?}, expected {:?}",
232+
println!("Using clang {:?}, expected {:?}",
248233
version,
249234
expected_version);
250235
}
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)