-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make
zarrs::version::version_{major,minor,patch}
const
- Loading branch information
Showing
3 changed files
with
35 additions
and
12 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
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,24 @@ | ||
#![allow(missing_docs)] | ||
|
||
use std::env; | ||
use std::fs; | ||
use std::io::Write; | ||
use std::path::Path; | ||
|
||
fn main() { | ||
let major_version = env::var("CARGO_PKG_VERSION_MAJOR").unwrap(); | ||
let minor_version = env::var("CARGO_PKG_VERSION_MINOR").unwrap(); | ||
let patch_version = env::var("CARGO_PKG_VERSION_PATCH").unwrap(); | ||
let out_dir = env::var("OUT_DIR").unwrap(); | ||
let dest_path = Path::new(&out_dir).join("version.rs"); | ||
|
||
let mut file = fs::File::create(dest_path).unwrap(); | ||
file.write_fmt(format_args!( | ||
r" | ||
pub(crate) const VERSION_MAJOR: u32 = {major_version}; | ||
pub(crate) const VERSION_MINOR: u32 = {minor_version}; | ||
pub(crate) const VERSION_PATCH: u32 = {patch_version}; | ||
" | ||
)) | ||
.unwrap(); | ||
} |
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