mirror of
https://github.com/swc-project/swc.git
synced 2024-12-19 03:31:45 +03:00
6f19f8902f
**Description:** Another update to enable bytecheck rkyv feature flag. Our dep tree is quite tangled with implicit enable (plugin -> rkyv). PR tries to detach some of it while trying to preserve existing behavior as much as it can.
20 lines
614 B
Rust
20 lines
614 B
Rust
use std::{env, path::Path};
|
|
|
|
#[cfg(all(feature = "rkyv-impl", feature = "rkyv-bytecheck-impl"))]
|
|
compile_error!("Cannot enable bytechcked, non-bytechecked rkyv both");
|
|
|
|
fn main() {
|
|
let strs = include_str!("words.txt")
|
|
.lines()
|
|
.map(|l| l.trim())
|
|
.collect::<Vec<_>>();
|
|
gen("js_word", "JsWord", &strs);
|
|
}
|
|
|
|
fn gen(mac_name: &str, type_name: &str, atoms: &[&str]) {
|
|
string_cache_codegen::AtomType::new(type_name, &format!("{}!", mac_name))
|
|
.atoms(atoms)
|
|
.write_to_file(&Path::new(&env::var("OUT_DIR").unwrap()).join(format!("{}.rs", mac_name)))
|
|
.unwrap();
|
|
}
|