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

Add support for specifying the sub-directory of a git repository for forc dependencies #953

Open
mitchmindtree opened this issue Mar 16, 2022 · 2 comments
Labels
bikeshedding For bikeshedding trivialities forc forc-pkg Everything related to the `forc-pkg` crate.

Comments

@mitchmindtree
Copy link
Contributor

Implementing #952 should get us support for dependencies in git repository sub-directories.

However as mentioned in that issue, the approach of walking the entire repo may take a long time for large mono-repo projects or cause issues if there is more than one project with the same name for whatever reason.

We should optionally allow the user to specify a particular sub-directory to avoid performing the search if they wish.

E.g. if we have a repository at github.com/owner/repo that has 2 sway libraries in it called foo and bar under respective directories, we should allow for specifying them like so:

foo = { git = "https://github.com/owner/repo", branch = "main", path = "foo" }
std = { git = "https://github.com/owner/repo", branch = "main", path = "bar" }

We might want to bikeshed over what field to use to declare this subpath, as using path might be a little contentious seeing as the same field is already used to describe local dependencies.

Further, in cargo, specifying both path and git for a dependency used to have a different meaning, where path would be relative to the manifest and would override git. I believe this was originally supported in order to allow for a very basic approach of "patching" a top-level dependency for testing. Since then, [replace] was introduced as the proper approach to patching, then it was replaced by [patch], and then finally specifying both path and git simultaneously was deprecated in 2018.

My proposal is to update the meaning of the path field to the following with some clear documentation while we still have a fresh slate:

  • In the case that a git repository is specified, path is relative to the root of the repository.
  • When no git repository is specified, path is relative to the project's manifest.
@mitchmindtree mitchmindtree added bikeshedding For bikeshedding trivialities forc dependencies labels Mar 16, 2022
@mitchmindtree
Copy link
Contributor Author

Should note that specifying paths in serializable structs is a speedy way to break portability - we should remember to use some cross-platform serialization approach for Forc.lock.

@adlerjohn
Copy link
Contributor

Seems reasonable!

@kayagokalp kayagokalp added forc-pkg Everything related to the `forc-pkg` crate. and removed dependencies labels Nov 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bikeshedding For bikeshedding trivialities forc forc-pkg Everything related to the `forc-pkg` crate.
Projects
Status: Todo
Development

No branches or pull requests

3 participants