mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-10 03:47:03 +02:00
64b1f14a86
* refactor: merging archive in the same repo * refactor: merging archive in the same repo * refactor: better organizing packages * refactor: fixing renames * fix: new dep version * fix: makefile * fix: zip/tar tests * fix: gitigonore * fix: s3 tests * fix: archive test
38 lines
798 B
Go
38 lines
798 B
Go
// Package build provides the API for external builders
|
|
package build
|
|
|
|
import (
|
|
"sync"
|
|
|
|
"github.com/goreleaser/goreleaser/pkg/config"
|
|
"github.com/goreleaser/goreleaser/pkg/context"
|
|
)
|
|
|
|
var (
|
|
builders = map[string]Builder{}
|
|
lock sync.Mutex
|
|
)
|
|
|
|
// Register registers a builder to a given lang
|
|
func Register(lang string, builder Builder) {
|
|
lock.Lock()
|
|
builders[lang] = builder
|
|
lock.Unlock()
|
|
}
|
|
|
|
// For gets the previously registered builder for the given lang
|
|
func For(lang string) Builder {
|
|
return builders[lang]
|
|
}
|
|
|
|
// Options to be passed down to a builder
|
|
type Options struct {
|
|
Name, Path, Ext, Target string
|
|
}
|
|
|
|
// Builder defines a builder
|
|
type Builder interface {
|
|
WithDefaults(build config.Build) config.Build
|
|
Build(ctx *context.Context, build config.Build, options Options) error
|
|
}
|