mirror of
https://github.com/zerotier/zerotier-rust-api.git
synced 2026-05-22 16:26:25 -07:00
fix: Build scripts were broken, this fixes them on new progenitor version
This commit is contained in:
@@ -1,13 +1,16 @@
|
||||
use std::{path::PathBuf, str::FromStr};
|
||||
|
||||
fn main() {
|
||||
let src = PathBuf::from_str("openapi.json").unwrap();
|
||||
let src = "openapi.json";
|
||||
println!("cargo:rerun-if-changed={}", src);
|
||||
let file = std::fs::File::open(src).unwrap();
|
||||
let spec = serde_json::from_reader(file).unwrap();
|
||||
let mut generator = progenitor::Generator::default();
|
||||
|
||||
let content = generator.generate_text(&spec).unwrap();
|
||||
let tokens = generator.generate_tokens(&spec).unwrap();
|
||||
let ast = syn::parse2(tokens).unwrap();
|
||||
let content = prettyplease::unparse(&ast);
|
||||
|
||||
let out_file = std::path::Path::new(&std::env::var("OUT_DIR").unwrap()).to_path_buf();
|
||||
std::fs::write(out_file.join("codegen.rs"), content).unwrap();
|
||||
let mut out_file = std::path::Path::new(&std::env::var("OUT_DIR").unwrap()).to_path_buf();
|
||||
out_file.push("codegen.rs");
|
||||
|
||||
std::fs::write(out_file, content).unwrap();
|
||||
}
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
use std::{path::PathBuf, str::FromStr};
|
||||
|
||||
fn main() {
|
||||
let src = PathBuf::from_str("openapi.json").unwrap();
|
||||
let src = "openapi.json";
|
||||
println!("cargo:rerun-if-changed={}", src);
|
||||
let file = std::fs::File::open(src).unwrap();
|
||||
let spec = serde_json::from_reader(file).unwrap();
|
||||
let mut generator = progenitor::Generator::default();
|
||||
|
||||
let content = generator.generate_text(&spec).unwrap();
|
||||
let tokens = generator.generate_tokens(&spec).unwrap();
|
||||
let ast = syn::parse2(tokens).unwrap();
|
||||
let content = prettyplease::unparse(&ast);
|
||||
|
||||
let out_file = std::path::Path::new(&std::env::var("OUT_DIR").unwrap()).to_path_buf();
|
||||
std::fs::write(out_file.join("codegen.rs"), content).unwrap();
|
||||
let mut out_file = std::path::Path::new(&std::env::var("OUT_DIR").unwrap()).to_path_buf();
|
||||
out_file.push("codegen.rs");
|
||||
|
||||
std::fs::write(out_file, content).unwrap();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user