From f1994c8690baa7f718f3fc5a351c8c6c9661e156 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bastian=20K=C3=B6cher?= <git@kchr.de>
Date: Wed, 13 Sep 2023 21:53:05 +0200
Subject: [PATCH] wasm-builder: Disable building when running on docs.rs
 (#1540)

This pull request changes the `wasm-builder` to skip building the wasm
files when the build process is running on docs.rs.
---
 substrate/utils/wasm-builder/src/builder.rs | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/substrate/utils/wasm-builder/src/builder.rs b/substrate/utils/wasm-builder/src/builder.rs
index 208b5607766..e0a30644b23 100644
--- a/substrate/utils/wasm-builder/src/builder.rs
+++ b/substrate/utils/wasm-builder/src/builder.rs
@@ -203,7 +203,10 @@ fn generate_crate_skip_build_env_name() -> String {
 /// Checks if the build of the WASM binary should be skipped.
 fn check_skip_build() -> bool {
 	env::var(crate::SKIP_BUILD_ENV).is_ok() ||
-		env::var(generate_crate_skip_build_env_name()).is_ok()
+		env::var(generate_crate_skip_build_env_name()).is_ok() ||
+		// If we are running in docs.rs, let's skip building.
+		// https://docs.rs/about/builds#detecting-docsrs
+		env::var("DOCS_RS").is_ok()
 }
 
 /// Provide a dummy WASM binary if there doesn't exist one.
-- 
GitLab