From e49e02cc883bbce1bfdac3634d9641e8cf2ecf98 Mon Sep 17 00:00:00 2001 From: Julius Rakow Date: Sat, 14 Jul 2018 18:04:20 +0200 Subject: [PATCH] web-sys: only try to build webidl files (#474) --- crates/web-sys/build.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/crates/web-sys/build.rs b/crates/web-sys/build.rs index df2b2742..adb29176 100644 --- a/crates/web-sys/build.rs +++ b/crates/web-sys/build.rs @@ -4,6 +4,7 @@ extern crate wasm_bindgen_webidl; use failure::ResultExt; use std::env; +use std::ffi::OsStr; use std::fs; use std::io::Write; use std::path; @@ -28,12 +29,14 @@ fn try_main() -> Result<(), failure::Error> { let mut contents = String::new(); for entry in entries { - let entry = entry.context("getting webidls/enabled/* entry")?; - println!("cargo:rerun-if-changed={}", entry.path().display()); + let entry = entry.context("getting webidls/enabled/*.webidl entry")?; + if entry.path().extension() == Some(OsStr::new("webidl")) { + println!("cargo:rerun-if-changed={}", entry.path().display()); - let this_contents = - fs::read_to_string(entry.path()).context("reading WebIDL file contents")?; - contents.push_str(&this_contents); + let this_contents = + fs::read_to_string(entry.path()).context("reading WebIDL file contents")?; + contents.push_str(&this_contents); + } } let bindings = wasm_bindgen_webidl::compile(&contents)