Skip to content

grafana-plugin-sdk-go: Build also for FreeBSD #1348

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion build/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,16 @@ func (Build) DarwinARM64() error {
return buildBackend(newBuildConfig("darwin", "arm64"))
}

// FreeBSD builds the back-end plugin for FreeBSD on AMD64.
func (Build) FreeBSD() error {
return buildBackend(newBuildConfig("freebsd", "amd64"))
}

// FreeBSDARM64 builds the back-end plugin for FreeBSD on ARM64.
func (Build) FreeBSDARM64() error {
return buildBackend(newBuildConfig("freebsd", "arm"))
}

// Custom allows customizable back-end plugin builds for the provided os and arch.
// Note: Cutomized builds are not officially supported by Grafana, so this option is intended for developers who need
// to create their own custom build targets.
Expand Down Expand Up @@ -329,6 +339,20 @@ func (Build) DebugWindowsAMD64() error {
return buildBackend(cfg)
}

// DebugFreeBSDAMD64 builds the debug version targeted for FreeBSD on AMD64.
func (Build) DebugFreeBSDAMD64() error {
cfg := newBuildConfig("freebsd", "amd64")
cfg.EnableDebug = true
return buildBackend(cfg)
}

// DebugFreeBSDARM64 builds the debug version targeted for FreeBSD on ARM64.
func (Build) DebugFreeBSDARM64() error {
cfg := newBuildConfig("freebsd", "arm64")
cfg.EnableDebug = true
return buildBackend(cfg)
}

// Backend build a production build for the current platform
func (Build) Backend() error {
// The M1 platform detection is kinda flakey, so we will just build both
Expand All @@ -346,7 +370,8 @@ func (Build) Backend() error {
// BuildAll builds production executables for all supported platforms.
func BuildAll() { //revive:disable-line
b := Build{}
mg.Deps(b.Linux, b.Windows, b.Darwin, b.DarwinARM64, b.LinuxARM64, b.LinuxARM)
mg.Deps(b.Linux, b.Windows, b.Darwin, b.DarwinARM64, b.LinuxARM64, b.LinuxARM,
b.FreeBSD, b.FreeBSDARM64)
}

//go:embed tmpl/*
Expand Down