Skip to content

Commit

Permalink
Place generated files in $OUT_DIR
Browse files Browse the repository at this point in the history
This prevents generated files from ending up in the source directory
where they may be accidentally packaged or vendored.
  • Loading branch information
mbrubeck committed Mar 14, 2018
1 parent bbc17f3 commit d9695b2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Expand Up @@ -10,7 +10,7 @@ name = "webidl"
readme = "README.md"
repository = "https://github.com/sgodwincs/webidl-rs"
version = "0.5.0"
exclude = ["tests/*.zip", "src/parser/grammar.rs"]
exclude = ["tests/*.zip"]

[build-dependencies]
lalrpop = "^0.14"
Expand Down
5 changes: 4 additions & 1 deletion build.rs
Expand Up @@ -2,5 +2,8 @@ extern crate lalrpop;

fn main() {
println!("cargo:rerun-if-changed=src/parser/grammar.lalrpop");
lalrpop::process_root().unwrap();
lalrpop::Configuration::new()
.use_cargo_dir_conventions()
.process()
.unwrap();
}
4 changes: 3 additions & 1 deletion src/parser/mod.rs
@@ -1,7 +1,9 @@
#[cfg_attr(rustfmt, rustfmt_skip)]
#[allow(unknown_lints)]
#[allow(clippy)]
mod grammar;
mod grammar {
include!(concat!(env!("OUT_DIR"), "/parser/grammar.rs"));
}

/// Contains all structures related to the AST for the WebIDL grammar.
pub mod ast;
Expand Down

0 comments on commit d9695b2

Please sign in to comment.