Initial commit

This commit is contained in:
Marc Plano-Lesay 2024-10-23 20:36:36 +11:00
commit 56a22203ef
Signed by: kernald
GPG key ID: 66A41B08CC62A6CF
9 changed files with 14675 additions and 0 deletions

22
build.rs Normal file
View file

@ -0,0 +1,22 @@
use std::{
env,
fs::{self, File},
path::Path,
};
fn main() {
let src = "./src/immich-openapi-specs.json";
println!("cargo:rerun-if-changed={}", src);
let file = File::open(src).unwrap();
let spec = serde_json::from_reader(file).unwrap();
let mut generator = progenitor::Generator::default();
let tokens = generator.generate_tokens(&spec).unwrap();
let ast = syn::parse2(tokens).unwrap();
let content = prettyplease::unparse(&ast);
let mut out_file = Path::new(&env::var("OUT_DIR").unwrap()).to_path_buf();
out_file.push("codegen.rs");
fs::write(out_file, content).unwrap();
}