Skip to content

Commit 22c8ed9

Browse files
committed
Always use lalrpop cargo dependency instead of command
1 parent d121f5e commit 22c8ed9

1 file changed

Lines changed: 3 additions & 27 deletions

File tree

parser/build.rs

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -71,38 +71,14 @@ fn try_lalrpop(source: &str, target: &str) -> anyhow::Result<()> {
7171
}
7272

7373
#[cfg(feature = "lalrpop")]
74-
lalrpop_dependency();
74+
lalrpop::process_root().expect("running lalrpop failed");
75+
7576
#[cfg(not(feature = "lalrpop"))]
76-
lalrpop_command(source)?;
77+
eprintln!("try: cargo build --manifest-path=parser/Cargo.toml --features=lalrpop");
7778

7879
Ok(())
7980
}
8081

81-
#[cfg(not(feature = "lalrpop"))]
82-
fn lalrpop_command(source: &str) -> anyhow::Result<()> {
83-
match std::process::Command::new("lalrpop").arg(source).status() {
84-
Ok(stat) if stat.success() => Ok(()),
85-
Ok(stat) => {
86-
eprintln!("failed to execute lalrpop; exited with {stat}");
87-
let exit_code = stat.code().map(|v| (v % 256) as u8).unwrap_or(1);
88-
Err(anyhow::anyhow!("lalrpop error status: {}", exit_code))
89-
}
90-
Err(e) if e.kind() == std::io::ErrorKind::NotFound => {
91-
eprintln!("please install lalrpop with `cargo install lalrpop` or\n`cargo build --manifest-path=parser/Cargo.toml --features=lalrpop`");
92-
Err(anyhow::anyhow!(
93-
"the lalrpop executable is not installed and parser/{} has been changed",
94-
source
95-
))
96-
}
97-
Err(e) => Err(anyhow::Error::new(e)),
98-
}
99-
}
100-
101-
#[cfg(feature = "lalrpop")]
102-
fn lalrpop_dependency() {
103-
lalrpop::process_root().unwrap()
104-
}
105-
10682
fn sha_equal(expected_sha3_str: &str, actual_sha3: &[u8; 32]) -> bool {
10783
if expected_sha3_str.len() != 64 {
10884
panic!("lalrpop version? hash bug is fixed in 0.19.8");

0 commit comments

Comments
 (0)