pub struct BundleBuilder { /* private fields */ }Expand description
Builder for creating plugin bundles.
§Example
use rustbridge_bundle::{BundleBuilder, Manifest, Platform};
let manifest = Manifest::new("my-plugin", "1.0.0");
let builder = BundleBuilder::new(manifest)
.add_library(Platform::LinuxX86_64, "target/release/libmyplugin.so")?
.add_schema_file("schema/messages.h", "include/messages.h")?;
builder.write("my-plugin-1.0.0.rbp")?;Implementations§
Source§impl BundleBuilder
impl BundleBuilder
Sourcepub fn with_signing_key(
self,
public_key_base64: String,
secret_key: SecretKey,
) -> Self
pub fn with_signing_key( self, public_key_base64: String, secret_key: SecretKey, ) -> Self
Set the signing key for bundle signing.
The secret key will be used to sign all library files and the manifest. The corresponding public key will be embedded in the manifest.
§Arguments
public_key_base64- The public key in base64 format (from the .pub file)secret_key- The secret key for signing
Sourcepub fn add_library<P: AsRef<Path>>(
self,
platform: Platform,
library_path: P,
) -> BundleResult<Self>
pub fn add_library<P: AsRef<Path>>( self, platform: Platform, library_path: P, ) -> BundleResult<Self>
Add a platform-specific library to the bundle as the release variant.
This reads the library file, computes its SHA256 checksum, and updates the manifest with the platform information.
This is a convenience method that adds the library as the release variant.
For other variants, use add_library_variant instead.
Sourcepub fn add_library_variant<P: AsRef<Path>>(
self,
platform: Platform,
variant: &str,
library_path: P,
) -> BundleResult<Self>
pub fn add_library_variant<P: AsRef<Path>>( self, platform: Platform, variant: &str, library_path: P, ) -> BundleResult<Self>
Add a variant-specific library to the bundle.
This reads the library file, computes its SHA256 checksum, and updates the manifest with the platform and variant information.
§Arguments
platform- Target platformvariant- Variant name (e.g., “release”, “debug”)library_path- Path to the library file
Sourcepub fn add_library_variant_with_build<P: AsRef<Path>>(
self,
platform: Platform,
variant: &str,
library_path: P,
build: Value,
) -> BundleResult<Self>
pub fn add_library_variant_with_build<P: AsRef<Path>>( self, platform: Platform, variant: &str, library_path: P, build: Value, ) -> BundleResult<Self>
Add a variant-specific library with build metadata.
Similar to add_library_variant but also attaches build metadata
to the variant (e.g., compiler flags, features, etc.).
Sourcepub fn add_schema_file<P: AsRef<Path>>(
self,
source_path: P,
archive_name: &str,
) -> BundleResult<Self>
pub fn add_schema_file<P: AsRef<Path>>( self, source_path: P, archive_name: &str, ) -> BundleResult<Self>
Add a schema file to the bundle.
Schema files are stored in the schema/ directory within the bundle.
The schema format is automatically detected from the file extension:
.h-> “c-header”.json-> “json-schema”- Others -> “unknown”
Sourcepub fn add_doc_file<P: AsRef<Path>>(
self,
source_path: P,
archive_name: &str,
) -> BundleResult<Self>
pub fn add_doc_file<P: AsRef<Path>>( self, source_path: P, archive_name: &str, ) -> BundleResult<Self>
Add a documentation file to the bundle.
Documentation files are stored in the docs/ directory within the bundle.
Sourcepub fn add_bytes(self, archive_path: &str, contents: Vec<u8>) -> Self
pub fn add_bytes(self, archive_path: &str, contents: Vec<u8>) -> Self
Add raw bytes as a file in the bundle.
Sourcepub fn with_build_info(self, build_info: BuildInfo) -> Self
pub fn with_build_info(self, build_info: BuildInfo) -> Self
Set the build information for the bundle.
Sourcepub fn add_notices_file<P: AsRef<Path>>(
self,
source_path: P,
) -> BundleResult<Self>
pub fn add_notices_file<P: AsRef<Path>>( self, source_path: P, ) -> BundleResult<Self>
Add a notices file to the bundle.
The file will be stored in the docs/ directory.
Sourcepub fn add_license_file<P: AsRef<Path>>(
self,
source_path: P,
) -> BundleResult<Self>
pub fn add_license_file<P: AsRef<Path>>( self, source_path: P, ) -> BundleResult<Self>
Add the plugin’s license file to the bundle.
The file will be stored in the legal/ directory as LICENSE.
This is for the plugin’s own license, not third-party notices.
Sourcepub fn add_sbom_file<P: AsRef<Path>>(
self,
source_path: P,
archive_name: &str,
) -> BundleResult<Self>
pub fn add_sbom_file<P: AsRef<Path>>( self, source_path: P, archive_name: &str, ) -> BundleResult<Self>
Add an SBOM file to the bundle.
The file will be stored in the sbom/ directory.
Sourcepub fn write<P: AsRef<Path>>(self, output_path: P) -> BundleResult<()>
pub fn write<P: AsRef<Path>>(self, output_path: P) -> BundleResult<()>
Write the bundle to a file.
Sourcepub fn manifest_mut(&mut self) -> &mut Manifest
pub fn manifest_mut(&mut self) -> &mut Manifest
Get a mutable reference to the manifest (for modification).