]> git.lizzy.rs Git - connect-rs.git/commitdiff
don't run build.rs if env is not dev
authorSachandhan Ganesh <sachan.ganesh@gmail.com>
Thu, 4 Feb 2021 19:20:55 +0000 (11:20 -0800)
committerSachandhan Ganesh <sachan.ganesh@gmail.com>
Thu, 4 Feb 2021 19:27:06 +0000 (11:27 -0800)
Cargo.toml
build.rs

index 098c4f486726fc804b812b95e529b8b6fe95be89..47d39d5b2ec2c6158750c207a12bd65844be5e3f 100644 (file)
@@ -1,6 +1,6 @@
 [package]
 name = "connect"
-version = "0.0.7"
+version = "0.0.8"
 edition = "2018"
 authors = ["Sachandhan Ganesh <sachan.ganesh@gmail.com>"]
 description = "message queue abstraction over async network streams"
index 79189bb42c33a754417f49e83b3f92f8ca46a6da..31cc875bb97cd53dadd55033cdb7ea1b8598ad9c 100644 (file)
--- a/build.rs
+++ b/build.rs
@@ -1,12 +1,14 @@
-fn main() -> Result<(), Box<dyn std::error::Error>> {
-    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<dyn std::error::Error>> {
+    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(())
 }