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::BuildProfile;
pub use manifest::Manifest;
pub use manifest::ManifestFile;

Modules

Structs

Represents the full build plan for a project.

The result of successfully compiling a package.

A package uniquely identified by name along with its pinned source.

A unique ID for a pinned package.

Error returned upon failed parsing of PinnedId::from_str.

A package uniquely identified by name along with its source.

A git repo with a Forc.toml manifest at its root.

A pinned instance of a git source.

A pinned instance of a path source.

Error returned upon failed parsing of SourcePathPinned::from_str.

Error returned upon failed parsing of SourcePinned::from_str.

A package from the official registry.

A pinned instance of the registry source.

Enums

Used to distinguish between types of git references.

Specifies a base source for a package.

Error returned upon failed parsing of SourceGitPinned::from_str.

A pinned instance of the package source.

Constants

The suffix that helps identify the file which contains the hash of the binary file created when scripts are built.

The suffix that helps identify the file which contains the root hash of the binary file created when predicates are built.

Functions

Build an entire forc package and return the compiled output.

Builds a project with given BuildOptions

Compile the entire forc package and return a CompileAstResult.

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.

Compiles the given package.

Compiles the package to an AST.

Builds the dependency namespace for the package at the given node index within the graph.

Fetch the repo at the given git package’s URL and checkout the pinned commit.

Produce a unique ID for a particular fetch pass.

The same as find_within, but returns the package’s project directory.

Attempt to find a Forc.toml with the given project name within the given directory.

Format an error message if a given URL fails to produce a working node.

The path to which a git package commit should be checked out.

Format an error message for an absent Forc.toml.

Returns a parsed AST from the supplied ManifestFile

Format an error message for failed parsing of a manifest.

Pin the given git-sourced package.

Given a forc_pkg::BuildProfile, produce the necessary sway_core::BuildConfig required for compilation.

Format an error message if an incorrect program type is present.

Type Definitions

The name specified on the left hand side of the = in a depenedency declaration under [dependencies] within a forc manifest.