Skip to content

Commit cf6c1c6

Browse files
feat(apollo_starknet_os_program): source file dump on build
Signed-off-by: Dori Medini <dori@starkware.co>
1 parent b9809d5 commit cf6c1c6

File tree

4 files changed

+17
-111
lines changed

4 files changed

+17
-111
lines changed

crates/apollo_starknet_os_program/Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,17 @@ edition.workspace = true
55
repository.workspace = true
66
license-file.workspace = true
77
description = "The source (Cairo) code of the Starknet OS."
8+
build = "build/main.rs"
9+
10+
[features]
11+
dump_source_files = []
812

913
[lints]
1014
workspace = true
1115

1216
[dependencies]
17+
serde_json.workspace = true
18+
19+
[build-dependencies]
1320
apollo_infra_utils.workspace = true
1421
serde_json.workspace = true

crates/apollo_starknet_os_program/src/cairo_files_list.json

Lines changed: 0 additions & 33 deletions
This file was deleted.

crates/apollo_starknet_os_program/src/cairo_files_list_test.rs

Lines changed: 0 additions & 76 deletions
This file was deleted.
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,10 @@
1-
#[cfg(test)]
2-
mod cairo_files_list_test;
1+
#[cfg(feature = "dump_source_files")]
2+
use std::collections::HashMap;
3+
#[cfg(feature = "dump_source_files")]
4+
use std::sync::LazyLock;
5+
6+
#[cfg(feature = "dump_source_files")]
7+
pub static CAIRO_FILES_MAP: LazyLock<HashMap<String, String>> = LazyLock::new(|| {
8+
serde_json::from_str(include_str!(concat!(env!("OUT_DIR"), "/cairo_files_map.json")))
9+
.unwrap_or_else(|error| panic!("Failed to deserialize cairo_files_map.json: {error:?}."))
10+
});

0 commit comments

Comments
 (0)