github software-mansion/scarb v0.1.0-rc.2
0.1.0-rc.2

latest releases: v2.12.2, cairo-lang-macro/v0.2.1, cairo-lang-macro-attributes/v0.2.1...
2 years ago

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 of scarb 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:

  1. If the order of entries in [dependencies] section is already sorted, it will add new dependencies alphabetically.
  2. 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

Full Changelog: v0.1.0-rc.0...v0.1.0-rc.2

Don't miss a new scarb release

NewReleases is sending notifications on new releases.