[WIP] Add support for unstable WebIDL (#1997)

* Re-enable WebGPU WebIDL as experimental

* Add `web_sys_unstable_apis` attribute

* Add test for unstable WebIDL

* Include unstable WebIDL in docs.rs builds

* Add docs and doc comment for unstable APIs

* Add unstable API checks to CI
This commit is contained in:
Josh Groves
2020-02-26 19:00:11 -03:30
committed by GitHub
parent d26068dc6c
commit 99c59a771e
24 changed files with 1387 additions and 792 deletions

View File

@ -11,13 +11,22 @@ fn main() {
let idls = fs::read_dir(".")
.unwrap()
.map(|f| f.unwrap().path())
.filter(|f| f.extension().and_then(|s| s.to_str()) == Some("webidl"))
.map(|f| (fs::read_to_string(&f).unwrap(), f));
.filter(|path| path.extension().and_then(|s| s.to_str()) == Some("webidl"))
.map(|path| {
let unstable = path.file_name().and_then(|s| s.to_str()) == Some("unstable.webidl");
let file = fs::read_to_string(&path).unwrap();
(file, path, unstable)
});
let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
for (i, (idl, path)) in idls.enumerate() {
for (i, (idl, path, unstable)) in idls.enumerate() {
println!("processing {:?}", path);
let mut generated_rust = wasm_bindgen_webidl::compile(&idl, None).unwrap();
let (stable_source, experimental_source) = if unstable {
(String::new(), idl)
} else {
(idl, String::new())
};
let mut generated_rust = wasm_bindgen_webidl::compile(&stable_source, &experimental_source, None).unwrap();
generated_rust.insert_str(
0,