Skip to content

Consider moving sway-lib-std and sway-lib-core back into the sway repo to make synchronising under CI easier #830

@mitchmindtree

Description

@mitchmindtree

Currently, we have a cyclic dependency between the sway repo and the sway-lib-core/sway-lib-std repos. std and core are used throughout the examples and tests under sway, and the two libraries implicitly depend on sway via the sway language and forc.

We should consider the possibility of moving the std and core libs back into the sway repo to make keeping everything in sync under CI easier and to avoid the need to open two PRs each time we make a change to either the libs or sway.

forc dependencies in git repo sub-directories

Seeing as Sway doesn't yet have an implicitly included prelude through which we can provide core and std, we'll need to solve how to refer to the sub-directory of a repo in forc's git depedencies to make this possible. This will be necessary to allow downstream projects to depend on std and core via git by pointing at the sway repo.

Cargo generally seems to "solve" this via their [workspace] feature, as crates within subdirectories are almost always a part of some top-level workspace. That said, workspaces are a much broader feature which aims to solve a lot of other problems too, so I'm not sure we should rely on waiting to land a similar feature in forc just to solve this.

An alternative might be to add something like a root attribute to forc's git dependency type, where root is a relative path from the repo to the subdirectory containing the manifest of the dependency. We could potentially re-use the existing path field for this rather than adding a root field, as long as we clarify the behaviour that when both path and git are specified, path is relative to the root of the specified git repo rather than the root of the current project.

In the sway repo examples and tests we could solve this by specifying the core and std dependencies via path, however this wouldn't solve anything for downstream projects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions