Map CLI profiles to selected modules
This commit is contained in:
@@ -2,8 +2,12 @@ package releasekit
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"strings"
|
||||
|
||||
internalpreparation "gitea.maximumdirect.net/eric/ReleaseKit/internal/preparation"
|
||||
"gitea.maximumdirect.net/eric/ReleaseKit/internal/releaseidentity"
|
||||
)
|
||||
|
||||
// TaggedCheckoutRequest selects a stable tag and the full Git object ID
|
||||
@@ -29,12 +33,28 @@ func PrepareTaggedCheckout(ctx context.Context, request TaggedCheckoutRequest) e
|
||||
})
|
||||
}
|
||||
|
||||
// PrepareBuildDependencies runs `go mod download` in repositoryDir with
|
||||
// DependencyPreparationRequest selects the repository module whose dependencies
|
||||
// should be prepared.
|
||||
type DependencyPreparationRequest struct {
|
||||
RepositoryDir string
|
||||
// ModuleDir selects a repository-relative module directory; empty selects
|
||||
// the repository root.
|
||||
ModuleDir string
|
||||
}
|
||||
|
||||
// PrepareBuildDependencies runs `go mod download` in the selected module with
|
||||
// workspace discovery disabled and the locally available compatible Go
|
||||
// toolchain selected. It may access module networks and updates the Go module
|
||||
// cache using the caller's Go proxy, private-module, credential, and cache
|
||||
// settings. If required checksums are missing, the Go command may update
|
||||
// go.sum. Cancellation and Go command failures are returned to the caller.
|
||||
func PrepareBuildDependencies(ctx context.Context, repositoryDir string) error {
|
||||
return internalpreparation.PrepareBuildDependencies(ctx, repositoryDir)
|
||||
func PrepareBuildDependencies(ctx context.Context, request DependencyPreparationRequest) error {
|
||||
if strings.TrimSpace(request.RepositoryDir) == "" {
|
||||
return errors.New("repository directory is required")
|
||||
}
|
||||
selection, err := releaseidentity.ResolveSelection(request.RepositoryDir, request.ModuleDir)
|
||||
if err != nil {
|
||||
return fmt.Errorf("resolve dependency preparation module: %w", err)
|
||||
}
|
||||
return internalpreparation.PrepareBuildDependencies(ctx, selection.ModuleDir)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user