Crate forc_pkg

Source
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§

lock
manifest
source
Related to pinning, fetching, validating and caching the source for packages.

Structs§

BuildOpts
The set of options provided to the build functions.
BuildPlan
Represents the full build plan for a project.
BuiltPackage
The result of successfully compiling a package.
BuiltPackageBytecode
The bytecode associated with a built package along with its entry points.
CompiledContractDependency
Compiled contract dependency parts relevant to calculating a contract’s ID.
CompiledPackage
The result of the compile function, i.e. compiling a single package.
Edge
MemberFilter
The set of options to filter type of projects to build in a workspace.
MinifyOpts
PackageDescriptor
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.
PinnedId
A unique ID for a pinned package.
PinnedIdParseError
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
PkgTestEntry
Data specific to the test entry point.
PrintOpts
Programs
Contains the lexed, parsed, typed compilation stages of a program, as well as compilation metrics.

Enums§

Built
DepKind
PkgEntryKind
Data specific to each kind of package entry point.
TestPassCondition
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 necessary sway_core::BuildConfig required for compilation.
wrong_program_type
Format an error message if an incorrect program type is present.

Type Aliases§

BuiltWorkspace
The result of successfully compiling a workspace.
CompiledContractDeps
The set of compiled contract dependencies, provided to dependency namespace construction.
EdgeIx
Graph
ManifestMap
NodeIx