Forc.toml (the manifest file) is a compulsory file for each package and it is written in [TOML] format.
Forc.toml consists of the following fields:
[project]— Defines a sway project.
name— The name of the project.
authors— The authors of the project.
organization— The organization of the project.
license— The project license.
entry— The entry point for the compiler to start parsing from.
- For the recomended way of selecting an entry point of large libraries please take a look at: Libraries
implicit-std- Controls whether provided
stdversion (with the current
forcversion) will get added as a dependency implicitly. Unless you know what you are doing, leave this as default.
[dependencies]— Defines the dependencies.
[network]— Defines a network for forc to interact with.
url— URL of the network.
[build-profiles]- Defines the build profiles.
Forc.toml is shown below. Under
[project] the following fields are optional:
Also for the following fields, a default value is provided so omitting them is allowed:
entry- (default : main.sw)
implicit-std- (default : true)
[project] authors = ["user"] entry = "main.sw" organization = "Fuel_Labs" license = "Apache-2.0" name = "wallet_contract"
The following fields can be provided with a dependency:
version- Desired version of the dependency
path- The path of the dependency (if it is local)
git- The URL of the git repo hosting the dependency
branch- The desired branch to fetch from the git repo
tag- The desired tag to fetch from the git repo
rev- The desired rev (i.e. commit hash) reference
Please see dependencies for details
For the following fields, a default value is provided so omitting them is allowed:
URL- (default: http://127.0.0.1:4000)
[build-profiles] tables provide a way to customize compiler settings such as debug options.
The following fields needs to be provided for a build-profile:
print-finalized-asm- Whether to compile to bytecode (false) or to print out the generated ASM (true).
print-intermediate-asm- Whether to compile to bytecode (false) or to print out the generated ASM (true).
print-ir- Whether to compile to bytecode (false) or to print out the generated IR (true).
silent-mode- Silent mode. Don't output any warnings or errors to the command line.
There are two default
[build-profile] available with every manifest file. These are
release profiles. If you want to override these profiles, you can provide them explicitly in the manifest file like the following example:
[project] authors = ["user"] entry = "main.sw" organization = "Fuel_Labs" license = "Apache-2.0" name = "wallet_contract" [build-profiles.debug] print-finalized-asm = false print-intermediate-asm = false print-ir = false silent = false [build-profiles.release] print-finalized-asm = false print-intermediate-asm = false print-ir = false silent = true
debug implicitly included in every manifest file, you can use them by just passing
--release or by not passing anything (debug is default). For using a user defined build profile there is
--build-profile <profile name> option available to the relevant commands. (For an example see forc-build)
Note that providing the corresponding cli options (like
--print-finalized-asm) will override the selected build profile. For example if you pass both
--print-finalized-asm, release build profile is omitted and resulting build profile would have a structure like the following:
- print-finalized-asm - true
- print-intermediate-asm - false
- print-ir - false
- silent - false