Skip to content

Commit b13c4bd

Browse files
committed
feat(rulegen): add function to generate RuleRunner implementation; (#14549)
1 parent 3bb5a33 commit b13c4bd

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

tasks/rulegen/src/main.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1597,6 +1597,27 @@ fn main() {
15971597
if let Err(err) = add_rules_entry(&context, rule_kind) {
15981598
eprintln!("failed to add {rule_name} to rules file: {err}");
15991599
}
1600+
1601+
if let Err(err) = generate_rule_runner_impl() {
1602+
eprintln!("failed to generate RuleRunner impl for {rule_name}: {err}");
1603+
}
1604+
}
1605+
1606+
fn generate_rule_runner_impl() -> Result<(), Box<dyn std::error::Error>> {
1607+
use std::process::{Command, Stdio};
1608+
1609+
println!("Generating RuleRunner impl...");
1610+
let output = Command::new("cargo")
1611+
.args(["run", "-p", "oxc_linter_codegen"])
1612+
.stdout(Stdio::inherit())
1613+
.stderr(Stdio::inherit())
1614+
.output()?;
1615+
1616+
if !output.status.success() {
1617+
return Err("Failed to run oxc_linter_codegen".into());
1618+
}
1619+
1620+
Ok(())
16001621
}
16011622

16021623
fn get_mod_name(rule_kind: RuleKind) -> String {

0 commit comments

Comments
 (0)