From 5746d405e5ae1c224c29059b12e1008b4977816d Mon Sep 17 00:00:00 2001 From: kevaundray Date: Thu, 30 Nov 2023 19:43:23 +0000 Subject: [PATCH] enable aztec macro via an environment variable --- Cargo.toml | 2 +- compiler/noirc_driver/src/lib.rs | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 5738fe94984..a9bf4b8041a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -96,7 +96,7 @@ getrandom = "0.2" cfg-if = "1.0.0" -clap = { version = "4.3.19", features = ["derive"] } +clap = { version = "4.3.19", features = ["derive", "env"] } codespan = { version = "0.11.1", features = ["serialization"] } codespan-lsp = "0.11.1" codespan-reporting = "0.11.1" diff --git a/compiler/noirc_driver/src/lib.rs b/compiler/noirc_driver/src/lib.rs index 427806212cf..8a5d1b9ebef 100644 --- a/compiler/noirc_driver/src/lib.rs +++ b/compiler/noirc_driver/src/lib.rs @@ -63,10 +63,17 @@ pub struct CompileOptions { pub silence_warnings: bool, /// Enables the aztec macro preprocessor - #[arg(long, hide = true)] + #[arg(long, env = AZTEC_MACRO_ENV_VAR, hide = true)] pub aztec_macro: bool, } +pub(crate) const AZTEC_MACRO_ENV_VAR: &str = "AZTEC_MACROS"; + +/// Returns true if the `AZTEC_MACROS` environment variable is set. +pub fn is_aztec_environment_variable_set() -> bool { + std::env::var(AZTEC_MACRO_ENV_VAR).is_ok() +} + /// Helper type used to signify where only warnings are expected in file diagnostics pub type Warnings = Vec;