Forc has a dependency management system which can pull packages using git. This allows users to build and share Forc libraries.
Forc 有一个依赖管理系统,可以使用 git 拉取包。这允许用户构建和共享 Forc 库。
添加依赖 (Adding a dependency)
If your Forc.toml doesn't already have a [dependencies] table, add one. Below, list the package name alongside its source. Currently, forc supports both git and path sources.
If a git source is specified, forc will fetch the git repository at the given URL and then search for a Forc.toml for a package with the given name anywhere inside the git repository.
The following example adds a library dependency named custom_lib. For git dependencies you may optionally specify a branch, tag, or rev (i.e. commit hash) reference.
Once the package is added, running forc build will automatically download added dependencies.
添加包后,运行forc build将自动下载添加的依赖。
更新依赖 (Updating dependencies)
To update dependencies in your Forc directory you can run forc update. For path dependencies this will have no effect. For git dependencies with a branch reference, this will update the project to use the latest commit for the given branch.