From 463fb7712b74c3afaeb87597a700121619850386 Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Wed, 3 Apr 2024 16:13:16 +0100 Subject: [PATCH] chore: simplify how blns is loaded into tests (#4705) # Description ## Problem\* Resolves ## Summary\* Similarly to #4703, this PR simplifies how we load in the blns file for tests. ## Additional Context ## Documentation\* Check one: - [x] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist\* - [x] I have tested the changes locally. - [x] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings. --- compiler/noirc_frontend/build.rs | 15 --------------- .../noirc_frontend/src/{ => lexer}/blns/LICENSE | 0 .../noirc_frontend/src/{ => lexer}/blns/README.md | 0 .../src/{ => lexer}/blns/blns.base64.json | 0 compiler/noirc_frontend/src/lexer/lexer.rs | 2 +- 5 files changed, 1 insertion(+), 16 deletions(-) delete mode 100644 compiler/noirc_frontend/build.rs rename compiler/noirc_frontend/src/{ => lexer}/blns/LICENSE (100%) rename compiler/noirc_frontend/src/{ => lexer}/blns/README.md (100%) rename compiler/noirc_frontend/src/{ => lexer}/blns/blns.base64.json (100%) diff --git a/compiler/noirc_frontend/build.rs b/compiler/noirc_frontend/build.rs deleted file mode 100644 index 53ae9489168..00000000000 --- a/compiler/noirc_frontend/build.rs +++ /dev/null @@ -1,15 +0,0 @@ -use std::path::PathBuf; - -const BLNS_JSON_PATH: &str = "BLNS_JSON_PATH"; - -fn main() -> Result<(), String> { - let out_dir = std::env::var("OUT_DIR").unwrap(); - - let dest_path = PathBuf::from(out_dir.clone()).join("blns.base64.json"); - let dest_path_str = dest_path.to_str().unwrap(); - - println!("cargo:rustc-env={BLNS_JSON_PATH}={dest_path_str}"); - std::fs::copy("./src/blns/blns.base64.json", dest_path).unwrap(); - - Ok(()) -} diff --git a/compiler/noirc_frontend/src/blns/LICENSE b/compiler/noirc_frontend/src/lexer/blns/LICENSE similarity index 100% rename from compiler/noirc_frontend/src/blns/LICENSE rename to compiler/noirc_frontend/src/lexer/blns/LICENSE diff --git a/compiler/noirc_frontend/src/blns/README.md b/compiler/noirc_frontend/src/lexer/blns/README.md similarity index 100% rename from compiler/noirc_frontend/src/blns/README.md rename to compiler/noirc_frontend/src/lexer/blns/README.md diff --git a/compiler/noirc_frontend/src/blns/blns.base64.json b/compiler/noirc_frontend/src/lexer/blns/blns.base64.json similarity index 100% rename from compiler/noirc_frontend/src/blns/blns.base64.json rename to compiler/noirc_frontend/src/lexer/blns/blns.base64.json diff --git a/compiler/noirc_frontend/src/lexer/lexer.rs b/compiler/noirc_frontend/src/lexer/lexer.rs index cb21f58e58b..265b9e4b5a3 100644 --- a/compiler/noirc_frontend/src/lexer/lexer.rs +++ b/compiler/noirc_frontend/src/lexer/lexer.rs @@ -1160,7 +1160,7 @@ mod tests { fn test_big_list_of_naughty_strings() { use std::mem::discriminant; - let blns_contents = include_str!(env!("BLNS_JSON_PATH")); + let blns_contents = include_str!("./blns/blns.base64.json"); let blns_base64: Vec = serde_json::from_str(blns_contents).expect("BLNS json invalid"); for blns_base64_str in blns_base64 {