From 2307e8b746bf5984c0adc03c3fe22d95baaf0c92 Mon Sep 17 00:00:00 2001 From: Sachandhan Ganesh Date: Thu, 4 Feb 2021 11:20:55 -0800 Subject: [PATCH] don't run build.rs if env is dev --- Cargo.toml | 2 +- build.rs | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) 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(()) } -- 2.44.0