Documentation
¶
Overview ¶
Package dependency provides dependency management for proto files.
Package dependency provides dependency management for proto files.
Index ¶
- type Dependency
- type DependencySource
- type DownloadResult
- type Downloader
- type InstallOptions
- type LockFile
- type LockedDependency
- type Manager
- func (m *Manager) GetProtoPaths() []string
- func (m *Manager) Install(ctx context.Context, dep Dependency, opts InstallOptions) (*DownloadResult, error)
- func (m *Manager) InstallAll(ctx context.Context, deps []Dependency, opts InstallOptions) ([]*DownloadResult, error)
- func (m *Manager) List() []LockedDependency
- func (m *Manager) Remove(name string) error
- func (m *Manager) Update(ctx context.Context, name string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dependency ¶
type Dependency struct {
// Name is the dependency name (e.g., "googleapis", "protoc-gen-validate")
Name string `json:"name" yaml:"name"`
// Source is where to get the dependency
Source DependencySource `json:"source" yaml:"source"`
// Version constraint (e.g., "v1.2.3", ">=1.0.0", "main", "master")
Version string `json:"version" yaml:"version"`
// SubPath is the path within the repo to proto files (optional)
SubPath string `json:"sub_path,omitempty" yaml:"sub_path,omitempty"`
// Includes are specific proto files to include (optional, default: all)
Includes []string `json:"includes,omitempty" yaml:"includes,omitempty"`
// Excludes are patterns to exclude
Excludes []string `json:"excludes,omitempty" yaml:"excludes,omitempty"`
}
Dependency represents a proto dependency.
type DependencySource ¶
type DependencySource struct {
// Type: "git", "url", "local"
Type string `json:"type" yaml:"type"`
// URL for git or http sources
URL string `json:"url,omitempty" yaml:"url,omitempty"`
// Path for local sources
Path string `json:"path,omitempty" yaml:"path,omitempty"`
// Ref for git (branch, tag, commit)
Ref string `json:"ref,omitempty" yaml:"ref,omitempty"`
}
DependencySource represents where to get the dependency.
type DownloadResult ¶
type DownloadResult struct {
Name string
Version string
LocalPath string
ProtoPath string // Path to add to proto_path
Hash string
Error error
}
DownloadResult contains information about downloaded dependency.
type Downloader ¶
type Downloader struct {
// contains filtered or unexported fields
}
Downloader handles downloading dependencies from various sources.
func NewDownloader ¶
func NewDownloader(targetDir string, log *logger.Logger) *Downloader
NewDownloader creates a new downloader.
func (*Downloader) Download ¶
func (d *Downloader) Download(ctx context.Context, dep Dependency) (*DownloadResult, error)
Download downloads a dependency based on its source.
type InstallOptions ¶
type InstallOptions struct {
// Force reinstall even if already exists
Force bool
// Update to latest version
Update bool
// DryRun only shows what would be installed
DryRun bool
// Verbose output
Verbose bool
// WorkspaceDir is the buffalo workspace directory
WorkspaceDir string
}
InstallOptions configures dependency installation.
type LockFile ¶
type LockFile struct {
// Version of lock file format
Version string `json:"version" yaml:"version"`
// Generated timestamp
Generated time.Time `json:"generated" yaml:"generated"`
// Dependencies with resolved versions
Dependencies []LockedDependency `json:"dependencies" yaml:"dependencies"`
}
LockFile represents buffalo.lock file with pinned versions.
type LockedDependency ¶
type LockedDependency struct {
Name string `json:"name" yaml:"name"`
Version string `json:"version" yaml:"version"` // Exact version/commit
Source string `json:"source" yaml:"source"` // Full URL
Hash string `json:"hash" yaml:"hash"` // SHA256 of downloaded content
Updated time.Time `json:"updated" yaml:"updated"`
}
LockedDependency is a dependency with resolved version.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager handles proto dependencies.
func NewManager ¶
NewManager creates a new dependency manager.
func (*Manager) GetProtoPaths ¶
GetProtoPaths returns all proto paths from dependencies.
func (*Manager) Install ¶
func (m *Manager) Install(ctx context.Context, dep Dependency, opts InstallOptions) (*DownloadResult, error)
Install installs a dependency.
func (*Manager) InstallAll ¶
func (m *Manager) InstallAll(ctx context.Context, deps []Dependency, opts InstallOptions) ([]*DownloadResult, error)
InstallAll installs all dependencies from config.
func (*Manager) List ¶
func (m *Manager) List() []LockedDependency
List lists all installed dependencies.