Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use patch-based Cairo dependencies specification #1818

Merged
merged 6 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ jobs:
run: cargo build -p xtask

- name: Upgrade Cairo to latest main commit
run: cargo xtask set-cairo-version --rev $(git ls-remote --refs "https://github.com/starkware-libs/cairo" main | awk '{print $1}')
run: cargo xtask set-dep-version cairo --rev $(git ls-remote --refs "https://github.com/starkware-libs/cairo" main | awk '{print $1}')

- name: Upgrade CairoLS to latest main commit
# run: cargo xtask set-dep-version cairols --rev $(git ls-remote --refs "https://github.com/software-mansion/cairols" main | awk '{print $1}')
run: cargo xtask set-dep-version cairols --rev 94f1543b43caa6355bf492f80cdf46b2ae2bf854
mkaput marked this conversation as resolved.
Show resolved Hide resolved

- name: Rebuild xtasks after Cargo.toml changes
run: cargo build -p xtask
Expand Down Expand Up @@ -183,7 +187,7 @@ jobs:
{
"url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}


notify_failed_check:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ We have a script that edits the `Cargo.toml` file to use a local checkout of the
To use this tool, run:

```shell
cargo xtask set-cairo-version --path ../path/to/cairo
cargo xtask set-dep-version cairo --path ../path/to/cairo
```

And then you can `cargo build` Scarb with your custom Cairo compiler changes.
Expand Down
1,054 changes: 277 additions & 777 deletions Cargo.lock

Large diffs are not rendered by default.

92 changes: 73 additions & 19 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,30 +30,45 @@ license = "MIT"
readme = "README.md"
repository = "https://github.com/software-mansion/scarb"

# Managing dependencies on crates from starkware-libs/cairo repository:
#
# The Cairo compiler is made of a bunch of crates that inter-depend on each other and have
# synchronised versioning.
# It is very important to use a single revision of these crates in the entire Cairo toolchain,
# which consists of Cairo compiler, Scarb, CairoLS and other tools.
# The toolchain is eventually built by Scarb, which depends on everything other as regular crates.
# To ensure that all crates in the toolchain use the same revision of Cairo crates, we use a patch
# mechanism that Cargo provides.
# Because Cargo requires patches to change the crate source, we have an unspoken contract that
# all tools *always* depend on some crates.io versions of Cairo crates and Scarb uses
# [patch.crates.io] table to set final git revision for everything.
#
# To keep our Cargo.toml following this contract, always use `cargo xtask set-dep-version`
# for manipulating these dependencies.
[workspace.dependencies]
anyhow = "1"
assert_fs = "1"
async-trait = "0.1"
axum = { version = "0.6", features = ["http2"] }
cairo-lang-compiler = "2.9.1"
cairo-lang-defs = "2.9.1"
cairo-lang-diagnostics = "2.9.1"
cairo-lang-doc = "2.9.1"
cairo-lang-filesystem = "2.9.1"
cairo-lang-formatter = "2.9.1"
cairo-lang-lowering = "2.9.1"
cairo-lang-parser = "2.9.1"
cairo-lang-runner = "2.9.1"
cairo-lang-semantic = "2.9.1"
cairo-lang-sierra = "2.9.1"
cairo-lang-sierra-to-casm = "2.9.1"
cairo-lang-starknet = "2.9.1"
cairo-lang-starknet-classes = "2.9.1"
cairo-lang-syntax = "2.9.1"
cairo-lang-test-plugin = "2.9.1"
cairo-lang-test-runner = "2.9.1"
cairo-lang-utils = { version = "2.9.1", features = ["env_logger"] }
cairo-language-server = {git = "https://github.com/software-mansion/cairols", rev = "deaad4428c86c620782bcdfef14a079745b59f99" }
cairo-lang-compiler = "*"
cairo-lang-defs = "*"
cairo-lang-diagnostics = "*"
cairo-lang-doc = "*"
cairo-lang-filesystem = "*"
cairo-lang-formatter = "*"
cairo-lang-lowering = "*"
cairo-lang-parser = "*"
cairo-lang-runner = "*"
cairo-lang-semantic = "*"
cairo-lang-sierra = "*"
cairo-lang-sierra-to-casm = "*"
cairo-lang-starknet = "*"
cairo-lang-starknet-classes = "*"
cairo-lang-syntax = "*"
cairo-lang-test-plugin = "*"
cairo-lang-test-runner = "*"
cairo-lang-utils = { version = "*", features = ["env_logger"] }
cairo-language-server = "*"
camino = { version = "1", features = ["serde1"] }
cargo_metadata = ">=0.18"
clap = { version = "4", features = ["derive", "env", "string"] }
Expand Down Expand Up @@ -131,6 +146,45 @@ xxhash-rust = { version = "0.8", features = ["xxh3"] }
zip = { version = "0.6", default-features = false, features = ["deflate"] }
zstd = "0.13"

# Here we specify real dependency specifications for Cairo crates *if* currently we want to use
# a particular unreleased commit (which is frequent mid-development).
# We list all Cairo crates that go into Scarb's compilation unit even if Scarb itself does not depend
# on some of them directly.
# This ensures no duplicate instances of Cairo crates are pulled in by mistake.
[patch.crates-io]
cairo-lang-casm = { git = "https://github.com/starkware-libs/cairo", rev = "67c6eff9c276d11bd1cc903d7a3981d8d0eb2fa2" }
cairo-lang-compiler = { git = "https://github.com/starkware-libs/cairo", rev = "67c6eff9c276d11bd1cc903d7a3981d8d0eb2fa2" }
cairo-lang-debug = { git = "https://github.com/starkware-libs/cairo", rev = "67c6eff9c276d11bd1cc903d7a3981d8d0eb2fa2" }
cairo-lang-defs = { git = "https://github.com/starkware-libs/cairo", rev = "67c6eff9c276d11bd1cc903d7a3981d8d0eb2fa2" }
cairo-lang-diagnostics = { git = "https://github.com/starkware-libs/cairo", rev = "67c6eff9c276d11bd1cc903d7a3981d8d0eb2fa2" }
cairo-lang-doc = { git = "https://github.com/starkware-libs/cairo", rev = "67c6eff9c276d11bd1cc903d7a3981d8d0eb2fa2" }
cairo-lang-eq-solver = { git = "https://github.com/starkware-libs/cairo", rev = "67c6eff9c276d11bd1cc903d7a3981d8d0eb2fa2" }
cairo-lang-filesystem = { git = "https://github.com/starkware-libs/cairo", rev = "67c6eff9c276d11bd1cc903d7a3981d8d0eb2fa2" }
cairo-lang-formatter = { git = "https://github.com/starkware-libs/cairo", rev = "67c6eff9c276d11bd1cc903d7a3981d8d0eb2fa2" }
cairo-lang-lowering = { git = "https://github.com/starkware-libs/cairo", rev = "67c6eff9c276d11bd1cc903d7a3981d8d0eb2fa2" }
cairo-lang-parser = { git = "https://github.com/starkware-libs/cairo", rev = "67c6eff9c276d11bd1cc903d7a3981d8d0eb2fa2" }
cairo-lang-plugins = { git = "https://github.com/starkware-libs/cairo", rev = "67c6eff9c276d11bd1cc903d7a3981d8d0eb2fa2" }
cairo-lang-proc-macros = { git = "https://github.com/starkware-libs/cairo", rev = "67c6eff9c276d11bd1cc903d7a3981d8d0eb2fa2" }
cairo-lang-project = { git = "https://github.com/starkware-libs/cairo", rev = "67c6eff9c276d11bd1cc903d7a3981d8d0eb2fa2" }
cairo-lang-runnable-utils = { git = "https://github.com/starkware-libs/cairo", rev = "67c6eff9c276d11bd1cc903d7a3981d8d0eb2fa2" }
cairo-lang-runner = { git = "https://github.com/starkware-libs/cairo", rev = "67c6eff9c276d11bd1cc903d7a3981d8d0eb2fa2" }
cairo-lang-semantic = { git = "https://github.com/starkware-libs/cairo", rev = "67c6eff9c276d11bd1cc903d7a3981d8d0eb2fa2" }
cairo-lang-sierra = { git = "https://github.com/starkware-libs/cairo", rev = "67c6eff9c276d11bd1cc903d7a3981d8d0eb2fa2" }
cairo-lang-sierra-ap-change = { git = "https://github.com/starkware-libs/cairo", rev = "67c6eff9c276d11bd1cc903d7a3981d8d0eb2fa2" }
cairo-lang-sierra-gas = { git = "https://github.com/starkware-libs/cairo", rev = "67c6eff9c276d11bd1cc903d7a3981d8d0eb2fa2" }
cairo-lang-sierra-generator = { git = "https://github.com/starkware-libs/cairo", rev = "67c6eff9c276d11bd1cc903d7a3981d8d0eb2fa2" }
cairo-lang-sierra-to-casm = { git = "https://github.com/starkware-libs/cairo", rev = "67c6eff9c276d11bd1cc903d7a3981d8d0eb2fa2" }
cairo-lang-sierra-type-size = { git = "https://github.com/starkware-libs/cairo", rev = "67c6eff9c276d11bd1cc903d7a3981d8d0eb2fa2" }
cairo-lang-starknet = { git = "https://github.com/starkware-libs/cairo", rev = "67c6eff9c276d11bd1cc903d7a3981d8d0eb2fa2" }
cairo-lang-starknet-classes = { git = "https://github.com/starkware-libs/cairo", rev = "67c6eff9c276d11bd1cc903d7a3981d8d0eb2fa2" }
cairo-lang-syntax = { git = "https://github.com/starkware-libs/cairo", rev = "67c6eff9c276d11bd1cc903d7a3981d8d0eb2fa2" }
cairo-lang-syntax-codegen = { git = "https://github.com/starkware-libs/cairo", rev = "67c6eff9c276d11bd1cc903d7a3981d8d0eb2fa2" }
cairo-lang-test-plugin = { git = "https://github.com/starkware-libs/cairo", rev = "67c6eff9c276d11bd1cc903d7a3981d8d0eb2fa2" }
cairo-lang-test-runner = { git = "https://github.com/starkware-libs/cairo", rev = "67c6eff9c276d11bd1cc903d7a3981d8d0eb2fa2" }
cairo-lang-test-utils = { git = "https://github.com/starkware-libs/cairo", rev = "67c6eff9c276d11bd1cc903d7a3981d8d0eb2fa2" }
cairo-lang-utils = { git = "https://github.com/starkware-libs/cairo", rev = "67c6eff9c276d11bd1cc903d7a3981d8d0eb2fa2" }
cairo-language-server = { git = "https://github.com/software-mansion/cairols", rev = "94f1543b43caa6355bf492f80cdf46b2ae2bf854" }

[profile.release]
lto = true

Expand Down
2 changes: 1 addition & 1 deletion xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ command!(Command(
get_nightly_version,
list_binaries,
nightly_release_notes,
set_cairo_version,
set_dep_version,
set_scarb_version,
verify_archive,
));
Expand Down
116 changes: 0 additions & 116 deletions xtask/src/set_cairo_version.rs

This file was deleted.

Loading
Loading