Skip to content

Commit e49e02c

Browse files
Julius Rakowalexcrichton
authored andcommitted
web-sys: only try to build webidl files (#474)
1 parent 696678b commit e49e02c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

crates/web-sys/build.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ extern crate wasm_bindgen_webidl;
44

55
use failure::ResultExt;
66
use std::env;
7+
use std::ffi::OsStr;
78
use std::fs;
89
use std::io::Write;
910
use std::path;
@@ -28,12 +29,14 @@ fn try_main() -> Result<(), failure::Error> {
2829

2930
let mut contents = String::new();
3031
for entry in entries {
31-
let entry = entry.context("getting webidls/enabled/* entry")?;
32-
println!("cargo:rerun-if-changed={}", entry.path().display());
32+
let entry = entry.context("getting webidls/enabled/*.webidl entry")?;
33+
if entry.path().extension() == Some(OsStr::new("webidl")) {
34+
println!("cargo:rerun-if-changed={}", entry.path().display());
3335

34-
let this_contents =
35-
fs::read_to_string(entry.path()).context("reading WebIDL file contents")?;
36-
contents.push_str(&this_contents);
36+
let this_contents =
37+
fs::read_to_string(entry.path()).context("reading WebIDL file contents")?;
38+
contents.push_str(&this_contents);
39+
}
3740
}
3841

3942
let bindings = wasm_bindgen_webidl::compile(&contents)

0 commit comments

Comments
 (0)