Auto merge of #15069 - heycam:bindgen-regex-update, r=emilio

Update geckolib build-time bindgen build script for recent regex changes.

`./mach build-geckolib --with-gecko ...` is broken due to regex's API changing a bit.

r? @Manishearth

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15069)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-01-17 08:13:47 -08:00 committed by GitHub
commit b4980f9037

View file

@ -91,7 +91,7 @@ mod bindings {
added_paths.insert(path); added_paths.insert(path);
// Find all includes and add them recursively // Find all includes and add them recursively
for cap in INCLUDE_RE.captures_iter(&content) { for cap in INCLUDE_RE.captures_iter(&content) {
if let Some(path) = search_include(cap.at(1).unwrap()) { if let Some(path) = search_include(cap.get(1).unwrap().as_str()) {
add_headers_recursively(path, added_paths); add_headers_recursively(path, added_paths);
} }
} }
@ -212,7 +212,8 @@ mod bindings {
} }
let mut result = builder.generate().expect("Unable to generate bindings").to_string(); let mut result = builder.generate().expect("Unable to generate bindings").to_string();
for fixup in fixups.iter() { for fixup in fixups.iter() {
result = Regex::new(&format!(r"\b{}\b", fixup.pat)).unwrap().replace_all(&result, fixup.rep.as_str()); result = Regex::new(&format!(r"\b{}\b", fixup.pat)).unwrap().replace_all(&result, fixup.rep.as_str())
.into_owned().into();
} }
File::create(&out_file).unwrap().write_all(&result.into_bytes()).expect("Unable to write output"); File::create(&out_file).unwrap().write_all(&result.into_bytes()).expect("Unable to write output");
} }