Expand description
Building, locking, fetching and updating sway projects as Forc packages.
A forc package represents a Sway project with a Forc.toml
manifest file declared at its root.
The project should consist of one or more Sway modules under a src
directory. It may also
declare a set of forc package dependencies within its manifest.
Re-exports§
pub use lock::Lock;
pub use manifest::build_profile::BuildProfile;
pub use manifest::PackageManifest;
pub use manifest::PackageManifestFile;
pub use manifest::WorkspaceManifest;
pub use manifest::WorkspaceManifestFile;
Modules§
Structs§
- Build
Opts - The set of options provided to the
build
functions. - Build
Plan - Represents the full build plan for a project.
- Built
Package - The result of successfully compiling a package.
- Built
Package Bytecode - The bytecode associated with a built package along with its entry points.
- Compiled
Contract Dependency - Compiled contract dependency parts relevant to calculating a contract’s ID.
- Compiled
Package - The result of the
compile
function, i.e. compiling a single package. - Edge
- Member
Filter - The set of options to filter type of projects to build in a workspace.
- Minify
Opts - Package
Descriptor - The package descriptors that a
BuiltPackage
holds so that the source used for building the package can be retrieved later on. - Pinned
- A package uniquely identified by name along with its pinned source.
- Pinned
Id - A unique ID for a pinned package.
- Pinned
IdParse Error - Error returned upon failed parsing of
PinnedId::from_str
. - Pkg
- A package uniquely identified by name along with its source.
- PkgEntry
- Represents a package entry point.
- PkgOpts
- PkgTest
Entry - Data specific to the test entry point.
- Print
Opts - Programs
- Contains the lexed, parsed, typed compilation stages of a program, as well as compilation metrics.
Enums§
- Built
- DepKind
- PkgEntry
Kind - Data specific to each kind of package entry point.
- Test
Pass Condition - The possible conditions for a test result to be considered “passing”.
Constants§
- SWAY_
BIN_ HASH_ SUFFIX - The suffix that helps identify the file which contains the hash of the binary file created when scripts are built_package.
- SWAY_
BIN_ ROOT_ SUFFIX - The suffix that helps identify the file which contains the root hash of the binary file created when predicates are built_package.
Functions§
- build
- Build an entire forc package and return the built_package output.
- build_
with_ options - Builds a project with given BuildOptions.
- check
- Compile the entire forc package and return the lexed, parsed and typed programs of the dependencies and project. The final item in the returned vector is the project.
- compilation_
order - The
pkg::Graph
is of a -> b where a depends on b. We can determine compilation order by performing a toposort of the graph with reversed weights. The resulting order ensures all dependencies are always compiled before their dependents. - compile
- Compiles the given package.
- contract_
id - Returns the ContractId of a built_package contract with specified
salt
. - dependency_
namespace - Builds the dependency namespace for the package at the given node index within the graph.
- format_
bytecode_ size - Returns the size of the bytecode in a human-readable format.
- fuel_
core_ not_ running - Format an error message if a given URL fails to produce a working node.
- manifest_
file_ missing - Format an error message for an absent
Forc.toml
. - parsing_
failed - Format an error message for failed parsing of a manifest.
- sway_
build_ config - Given a
forc_pkg::BuildProfile
, produce the necessarysway_core::BuildConfig
required for compilation. - wrong_
program_ type - Format an error message if an incorrect program type is present.
Type Aliases§
- Built
Workspace - The result of successfully compiling a workspace.
- Compiled
Contract Deps - The set of compiled contract dependencies, provided to dependency namespace construction.
- EdgeIx
- Graph
- Manifest
Map - NodeIx