File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed
Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -71,4 +71,22 @@ struct Dashboard<'a> {{
7171 ) ;
7272 }
7373 }
74+
75+ // The environment variable `MAINNET_ROUTING_TABLE` pointing to a file (storing the mainnet routing table) is needed
76+ // for the PocketIC server to compile. There are two flows to support:
77+ // - code validation using `cargo`: we create a dummy file and point `MAINNET_ROUTING_TABLE` to that file for code validation to succeed;
78+ // - building the PocketIC server using `bazel`: `bazel` always sets `MAINNET_ROUTING_TABLE` to an actual file storing the mainnet routing table
79+ // (built separately) and thus we don't override `MAINNET_ROUTING_TABLE` if already set.
80+ let mainnet_routing_table_var_name = "MAINNET_ROUTING_TABLE" . to_string ( ) ;
81+ if std:: env:: var ( & mainnet_routing_table_var_name) . is_err ( ) {
82+ let mainnet_routing_table_file_name = "mainnet_routing_table.json" ;
83+ let mainnet_routing_table_file_path =
84+ PathBuf :: from ( std:: env:: var ( "OUT_DIR" ) . unwrap ( ) ) . join ( mainnet_routing_table_file_name) ;
85+ File :: create ( & mainnet_routing_table_file_path) . unwrap ( ) ;
86+ println ! (
87+ "cargo:rustc-env={}={}" ,
88+ mainnet_routing_table_var_name,
89+ mainnet_routing_table_file_path. display( )
90+ ) ;
91+ }
7492}
You can’t perform that action at this time.
0 commit comments