From ad304331c32610c2392909ec6b298e0ba22de91b Mon Sep 17 00:00:00 2001 From: Marek Kaput Date: Wed, 27 Sep 2023 15:07:40 +0200 Subject: [PATCH] Prepare release `2.3.0-rc0` (#718) --- Cargo.lock | 153 +++++++++++------- Cargo.toml | 28 ++-- examples/starknet_hello_world/Scarb.toml | 2 +- .../starknet_multiple_contracts/Scarb.toml | 2 +- examples/workspaces/Scarb.toml | 2 +- scarb/src/compiler/compilers/lib.rs | 4 +- .../build_starknet_external_contracts.rs | 149 +++++++---------- 7 files changed, 168 insertions(+), 172 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index db9f8c91c..f1c97aa94 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -462,8 +462,9 @@ dependencies = [ [[package]] name = "cairo-lang-casm" -version = "2.2.0" -source = "git+https://github.com/starkware-libs/cairo?rev=00448c02fc474021575217b9b7e871c728552d52#00448c02fc474021575217b9b7e871c728552d52" +version = "2.3.0-rc0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb068ccbc0a5c2ac7a0aafb14c27692bfffde75300bedfc78a7f2963a47f5552" dependencies = [ "cairo-lang-utils", "indoc", @@ -478,8 +479,9 @@ dependencies = [ [[package]] name = "cairo-lang-compiler" -version = "2.2.0" -source = "git+https://github.com/starkware-libs/cairo?rev=00448c02fc474021575217b9b7e871c728552d52#00448c02fc474021575217b9b7e871c728552d52" +version = "2.3.0-rc0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc7661f481456ca13172a04e2745f58ea8ac6b55b318da1636d2803aae058530" dependencies = [ "anyhow", "cairo-lang-defs", @@ -503,16 +505,18 @@ dependencies = [ [[package]] name = "cairo-lang-debug" -version = "2.2.0" -source = "git+https://github.com/starkware-libs/cairo?rev=00448c02fc474021575217b9b7e871c728552d52#00448c02fc474021575217b9b7e871c728552d52" +version = "2.3.0-rc0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f6cefb5e474a11590278639b9142ce267dcf58b18753f6c9077afcc271e42c8" dependencies = [ "cairo-lang-utils", ] [[package]] name = "cairo-lang-defs" -version = "2.2.0" -source = "git+https://github.com/starkware-libs/cairo?rev=00448c02fc474021575217b9b7e871c728552d52#00448c02fc474021575217b9b7e871c728552d52" +version = "2.3.0-rc0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71dd8ef65b4e072e54440c97d0c97d67fb3604d9ec87ca425c2fec575139099d" dependencies = [ "cairo-lang-debug", "cairo-lang-diagnostics", @@ -528,8 +532,9 @@ dependencies = [ [[package]] name = "cairo-lang-diagnostics" -version = "2.2.0" -source = "git+https://github.com/starkware-libs/cairo?rev=00448c02fc474021575217b9b7e871c728552d52#00448c02fc474021575217b9b7e871c728552d52" +version = "2.3.0-rc0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b6c87e17434e8e8c1fa1831a5ac1285aa884a0f2bb8d5583e11df825f74bfb6" dependencies = [ "cairo-lang-debug", "cairo-lang-filesystem", @@ -540,8 +545,9 @@ dependencies = [ [[package]] name = "cairo-lang-eq-solver" -version = "2.2.0" -source = "git+https://github.com/starkware-libs/cairo?rev=00448c02fc474021575217b9b7e871c728552d52#00448c02fc474021575217b9b7e871c728552d52" +version = "2.3.0-rc0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4006dea1fe413621f43468f025ee4e98d8bf120dfadb16d874c1cc16e1e30e74" dependencies = [ "cairo-lang-utils", "good_lp", @@ -551,8 +557,9 @@ dependencies = [ [[package]] name = "cairo-lang-filesystem" -version = "2.2.0" -source = "git+https://github.com/starkware-libs/cairo?rev=00448c02fc474021575217b9b7e871c728552d52#00448c02fc474021575217b9b7e871c728552d52" +version = "2.3.0-rc0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed7cca1fe7022a037b0fc736fac75c56ce1025fd9758d1c8c9c4f5380d923d0" dependencies = [ "cairo-lang-debug", "cairo-lang-utils", @@ -564,8 +571,9 @@ dependencies = [ [[package]] name = "cairo-lang-formatter" -version = "2.2.0" -source = "git+https://github.com/starkware-libs/cairo?rev=00448c02fc474021575217b9b7e871c728552d52#00448c02fc474021575217b9b7e871c728552d52" +version = "2.3.0-rc0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5f03cebcdf43772600c3527eb77d1db42921b03872e1dc9b51dbe04eeb5ba1d" dependencies = [ "anyhow", "cairo-lang-diagnostics", @@ -585,8 +593,9 @@ dependencies = [ [[package]] name = "cairo-lang-language-server" -version = "2.2.0" -source = "git+https://github.com/starkware-libs/cairo?rev=00448c02fc474021575217b9b7e871c728552d52#00448c02fc474021575217b9b7e871c728552d52" +version = "2.3.0-rc0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a027c05bb7923b28d2c014303467cc23f47e9451ef1198ac8097eb80732d7f29" dependencies = [ "anyhow", "cairo-lang-compiler", @@ -602,6 +611,7 @@ dependencies = [ "cairo-lang-semantic", "cairo-lang-starknet", "cairo-lang-syntax", + "cairo-lang-test-plugin", "cairo-lang-utils", "indoc", "log", @@ -617,8 +627,9 @@ dependencies = [ [[package]] name = "cairo-lang-lowering" -version = "2.2.0" -source = "git+https://github.com/starkware-libs/cairo?rev=00448c02fc474021575217b9b7e871c728552d52#00448c02fc474021575217b9b7e871c728552d52" +version = "2.3.0-rc0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b30c3d2667ce940132e7fd8ec91b45abd3499917f22da15bb73692480f046c6" dependencies = [ "cairo-lang-debug", "cairo-lang-defs", @@ -642,8 +653,9 @@ dependencies = [ [[package]] name = "cairo-lang-parser" -version = "2.2.0" -source = "git+https://github.com/starkware-libs/cairo?rev=00448c02fc474021575217b9b7e871c728552d52#00448c02fc474021575217b9b7e871c728552d52" +version = "2.3.0-rc0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e1470d4122d6a99820125f65f6e785a403f920a00fedcfe1420815684376d4" dependencies = [ "cairo-lang-diagnostics", "cairo-lang-filesystem", @@ -662,8 +674,9 @@ dependencies = [ [[package]] name = "cairo-lang-plugins" -version = "2.2.0" -source = "git+https://github.com/starkware-libs/cairo?rev=00448c02fc474021575217b9b7e871c728552d52#00448c02fc474021575217b9b7e871c728552d52" +version = "2.3.0-rc0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bafe49e8ecdba5dbc3c8870bb841c8d69bd6e87cc0e78d6419f1ec7e01805e1" dependencies = [ "cairo-lang-defs", "cairo-lang-diagnostics", @@ -681,8 +694,9 @@ dependencies = [ [[package]] name = "cairo-lang-proc-macros" -version = "2.2.0" -source = "git+https://github.com/starkware-libs/cairo?rev=00448c02fc474021575217b9b7e871c728552d52#00448c02fc474021575217b9b7e871c728552d52" +version = "2.3.0-rc0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd6dcdcc61274a9cf22eef7163584bd3b594869ab59fa4e2bfb4470837bfd0ea" dependencies = [ "cairo-lang-debug", "quote", @@ -691,8 +705,9 @@ dependencies = [ [[package]] name = "cairo-lang-project" -version = "2.2.0" -source = "git+https://github.com/starkware-libs/cairo?rev=00448c02fc474021575217b9b7e871c728552d52#00448c02fc474021575217b9b7e871c728552d52" +version = "2.3.0-rc0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69705fe9c913cbfc1b016aa29f2efca33f97b93d80d27da294e45c85ba427dd4" dependencies = [ "cairo-lang-filesystem", "cairo-lang-utils", @@ -704,8 +719,9 @@ dependencies = [ [[package]] name = "cairo-lang-runner" -version = "2.2.0" -source = "git+https://github.com/starkware-libs/cairo?rev=00448c02fc474021575217b9b7e871c728552d52#00448c02fc474021575217b9b7e871c728552d52" +version = "2.3.0-rc0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e77b0abe5f7dc5d2234d368c5f2ee63dec88d68220f1c03111b543d0fdbe12" dependencies = [ "anyhow", "ark-ff", @@ -740,8 +756,9 @@ dependencies = [ [[package]] name = "cairo-lang-semantic" -version = "2.2.0" -source = "git+https://github.com/starkware-libs/cairo?rev=00448c02fc474021575217b9b7e871c728552d52#00448c02fc474021575217b9b7e871c728552d52" +version = "2.3.0-rc0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4133c1c9a9f22219c7f686935f789e4cc39729307b85c7c2f0121320bdf87708" dependencies = [ "cairo-lang-debug", "cairo-lang-defs", @@ -763,8 +780,9 @@ dependencies = [ [[package]] name = "cairo-lang-sierra" -version = "2.2.0" -source = "git+https://github.com/starkware-libs/cairo?rev=00448c02fc474021575217b9b7e871c728552d52#00448c02fc474021575217b9b7e871c728552d52" +version = "2.3.0-rc0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9678ddef9d73dc6f89fb83615b96e12dfd87c00412d263b97661b11bbbb385d" dependencies = [ "anyhow", "cairo-lang-utils", @@ -786,8 +804,9 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-ap-change" -version = "2.2.0" -source = "git+https://github.com/starkware-libs/cairo?rev=00448c02fc474021575217b9b7e871c728552d52#00448c02fc474021575217b9b7e871c728552d52" +version = "2.3.0-rc0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b49d2cd2dcf91dc6f94605e9ad755cedce97afed7d45f51f078c56e8143cbfcf" dependencies = [ "cairo-lang-eq-solver", "cairo-lang-sierra", @@ -799,8 +818,9 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-gas" -version = "2.2.0" -source = "git+https://github.com/starkware-libs/cairo?rev=00448c02fc474021575217b9b7e871c728552d52#00448c02fc474021575217b9b7e871c728552d52" +version = "2.3.0-rc0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6cd7531fad23a178f0226093328be468a88aa24f7a3ecd3374c0a5859886000c" dependencies = [ "cairo-lang-eq-solver", "cairo-lang-sierra", @@ -812,8 +832,9 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-generator" -version = "2.2.0" -source = "git+https://github.com/starkware-libs/cairo?rev=00448c02fc474021575217b9b7e871c728552d52#00448c02fc474021575217b9b7e871c728552d52" +version = "2.3.0-rc0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6cb6e533707387be5c8b85e1e3bcbfb92afefe365aa97ca8642add0f6fc18fd9" dependencies = [ "cairo-lang-debug", "cairo-lang-defs", @@ -837,8 +858,9 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-to-casm" -version = "2.2.0" -source = "git+https://github.com/starkware-libs/cairo?rev=00448c02fc474021575217b9b7e871c728552d52#00448c02fc474021575217b9b7e871c728552d52" +version = "2.3.0-rc0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0836a7c9d328977139e8a38d76d4fe1454fc210b114caddff8108670446d0e94" dependencies = [ "assert_matches", "cairo-felt", @@ -858,8 +880,9 @@ dependencies = [ [[package]] name = "cairo-lang-sierra-type-size" -version = "2.2.0" -source = "git+https://github.com/starkware-libs/cairo?rev=00448c02fc474021575217b9b7e871c728552d52#00448c02fc474021575217b9b7e871c728552d52" +version = "2.3.0-rc0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c5267f684ba3c51b63f3448c29ef4e74e14334289b4ed8c2dad0eef6b81468a" dependencies = [ "cairo-lang-sierra", "cairo-lang-utils", @@ -867,8 +890,9 @@ dependencies = [ [[package]] name = "cairo-lang-starknet" -version = "2.2.0" -source = "git+https://github.com/starkware-libs/cairo?rev=00448c02fc474021575217b9b7e871c728552d52#00448c02fc474021575217b9b7e871c728552d52" +version = "2.3.0-rc0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "632f60df6db82f6d2a16ca19e15df1dc8994eb37792489c6181edd17aa4e1964" dependencies = [ "anyhow", "cairo-felt", @@ -908,8 +932,9 @@ dependencies = [ [[package]] name = "cairo-lang-syntax" -version = "2.2.0" -source = "git+https://github.com/starkware-libs/cairo?rev=00448c02fc474021575217b9b7e871c728552d52#00448c02fc474021575217b9b7e871c728552d52" +version = "2.3.0-rc0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23aa37deb2a615f6592b0cb1d5a02d139869ed60f58e0dc678ef03a6eb7c0ab5" dependencies = [ "cairo-lang-debug", "cairo-lang-filesystem", @@ -924,8 +949,9 @@ dependencies = [ [[package]] name = "cairo-lang-syntax-codegen" -version = "2.2.0" -source = "git+https://github.com/starkware-libs/cairo?rev=00448c02fc474021575217b9b7e871c728552d52#00448c02fc474021575217b9b7e871c728552d52" +version = "2.3.0-rc0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c3c7b8c93a7254752a89b1633c85c92ac37614d0c5bf46619c2ac2edd85d72" dependencies = [ "genco", "xshell", @@ -933,8 +959,9 @@ dependencies = [ [[package]] name = "cairo-lang-test-plugin" -version = "2.2.0" -source = "git+https://github.com/starkware-libs/cairo?rev=00448c02fc474021575217b9b7e871c728552d52#00448c02fc474021575217b9b7e871c728552d52" +version = "2.3.0-rc0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4b29ddd7d74daf033aafea51704a9b1018e0eef40760854c64ddf31108d0370" dependencies = [ "anyhow", "cairo-felt", @@ -957,8 +984,9 @@ dependencies = [ [[package]] name = "cairo-lang-test-runner" -version = "2.2.0" -source = "git+https://github.com/starkware-libs/cairo?rev=00448c02fc474021575217b9b7e871c728552d52#00448c02fc474021575217b9b7e871c728552d52" +version = "2.3.0-rc0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db805fb1d705b1e6510f508e3b55eff2c83f08572afc8c19bce2d59658a9d6e0" dependencies = [ "anyhow", "cairo-felt", @@ -981,8 +1009,9 @@ dependencies = [ [[package]] name = "cairo-lang-utils" -version = "2.2.0" -source = "git+https://github.com/starkware-libs/cairo?rev=00448c02fc474021575217b9b7e871c728552d52#00448c02fc474021575217b9b7e871c728552d52" +version = "2.3.0-rc0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e782ba261e81da39192eb798b58ad970c95356871e2713164d62bf004c6f82b3" dependencies = [ "env_logger", "indexmap 2.0.0", @@ -3904,7 +3933,7 @@ dependencies = [ [[package]] name = "scarb" -version = "2.2.0" +version = "2.3.0-rc0" dependencies = [ "anyhow", "assert_fs", @@ -3977,7 +4006,7 @@ dependencies = [ [[package]] name = "scarb-build-metadata" -version = "2.2.0" +version = "2.3.0-rc0" dependencies = [ "cargo_metadata", "semver", @@ -3985,7 +4014,7 @@ dependencies = [ [[package]] name = "scarb-cairo-language-server" -version = "2.2.0" +version = "2.3.0-rc0" dependencies = [ "cairo-lang-language-server", "cairo-lang-utils", @@ -3995,7 +4024,7 @@ dependencies = [ [[package]] name = "scarb-cairo-run" -version = "2.2.0" +version = "2.3.0-rc0" dependencies = [ "anyhow", "assert_fs", @@ -4014,7 +4043,7 @@ dependencies = [ [[package]] name = "scarb-cairo-test" -version = "2.2.0" +version = "2.3.0-rc0" dependencies = [ "anyhow", "cairo-lang-compiler", @@ -4083,7 +4112,7 @@ dependencies = [ [[package]] name = "scarb-ui" -version = "2.2.0" +version = "2.3.0-rc0" dependencies = [ "anyhow", "camino", diff --git a/Cargo.toml b/Cargo.toml index 89e5d1afd..f3df6e117 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ members = [ "resolver" = "2" [workspace.package] -version = "2.2.0" +version = "2.3.0-rc0" edition = "2021" authors = ["Software Mansion "] @@ -28,19 +28,19 @@ repository = "https://github.com/software-mansion/scarb" anyhow = "1" assert_fs = "1" async-trait = "0.1" -cairo-lang-compiler = { git = "https://github.com/starkware-libs/cairo", rev = "00448c02fc474021575217b9b7e871c728552d52" } -cairo-lang-defs = { git = "https://github.com/starkware-libs/cairo", rev = "00448c02fc474021575217b9b7e871c728552d52" } -cairo-lang-filesystem = { git = "https://github.com/starkware-libs/cairo", rev = "00448c02fc474021575217b9b7e871c728552d52" } -cairo-lang-formatter = { git = "https://github.com/starkware-libs/cairo", rev = "00448c02fc474021575217b9b7e871c728552d52" } -cairo-lang-language-server = { git = "https://github.com/starkware-libs/cairo", rev = "00448c02fc474021575217b9b7e871c728552d52" } -cairo-lang-runner = { git = "https://github.com/starkware-libs/cairo", rev = "00448c02fc474021575217b9b7e871c728552d52" } -cairo-lang-semantic = { git = "https://github.com/starkware-libs/cairo", rev = "00448c02fc474021575217b9b7e871c728552d52" } -cairo-lang-sierra = { git = "https://github.com/starkware-libs/cairo", rev = "00448c02fc474021575217b9b7e871c728552d52" } -cairo-lang-sierra-to-casm = { git = "https://github.com/starkware-libs/cairo", rev = "00448c02fc474021575217b9b7e871c728552d52" } -cairo-lang-starknet = { git = "https://github.com/starkware-libs/cairo", rev = "00448c02fc474021575217b9b7e871c728552d52" } -cairo-lang-test-plugin = { git = "https://github.com/starkware-libs/cairo", rev = "00448c02fc474021575217b9b7e871c728552d52" } -cairo-lang-test-runner = { git = "https://github.com/starkware-libs/cairo", rev = "00448c02fc474021575217b9b7e871c728552d52" } -cairo-lang-utils = { git = "https://github.com/starkware-libs/cairo", rev = "00448c02fc474021575217b9b7e871c728552d52", features = ["env_logger"] } +cairo-lang-compiler = "2.3.0-rc0" +cairo-lang-defs = "2.3.0-rc0" +cairo-lang-filesystem = "2.3.0-rc0" +cairo-lang-formatter = "2.3.0-rc0" +cairo-lang-language-server = "2.3.0-rc0" +cairo-lang-runner = "2.3.0-rc0" +cairo-lang-semantic = "2.3.0-rc0" +cairo-lang-sierra = "2.3.0-rc0" +cairo-lang-sierra-to-casm = "2.3.0-rc0" +cairo-lang-starknet = "2.3.0-rc0" +cairo-lang-test-plugin = "2.3.0-rc0" +cairo-lang-test-runner = "2.3.0-rc0" +cairo-lang-utils = { version = "2.3.0-rc0", features = ["env_logger"] } camino = { version = "1", features = ["serde1"] } cargo_metadata = "0.18" clap = { version = "4", features = ["derive", "env", "string"] } diff --git a/examples/starknet_hello_world/Scarb.toml b/examples/starknet_hello_world/Scarb.toml index a30ad7161..a3cd6f705 100644 --- a/examples/starknet_hello_world/Scarb.toml +++ b/examples/starknet_hello_world/Scarb.toml @@ -5,6 +5,6 @@ version = "0.1.0" # See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html [dependencies] -starknet = "2.1.0" +starknet = "2.3.0-rc0" [[target.starknet-contract]] diff --git a/examples/starknet_multiple_contracts/Scarb.toml b/examples/starknet_multiple_contracts/Scarb.toml index ab1d29e09..845e44504 100644 --- a/examples/starknet_multiple_contracts/Scarb.toml +++ b/examples/starknet_multiple_contracts/Scarb.toml @@ -5,6 +5,6 @@ version = "0.1.0" # See more keys and their definitions at https://docs.swmansion.com/scarb/docs/reference/manifest.html [dependencies] -starknet = "2.1.0" +starknet = "2.3.0-rc0" [[target.starknet-contract]] diff --git a/examples/workspaces/Scarb.toml b/examples/workspaces/Scarb.toml index 926b54ccc..00ce5deb8 100644 --- a/examples/workspaces/Scarb.toml +++ b/examples/workspaces/Scarb.toml @@ -10,7 +10,7 @@ test = "snforge" exit_first = true [workspace.dependencies] -starknet = "2.1.0" +starknet = "2.3.0-rc0" [workspace.package] version = "0.1.0" diff --git a/scarb/src/compiler/compilers/lib.rs b/scarb/src/compiler/compilers/lib.rs index 61291959c..bec248d54 100644 --- a/scarb/src/compiler/compilers/lib.rs +++ b/scarb/src/compiler/compilers/lib.rs @@ -3,7 +3,7 @@ use std::io::Write; use anyhow::{Context, Result}; use cairo_lang_compiler::db::RootDatabase; use cairo_lang_sierra::program::VersionedProgram; -use cairo_lang_sierra_to_casm::metadata::{calc_metadata, MetadataComputationConfig}; +use cairo_lang_sierra_to_casm::metadata::calc_metadata; use serde::{Deserialize, Serialize}; use tracing::trace_span; @@ -90,7 +90,7 @@ impl Compiler for LibCompiler { let metadata = { let _ = trace_span!("casm_calc_metadata"); - calc_metadata(&sierra_program, MetadataComputationConfig::default()) + calc_metadata(&sierra_program, Default::default(), false) .context("failed calculating Sierra variables")? }; diff --git a/scarb/tests/build_starknet_external_contracts.rs b/scarb/tests/build_starknet_external_contracts.rs index 356a2fa75..32819df86 100644 --- a/scarb/tests/build_starknet_external_contracts.rs +++ b/scarb/tests/build_starknet_external_contracts.rs @@ -1,6 +1,6 @@ -use assert_fs::fixture::ChildPath; use std::fs; +use assert_fs::fixture::ChildPath; use assert_fs::prelude::*; use assert_fs::TempDir; use cairo_lang_starknet::contract_class::ContractClass; @@ -49,17 +49,17 @@ fn compile_dep_test_case(hello: &ChildPath, world: &ChildPath, target_extra: &st #[test] fn compile_imported_contracts() { - let t = assert_fs::TempDir::new().unwrap(); + let t = TempDir::new().unwrap(); let hello = t.child("hello"); let world = t.child("world"); compile_dep_test_case( &hello, &world, indoc! {r#" - build-external-contracts = [ - "hello::Balance", - ] - "#}, + build-external-contracts = [ + "hello::Balance", + ] + "#}, ); assert_eq!( @@ -84,18 +84,18 @@ fn compile_imported_contracts() { #[test] fn compile_multiple_imported_contracts() { - let t = assert_fs::TempDir::new().unwrap(); + let t = TempDir::new().unwrap(); let hello = t.child("hello"); let world = t.child("world"); compile_dep_test_case( &hello, &world, indoc! {r#" - build-external-contracts = [ - "hello::Balance", - "hello::HelloContract", - ] - "#}, + build-external-contracts = [ + "hello::Balance", + "hello::HelloContract", + ] + "#}, ); assert_eq!( @@ -173,7 +173,7 @@ fn compile_multiple_imported_contracts() { #[test] fn build_external_full_path() { - let t = assert_fs::TempDir::new().unwrap(); + let t = TempDir::new().unwrap(); let hello = t.child("hello"); let world = t.child("world"); @@ -204,7 +204,7 @@ fn build_external_full_path() { .name("world") .version("0.1.0") .dep("hello", r#" path = "../hello" "#) - .manifest_extra(formatdoc! {r#" + .manifest_extra(indoc! {r#" [[target.starknet-contract]] build-external-contracts = [ "hello::lorem::ipsum::Balance", @@ -238,17 +238,17 @@ fn build_external_full_path() { #[test] fn compile_multiple_with_glob_path() { - let t = assert_fs::TempDir::new().unwrap(); + let t = TempDir::new().unwrap(); let hello = t.child("hello"); let world = t.child("world"); compile_dep_test_case( &hello, &world, indoc! {r#" - build-external-contracts = [ - "hello::*", - ] - "#}, + build-external-contracts = [ + "hello::*", + ] + "#}, ); assert_eq!( @@ -327,94 +327,61 @@ fn compile_multiple_with_glob_path() { #[test] fn compile_multiple_with_glob_subpath() { let t = TempDir::new().unwrap(); + let x = t.child("x"); + let y = t.child("y"); - t.child("x/Scarb.toml") - .write_str( - r#" - [package] - name = "x" - version = "1.0.0" - - [dependencies] - starknet = ">=2.1.0" - y = { path = "../y" } - - [[target.starknet-contract]] - build-external-contracts = ["y::subfolder::*"] - "#, - ) - .unwrap(); - - t.child("x/src/lib.cairo") - .write_str( - r#" + ProjectBuilder::start() + .name("y") + .version("1.0.0") + .dep_starknet() + .lib_cairo(r#"mod subfolder;"#) + .src("src/subfolder.cairo", r#"mod b; mod c;"#) + .src( + "src/subfolder/b.cairo", + indoc! {r#" #[starknet::contract] - mod A { - use y::subfolder::b::B; - use y::subfolder::c::C; - + mod B { #[storage] struct Storage {} } - "#, - ) - .unwrap(); - - t.child("y/Scarb.toml") - .write_str( - r#" - [package] - name = "y" - version = "1.0.0" - - "#, - ) - .unwrap(); - - t.child("y/src/lib.cairo") - .write_str( - r#" - mod subfolder; - "#, - ) - .unwrap(); - - t.child("y/src/subfolder.cairo") - .write_str( - r#" - mod b; - mod c; - "#, + "#}, ) - .unwrap(); - - t.child("y/src/subfolder/b.cairo") - .write_str( - r#" + .src( + "src/subfolder/c.cairo", + indoc! {r#" #[starknet::contract] - mod B { - #[storage] - struct Storage {} + mod C { + #[storage] + struct Storage {} } - "#, + "#}, ) - .unwrap(); + .build(&y); - t.child("y/src/subfolder/c.cairo") - .write_str( - r#" + ProjectBuilder::start() + .name("x") + .version("1.0.0") + .dep_starknet() + .dep("y", &y) + .manifest_extra(indoc! {r#" + [[target.starknet-contract]] + build-external-contracts = ["y::subfolder::*"] + "#}) + .lib_cairo(indoc! {r#" #[starknet::contract] - mod C { + mod A { + use y::subfolder::b::B; + use y::subfolder::c::C; + #[storage] struct Storage {} } - "#, - ) - .unwrap(); + "#}) + .build(&x); Scarb::quick_snapbox() .arg("build") - .current_dir(t.child("x")) + .current_dir(&x) .assert() .success() .stdout_matches(indoc! {r#" @@ -425,7 +392,7 @@ fn compile_multiple_with_glob_subpath() { #[test] fn compile_with_bad_glob_path() { - let t = assert_fs::TempDir::new().unwrap(); + let t = TempDir::new().unwrap(); let hello = t.child("hello"); let world = t.child("world");