Scarb 0.1 Release Candidate 2
Welcome to the third release candidate of Scarb v0.1.0! We find Scarb to be ready for writing Cairo code and StarkNet contracts, and this release not only updates Cairo to Alpha 6, but also brings several new features that we merged recently:
scarb-metadata
crate - A Rust crate to ease generating and consuming output ofscarb metadata
command.- Breaking changes in metadata format - Several nonsense fields have been removed and several have been added along the way.
[tool.*]
section - Standardized place for adding custom tool-specific fields to `Scarb.toml.[cairo]
section - Pass configuration parameters to Cairo compiler.- Improvements to
scarb add
- This command now sorts dependencies and cleans up added Git repository URLs. - Scarb crate new APIs - Accessors for targets and tool sections, revamp of
CompilationUnit
data structure.
NOTE: This release is back on crates.io.
scarb-metadata
crate
This crate provides structured access to the output of scarb metadata
command. It is meant to be a go-to choice when trying to get information about the workspace from Scarb in extensions.
See crate documentation on docs.rs for more information.
We have already submitted a PR to Cairo Language Server to use this crate, and we advise doing this as well in your projects.
While working on this, we should several missing opportunities or even nonsensical fields in the schema. The changes resulted in a situation that scarb-metadata
will fail to parse outputs of older Scarb versions and vice versa, but Cairo Language Server up to Cairo Alpha 6 has not been affected (because it worked on a subset of the entire schema, that we carefully avoided breaking).
[tool.*]
section
Scarb extensions and other tools now have a place to put their custom configuration data in Scarb.toml
, the [tool]
table. Tools must put their configuration fields in a subtable, and they should use tool name as the key. For example, Protostar will soon use:
[tool.protostar.test]
report-slowest-tests = 5
For more information, checkout the section about [tool]
table in Scarb documentation.
[cairo]
section
Currently, the Cairo compiler has one configuration option, and it was not possible to enable it while using Scarb: an ability to replace IDs in generated Sierra code with their human-readable counterparts. New versions of Cairo will introduce new flags, which brings a need for a possibility to add extra switches in a clear place in the future. Hence, the [cairo]
section has been added to Scarb.toml
.
To enable this feature, now you can simply add the following snippet to Scarb.toml
:
[cairo]
sierra-replace-ids = true
For more information, checkout the section about [cairo]
section in Scarb documentation.
Improvements to scarb add
The scarb add
command has been polished this cycle:
- If the order of entries in
[dependencies]
section is already sorted, it will add new dependencies alphabetically. - It will try to normalize GitHub repository URLs, to slightly improve consistency of dependency entries. Scarb already performed same normalization procedures while pulling dependencies from Git, there is no behaviour difference here.
Thanks to @kariy for contributing these improvements!
Scarb crate new APIs
We added several methods to core data models to ease access to some popular information hidden deep in Manifest
data structure. See merged pull request for a diff of what's added and Scarb crate documentation on docs.rs for more information about these.
Cairo version
This version of Scarb comes with Cairo v0.1.0-alpha.6
.
Pull requests
- Bump actions/add-to-project from 0.4.0 to 0.4.1 by @dependabot in #140
- Sort
[dependencies]
section onscarb add
by @kariy in #143 - Bump serde_json from 1.0.93 to 1.0.94 by @dependabot in #153
- Bump snapbox from 0.4.7 to 0.4.8 by @dependabot in #157
- Bump thiserror from 1.0.38 to 1.0.39 by @dependabot in #156
- Bump indoc from 2.0.0 to 2.0.1 by @dependabot in #155
- Bump clap from 4.1.6 to 4.1.8 by @dependabot in #154
- Generalize logic for getting selected package by @kariy in #152
- Move exit code handling to error types system by @maciektr in #146
- Pass absolute path to read workspace on Scarb new by @maciektr in #161
- Scarb website by @mkaput in #150
- Bump libc from 0.2.139 to 0.2.140 by @dependabot in #168
- Bump async-trait from 0.1.64 to 0.1.66 by @dependabot in #167
- Bump camino from 1.1.3 to 1.1.4 by @dependabot in #165
- Bump serde from 1.0.152 to 1.0.156 by @dependabot in #172
- Bump toml_edit from 0.19.4 to 0.19.6 by @dependabot in #171
- Add tool metadata to manifest by @maciektr in #163
- Canonicalize Git URL in
scarb add
by @kariy in #162 - Add tool section to docs by @maciektr in #182
- Add
[cairo]
section to Scarb.toml by @mkaput in #180 - Create
scarb-metadata
crate by @mkaput in #183 - Add getters for tool metadata tables by @mkaput in #185
- Polish
scarb-metadata
package by @mkaput in #186 - Bump snapbox from 0.4.8 to 0.4.10 by @dependabot in #191
- Bump toml_edit from 0.19.6 to 0.19.7 by @dependabot in #192
- Bump semver from 1.0.16 to 1.0.17 by @dependabot in #193
- Bump anyhow from 1.0.69 to 1.0.70 by @dependabot in #195
- Update Cairo to
1.0.0-alpha.6
by @mkaput in #196 - Bump serde from 1.0.156 to 1.0.158 by @dependabot in #198
- Stabilize metadata format and fix all problems found by @mkaput in #189
Full Changelog: v0.1.0-rc.0...v0.1.0-rc.2