Skip to content

Commit

Permalink
chore: Write lalrpop files to OUT_DIR instead of the source tree
Browse files Browse the repository at this point in the history
Should let gluon be ran under cargobomb rust-lang/crater#157 but I think that regardless of that it is better to generate files outside of the source tree
  • Loading branch information
Marwes committed Nov 27, 2017
1 parent ed7d83d commit fd7ff46
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 8 deletions.
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,3 @@

target
Cargo.lock

parser/src/grammar.rs
vm/src/core/grammar.rs
7 changes: 5 additions & 2 deletions parser/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ extern crate lalrpop;
fn main() {
::std::env::set_var("LALRPOP_LANE_TABLE", "disabled");

lalrpop::Configuration::new().process_current_dir().unwrap();
println!("cargo:rerun-if-changed=src/grammar.lalrpop");
lalrpop::Configuration::new()
.use_cargo_dir_conventions()
.process_file("src/grammar.lalrpop")
.unwrap();
println!("cargo:rerun-if-changed=grammar.lalrpop");
}
1 change: 1 addition & 0 deletions parser/src/grammar.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include!(concat!(env!("OUT_DIR"), "/grammar.rs"));
10 changes: 7 additions & 3 deletions vm/build.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@

#[cfg(feature = "test")]
mod build {
extern crate lalrpop;

pub fn main() {
lalrpop::Configuration::new().process_current_dir().unwrap();
println!("cargo:rerun-if-changed=src/core/grammar.lalrpop");
lalrpop::Configuration::new()
.use_cargo_dir_conventions()
.process_file("src/core/grammar.lalrpop")
.unwrap();

println!("cargo:rerun-if-changed=core/grammar.lalrpop");
}
}

Expand Down
1 change: 1 addition & 0 deletions vm/src/core/grammar.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include!(concat!(env!("OUT_DIR"), "/core/grammar.rs"));

0 comments on commit fd7ff46

Please sign in to comment.