From decc7341fdb57bb3716c2ebeaabd5e1ecb00242a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com>
Date: Sun, 19 Feb 2023 17:51:37 +0000
Subject: [PATCH] fix: build.rs mocking support Should fix automation of
 format.

---
 .gitignore      |  2 +-
 build.rs        |  4 ++--
 src/gen/mock.rs | 11 +++++++++++
 src/gen/mod.rs  | 12 ++++++++++++
 4 files changed, 26 insertions(+), 3 deletions(-)
 create mode 100644 src/gen/mock.rs
 create mode 100644 src/gen/mod.rs

diff --git a/.gitignore b/.gitignore
index e0b05f96..6c7bc2d1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,4 +8,4 @@ Cargo.lock
 /res/roms.prop
 /frontends/*/target
 
-/src/gen.rs
+/src/gen/build.rs
diff --git a/build.rs b/build.rs
index 67bcc467..341df2ef 100644
--- a/build.rs
+++ b/build.rs
@@ -29,8 +29,8 @@ use std::path::Path;
 use std::process::Command;
 use std::str;
 
-const BUILD_OUT_FILE: &str = "gen.rs";
-const SOURCE_DIR: &str = "./src";
+const BUILD_OUT_FILE: &str = "build.rs";
+const SOURCE_DIR: &str = "./src/gen";
 
 fn main() {
     // in case we're running under docs.rs then we must return the control
diff --git a/src/gen/mock.rs b/src/gen/mock.rs
new file mode 100644
index 00000000..f98bedf3
--- /dev/null
+++ b/src/gen/mock.rs
@@ -0,0 +1,11 @@
+//! Global constants, such as compiler version used, algorithms, compression and filters supported and others
+
+pub const COMPILATION_DATE: &str = "-";
+pub const COMPILATION_TIME: &str = "-";
+pub const VERSION: &str = "x.x.x";
+pub const COMPILER: &str = "rustc";
+pub const COMPILER_VERSION: &str = "x.x.x";
+pub const FEATURES: [&str; 1] = ["cpu"];
+pub const PLATFORM_CPU_BITS: &str = "64";
+pub const DEFAULT_THREAD_POOL_SIZE: usize = 1;
+pub const MAX_THREAD_POOL_SIZE: usize = 1;
diff --git a/src/gen/mod.rs b/src/gen/mod.rs
new file mode 100644
index 00000000..b4fdbac1
--- /dev/null
+++ b/src/gen/mod.rs
@@ -0,0 +1,12 @@
+//! Constants that define the current build and execution environment.
+
+#[cfg(feature = "readonly")]
+pub mod mock;
+#[cfg(feature = "readonly")]
+pub use self::mock::*;
+
+#[rustfmt::skip]
+#[cfg(not(feature = "readonly"))]
+pub mod build;
+#[cfg(not(feature = "readonly"))]
+pub use self::build::*;
-- 
GitLab