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

Expose dependencies information in scarb metadata #1653

Open
mkaput opened this issue Oct 16, 2024 · 0 comments · May be fixed by #1655
Open

Expose dependencies information in scarb metadata #1653

mkaput opened this issue Oct 16, 2024 · 0 comments · May be fixed by #1655
Assignees

Comments

@mkaput
Copy link
Member

mkaput commented Oct 16, 2024

Problem

Since 2.9 Cairo adds a notion of crate dependencies which limit visibility of other crates in each crate within a compilation unit.

Scarb resolver is the place where all the necessary information for building all dependencies is generated, and Scarb itself is capable of passing this information to the compiler. Unfortunately, other tools (CairoLS, scarb doc, cairo lint) also need it, and currently they have to copy the complex logic from Scarb codebase.

Proposed Solution

Add the following properties to scarb metadata --format-version 1:

struct CompilationUnitComponentMetadata {
    // Option for backwards compatibility
    /// Unique string identifying this component.
    pub id: Option<CompilationUnitComponentMetadataId>,
    pub dependencies: Option<Vec<CompilationUnitComponentDependencyMetadata>>,
}

struct CompilationUnitComponentMetadataId { /* same kind as PackageId etc. */ }

struct CompilationUnitComponentDependencyMetadata {
    /// Id of component from the same compilation unit that this dependency refers to.
    ///
    /// This should directly translate to a `discriminator` field in Cairo compiler terminology,
    /// except that it should be `None` for `core` crate **only**.
    pub id: String,

    pub extra // same story as everywhere
}

Notes

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging a pull request may close this issue.

2 participants