-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #150 from NethermindEth/feature/multiple-cairo-ver…
…sions [WIP] add support of multiple cairo versions
- Loading branch information
Showing
19 changed files
with
529 additions
and
318 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
|
||
echo "Building cairo compilers" | ||
|
||
directories=$(ls -d */) | ||
|
||
for dir in $directories | ||
do | ||
echo "Building $dir" | ||
|
||
if [[ ! -f "$dir/Cargo.toml" ]] || [[ ! "$dir" =~ ^v[0-9]+\.[0-9]+\.[0-9]+/$ ]]; then | ||
echo "Invalid cairo version provided $dir" | ||
exit 1 | ||
fi | ||
|
||
cd "$dir" || exit 1 | ||
|
||
cargo build --bin starknet-compile --release | ||
cargo build --bin starknet-sierra-compile --release | ||
|
||
cd .. | ||
|
||
echo "Done building $dir" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
use crate::utils::lib::CAIRO_COMPILERS_DIR; | ||
use rocket::tokio::fs::read_dir; | ||
use std::path::Path; | ||
use tracing::instrument; | ||
|
||
#[instrument] | ||
#[get("/cairo_versions")] | ||
pub async fn cairo_versions() -> String { | ||
do_cairo_versions().await.unwrap_or_else(|e| e) | ||
} | ||
|
||
/// Get cairo versions | ||
pub async fn do_cairo_versions() -> Result<String, String> { | ||
let path = Path::new(CAIRO_COMPILERS_DIR); | ||
|
||
let mut dir = read_dir(path).await.unwrap(); | ||
let mut result = vec![]; | ||
|
||
while let Ok(Some(entry)) = dir.next_entry().await { | ||
let entry = entry; | ||
let path = entry.path(); | ||
if path.is_dir() { | ||
println!("{:?}", entry.file_name()); | ||
result.push(entry.file_name().to_string_lossy().to_string()); | ||
} | ||
} | ||
|
||
Ok(format!("{:?}", result)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.