1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-04 03:11:55 +02:00
goreleaser/pkg/build/build.go
Carlos Alexandro Becker d583861e06
feat(build): add GO386, GOMIPS64, GORISCV64, and GOPPC64 support (#5186)
continuing the work of #5153

closes #5153

---------

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Co-authored-by: 世界 <i@sekai.icu>
2024-10-14 09:40:10 -03:00

51 lines
1.0 KiB
Go

// Package build provides the API for external builders
package build
import (
"sync"
"github.com/goreleaser/goreleaser/v2/pkg/config"
"github.com/goreleaser/goreleaser/v2/pkg/context"
)
//nolint:gochecknoglobals
var (
builders = map[string]Builder{}
lock sync.Mutex
)
// Register registers a builder to a given name.
func Register(name string, builder Builder) {
lock.Lock()
builders[name] = builder
lock.Unlock()
}
// For gets the previously registered builder for the given name.
func For(name string) Builder {
return builders[name]
}
// Options to be passed down to a builder.
type Options struct {
Name string
Path string
Ext string
Target string
Goos string
Goarch string
Goamd64 string
Go386 string
Goarm string
Goarm64 string
Gomips string
Goppc64 string
Goriscv64 string
}
// Builder defines a builder.
type Builder interface {
WithDefaults(build config.Build) (config.Build, error)
Build(ctx *context.Context, build config.Build, options Options) error
}