Documentation
¶
Overview ¶
Package rust implements omnibump support for Rust projects. Ported from cargobump with enhancements for the unified omnibump architecture.
Package rust implements omnibump support for Rust projects. Ported from cargobump with enhancements for the unified omnibump architecture.
Package rust implements omnibump support for Rust projects. Ported from cargobump with enhancements for the unified omnibump architecture.
Index ¶
- Variables
- func CargoUpdate(ctx context.Context, cargoRoot string) (string, error)
- func CargoUpdatePackage(ctx context.Context, name, oldVersion, newVersion, cargoRoot string) (string, error)
- func DoUpdate(ctx context.Context, packages map[string]*Package, ...) error
- func GetCargoLockPath(cargoRoot string) (string, error)
- func ParseBumpFile(r io.Reader) (map[string]*Package, error)
- type CargoPackage
- type Lockfile
- type Package
- type PackageList
- type Rust
- func (r *Rust) Detect(ctx context.Context, dir string) (bool, error)
- func (r *Rust) GetManifestFiles() []string
- func (r *Rust) Name() string
- func (r *Rust) SupportsAnalysis() bool
- func (r *Rust) Update(ctx context.Context, cfg *languages.UpdateConfig) error
- func (r *Rust) Validate(ctx context.Context, cfg *languages.UpdateConfig) error
- type RustAnalyzer
- func (ra *RustAnalyzer) Analyze(ctx context.Context, projectPath string) (*analyzer.AnalysisResult, error)
- func (ra *RustAnalyzer) AnalyzeRemote(ctx context.Context, files map[string][]byte) (*analyzer.RemoteAnalysisResult, error)
- func (ra *RustAnalyzer) RecommendStrategy(ctx context.Context, analysis *analyzer.AnalysisResult, ...) (*analyzer.Strategy, error)
- type UpdateConfig
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidCrateName is returned when a crate name is invalid. ErrInvalidCrateName = errors.New("invalid crate name") // ErrInvalidVersion is returned when a version string is invalid. ErrInvalidVersion = errors.New("invalid version string") )
var ( // ErrCargoLockNotFound is returned when Cargo.lock is not found. ErrCargoLockNotFound = errors.New("cargo.lock not found") // ErrRemoteAnalysisNotImplemented is returned when remote analysis is not implemented. ErrRemoteAnalysisNotImplemented = errors.New("remote analysis not yet implemented") )
var ErrAmbiguousTarget = errors.New("crate resolves to multiple versions")
ErrAmbiguousTarget is returned when a bare crate name resolves to multiple present versions, so the caller must pin one explicitly as name@<version>.
var ErrInvalidPackageSpec = errors.New("invalid package spec")
ErrInvalidPackageSpec is returned when a package spec is missing required fields.
var ErrNoCompatibleVersion = errors.New("no compatible version can be upgraded to")
ErrNoCompatibleVersion is returned when a crate is pinned below the requested floor by a dependent's caret constraint and so cannot be upgraded to a compatible version. This is a genuine failure: omnibump must not silently pass.
Functions ¶
func CargoUpdate ¶
CargoUpdate runs 'cargo update' to refresh the Cargo.lock file. Ported from cargobump/pkg/run/cargo.go.
func CargoUpdatePackage ¶
func CargoUpdatePackage(ctx context.Context, name, oldVersion, newVersion, cargoRoot string) (string, error)
CargoUpdatePackage updates a specific package to a precise version. Uses: cargo update --precise <newVersion> --package <name>@<oldVersion> Ported from cargobump/pkg/run/cargo.go.
func DoUpdate ¶
func DoUpdate(ctx context.Context, packages map[string]*Package, cargoPackages []CargoPackage, cfg *UpdateConfig) error
DoUpdate performs the actual update of Rust package dependencies. Ported from cargobump/pkg/update.go.
func GetCargoLockPath ¶ added in v0.17.0
GetCargoLockPath returns the path to Cargo.lock in the given cargo root directory.
Types ¶
type CargoPackage ¶
CargoPackage represents a package from Cargo.lock.
func GetCurrentPackages ¶ added in v0.17.0
func GetCurrentPackages(ctx context.Context, cargoRoot string) ([]CargoPackage, error)
GetCurrentPackages parses Cargo.lock to get the current packages.
func ParseCargoLock ¶
func ParseCargoLock(r io.Reader) ([]CargoPackage, error)
ParseCargoLock parses a Cargo.lock file and returns the list of packages.
type Lockfile ¶
type Lockfile struct {
Packages []cargoLockPackage `toml:"package"`
}
Lockfile represents a Cargo.lock file structure. Based on https://doc.rust-lang.org/cargo/reference/manifest.html
type PackageList ¶
type PackageList struct {
Packages []Package `json:"packages" yaml:"packages"`
}
PackageList is used to marshal from yaml/json file to get the list of packages.
type Rust ¶
type Rust struct{}
Rust implements the Language interface for Rust projects.
func (*Rust) GetManifestFiles ¶
GetManifestFiles returns Rust manifest files.
func (*Rust) SupportsAnalysis ¶
SupportsAnalysis returns true since Rust now has analysis capabilities.
type RustAnalyzer ¶
type RustAnalyzer struct{}
RustAnalyzer implements the Analyzer interface for Rust projects.
func (*RustAnalyzer) Analyze ¶
func (ra *RustAnalyzer) Analyze(ctx context.Context, projectPath string) (*analyzer.AnalysisResult, error)
Analyze performs dependency analysis on a Rust project.
func (*RustAnalyzer) AnalyzeRemote ¶
func (ra *RustAnalyzer) AnalyzeRemote(ctx context.Context, files map[string][]byte) (*analyzer.RemoteAnalysisResult, error)
AnalyzeRemote performs dependency analysis on remotely-fetched Rust files. Not yet implemented for Rust - returns error. TODO: Implement this function and use ctx for logging and files for analysis.
func (*RustAnalyzer) RecommendStrategy ¶
func (ra *RustAnalyzer) RecommendStrategy(ctx context.Context, analysis *analyzer.AnalysisResult, deps []analyzer.Dependency) (*analyzer.Strategy, error)
RecommendStrategy suggests update strategy for Rust dependencies. For Rust, updates are always direct using cargo update.
type UpdateConfig ¶
type UpdateConfig struct {
CargoRoot string
Update bool // Run 'cargo update' before updating packages
ShowDiff bool
}
UpdateConfig holds configuration for Rust project updates.