From: Sachandhan Ganesh Date: Thu, 4 Feb 2021 19:20:55 +0000 (-0800) Subject: don't run build.rs if env is not dev X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=59cf4d9bf6af711484e82e238e2a76f8d2337fb1;p=connect-rs.git don't run build.rs if env is not dev --- diff --git a/Cargo.toml b/Cargo.toml index 098c4f4..47d39d5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "connect" -version = "0.0.7" +version = "0.0.8" edition = "2018" authors = ["Sachandhan Ganesh "] description = "message queue abstraction over async network streams" diff --git a/build.rs b/build.rs index 79189bb..31cc875 100644 --- a/build.rs +++ b/build.rs @@ -1,12 +1,14 @@ -fn main() -> Result<(), Box> { - protobuf_codegen_pure::Codegen::new() - .out_dir("src/schema") - .inputs(&["schema/message.proto"]) - .include("schema") - .run() - .expect("Codegen failed."); +use std::env; - println!("cargo:rerun-if-changed=build.rs"); +fn main() -> Result<(), Box> { + if Ok("dev".to_owned()) == env::var("PROFILE") { + protobuf_codegen_pure::Codegen::new() + .out_dir("src/schema") + .inputs(&["schema/message.proto"]) + .include("schema") + .run() + .expect("Codegen failed."); + } Ok(()) }