mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-15 23:32:46 +00:00
fix(api): resolve build spec path at runtime
This commit is contained in:
parent
87b5144c49
commit
46232503dc
1 changed files with 19 additions and 9 deletions
|
|
@ -1,4 +1,7 @@
|
|||
use std::{env, fs, path::Path};
|
||||
use std::{
|
||||
env, fs,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
use progenitor::{GenerationSettings, Generator, InterfaceStyle};
|
||||
|
||||
|
|
@ -117,15 +120,22 @@ fn patch_codegen_request_body_media_types(value: &mut serde_json::Value) {
|
|||
}
|
||||
}
|
||||
|
||||
fn spec_path_from_manifest_dir(manifest_dir: &Path) -> PathBuf {
|
||||
manifest_dir
|
||||
.parent()
|
||||
.unwrap()
|
||||
.parent()
|
||||
.unwrap()
|
||||
.parent()
|
||||
.unwrap()
|
||||
.join("docs/api-reference/fabro-api.yaml")
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let spec_path = Path::new(env!("CARGO_MANIFEST_DIR"))
|
||||
.parent()
|
||||
.unwrap()
|
||||
.parent()
|
||||
.unwrap()
|
||||
.parent()
|
||||
.unwrap()
|
||||
.join("docs/api-reference/fabro-api.yaml");
|
||||
let manifest_dir = env::var_os("CARGO_MANIFEST_DIR")
|
||||
.map(PathBuf::from)
|
||||
.expect("CARGO_MANIFEST_DIR should be set for build scripts");
|
||||
let spec_path = spec_path_from_manifest_dir(&manifest_dir);
|
||||
|
||||
println!("cargo::rerun-if-changed={}", spec_path.display());
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue