Skip to main content

Module pack

Module pack 

Source
Expand description

Producing the two files a plugin release carries.

This is the mirror image of crate::install: instead of turning a published crate into a cdylib on the user’s machine, it turns a checkout into the assets that let crate::install::prebuilt skip the build entirely.

{crate}-{version}-{target}.{so|dylib|dll}   <-- the cdylib
{crate}-{version}-{target}.toml             <-- the plugin manifest, verbatim

§Why these names

crate::install::prebuilt builds its download URL by putting these two names after .../releases/download/v{version}/. Producing and consuming are one convention: change either side alone and every release silently falls back to building from source. Nothing here may be renamed without renaming it there too.

§What it does

  1. cargo metadata the plugin’s manifest, for the crate name and version.
  2. Check that the plugin manifest beside it declares the same version — a manifest that lags behind Cargo.toml would publish assets nobody can consume.
  3. Generate the wrapper — the same one crate::install builds, coming from the private wrapper module — with the plugin as a path dependency, and cargo build --release --target <triple> it.
  4. Copy the cdylib and the plugin manifest into the output directory under the names above, and — when the build target is this machine — dlopen the result to prove it really exports the entry symbol.

A failed build leaves the generated wrapper in the temp directory, which is where someone looks to see why; a successful one removes it again.

Structs§

PackOptions
Options for build.
PackedAssets
The two files that were written.

Functions§

build
Builds a plugin checkout into the two files a release carries.