-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Add support for [workspace]
s to forc
#1777
Comments
Good outline. The primary point is indeed to allow multiple otherwise-independent Forc projects to interact with each other seamlessly, rather than shared build artifacts. |
After our discussion with @mitchmindtree, I think rough roadmap seems like the following: Issues moved to TODO list in OP. |
Nice one @kayagokalp! I'll move these into the top-level post so that we get the fancy progress bar under the issue throughout github's UI. |
Context
We are progressively coming across more and more cases where it would be great if
forc
could be aware of collections of packages and the way they interact, rather than just reasoning about one package at a time.Cargo Workspaces
Cargo uses the concept of
[workspace]
s to achieve something similar and we may want to draw inspiration from it. However, it's worth noting that cargo's original major motivator was to have the ability for a bunch of related crates to share a compiler output artifact directory (target/
) to cut down on the epicly long crate build times. Our major motivations are a bit different, and we should keep this in mind when considering the designMotivations
Deploying multiple packages
It is not uncommon for a project to manage a set of contracts that should be deployed simultaneously. Currently, this is a PITA with
forc
asforc
is only aware of a single package at a time.It would be nice if
forc
had the ability to reason about a set of packages, and to be able to reason about not just build[dependencies]
, but deployment dependencies and related ordering too. Deployment ordering is important as if contract foo requires interacting with contract bar, then contract foo will likely need contract bar's address which can't be known until it is deployed.Testing multiple packages
Currently
forc test
is a thin layer on top ofcargo test
as it only really supports integration tests via the Rust SDK. One common issue with this is that the cargo project root is not always the same as the forc project root, occasionally leading to strange and unexpected behaviour fromforc test
. This is becausecargo
considers the project root to be where the cargo workspace manifest lives, whileforc
considers the project root to be where the forc package manifest lives. This is discussed briefly in #1375 and #1521, and #1612 might be related.If
forc
had the concept of[workspace]
s, it would at least enable users to setup their project so that bothforc
andcargo
are aware of the same workspace root, and might make it a bit easier to makeforc test
behaviour more intuitive.cc @adlerjohn finally opening this as a rough tracking issue to get started and somewhere to discuss this. Feel free to add more motivations or details whether in this OP or in new comments!
I remember us having a chat about passing inputs between packages within a hypothetical workspace a while ago in another issue, but can't for the life of me remember where that issue is 🤔
Once we have a clearer outline of all the motivations/goals we can think of, I'll have a go at a rough potential design (if no-one beats me to it).
TODO
forc-build
to output deployment information #2930forc-client
to be aware of workspace manifest files #2929The text was updated successfully, but these errors were encountered: