forked from hbina/apple-bloom
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 911703a
Showing
8 changed files
with
39,039 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
target | ||
Cargo.lock | ||
*.bk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[package] | ||
name = "openapi" | ||
version = "0.1.0" | ||
authors = ["softprops <[email protected]>"] | ||
build = "build.rs" | ||
|
||
[build-dependencies] | ||
serde_codegen = "0.8" | ||
glob = "0.2.11" | ||
|
||
[dependencies] | ||
serde = "0.8" | ||
serde_json = "0.8" | ||
serde_yaml = "0.5" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
extern crate glob; | ||
extern crate serde_codegen; | ||
|
||
use std::env; | ||
use std::path::Path; | ||
use std::fs; | ||
|
||
fn main() { | ||
// Don't re-run this script unless one of the inputs has changed. | ||
for entry in glob::glob("src/**/*.rs.in").expect("Failed to read glob pattern") { | ||
println!("cargo:rerun-if-changed={}", entry.unwrap().display()); | ||
} | ||
|
||
let out_dir = env::var_os("OUT_DIR").unwrap(); | ||
|
||
// Switch to our `src` directory so that we have the right base for our | ||
// globs, and so that we won't need to strip `src/` off every path. | ||
env::set_current_dir("src").unwrap(); | ||
|
||
for entry in glob::glob("**/*.rs.in").expect("Failed to read glob pattern") { | ||
match entry { | ||
Ok(src) => { | ||
let mut dst = Path::new(&out_dir).join(&src); | ||
|
||
// Change ".rs.in" to ".rs". | ||
dst.set_file_name(src.file_stem().expect("Failed to get file stem")); | ||
dst.set_extension("rs"); | ||
|
||
// Make sure our target directory exists. We only need | ||
// this if there are extra nested sudirectories under src/. | ||
fs::create_dir_all(dst.parent().unwrap()).unwrap(); | ||
|
||
// Process our source file. | ||
serde_codegen::expand(&src, &dst).unwrap(); | ||
} | ||
Err(e) => { | ||
panic!("Error globbing: {}", e); | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.