mirror of
https://github.com/openlibrecommunity/olcrtc.git
synced 2026-05-26 07:08:11 +00:00
fix(ci): remove variadic arg from Cross target
mage does not support variadic function parameters as targets, causing 'Unknown target specified: cross' in CI.
This commit is contained in:
30
magefile.go
30
magefile.go
@@ -39,13 +39,11 @@ func BuildCLI() error {
|
|||||||
return buildBinary("olcrtc", "./cmd/olcrtc", goos, goarch)
|
return buildBinary("olcrtc", "./cmd/olcrtc", goos, goarch)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cross builds olcrtc for specified platforms or all if none specified.
|
// Cross builds olcrtc for all supported platforms.
|
||||||
// Usage: mage cross [platforms...]
|
func Cross() error {
|
||||||
// Example: mage cross linux/amd64 windows/amd64
|
|
||||||
func Cross(platforms ...string) error {
|
|
||||||
mg.Deps(Deps)
|
mg.Deps(Deps)
|
||||||
|
|
||||||
allTargets := []struct{ os, arch string }{
|
targets := []struct{ os, arch string }{
|
||||||
{"linux", "amd64"},
|
{"linux", "amd64"},
|
||||||
{"linux", "arm64"},
|
{"linux", "arm64"},
|
||||||
{"windows", "amd64"},
|
{"windows", "amd64"},
|
||||||
@@ -57,28 +55,6 @@ func Cross(platforms ...string) error {
|
|||||||
{"openbsd", "arm64"},
|
{"openbsd", "arm64"},
|
||||||
}
|
}
|
||||||
|
|
||||||
var targets []struct{ os, arch string }
|
|
||||||
|
|
||||||
if len(platforms) == 0 {
|
|
||||||
targets = allTargets
|
|
||||||
} else {
|
|
||||||
wanted := make(map[string]bool)
|
|
||||||
for _, p := range platforms {
|
|
||||||
wanted[p] = true
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, t := range allTargets {
|
|
||||||
key := t.os + "/" + t.arch
|
|
||||||
if wanted[key] {
|
|
||||||
targets = append(targets, t)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(targets) == 0 {
|
|
||||||
return fmt.Errorf("no valid platforms specified. Available: linux/amd64, linux/arm64, windows/amd64, darwin/amd64, darwin/arm64, freebsd/amd64, freebsd/arm64, openbsd/amd64, openbsd/arm64")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, t := range targets {
|
for _, t := range targets {
|
||||||
if err := buildBinary("olcrtc", "./cmd/olcrtc", t.os, t.arch); err != nil {
|
if err := buildBinary("olcrtc", "./cmd/olcrtc", t.os, t.arch); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
Reference in New Issue
Block a user