build

package
v0.227.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 24 Imported by: 3

README

Reusable Mage build tools

This package includes standard mage targets useful in the build.

See: https://magefile.org/magefiles/.

These targets can be used in your plugin project by creating Magefile.go in the root of your project like the following:

//+build mage

package main

import (
	// mage:import
	build "github.com/grafana/grafana-plugin-sdk-go/build"
)

// Default configures the default target.
var Default = build.BuildAll

https://magefile.org/importing/

Documentation

Overview

Package build includes standard mage targets useful when building plugins.

Index

Constants

This section is empty.

Variables

View Source
var GetBuildInfo = InfoGetterFunc(func() (Info, error) {
	v := Info{}
	if buildInfoJSON == "" {
		return v, fmt.Errorf("build info was now set when this was compiled")
	}
	err := json.Unmarshal([]byte(buildInfoJSON), &v)
	return v, err
})

GetBuildInfo is the default InfoGetter that returns the build information that was compiled into the binary using: -X `github.com/grafana/grafana-plugin-sdk-go/build.buildInfoJSON={...}`

Functions

func BuildAll

func BuildAll()

BuildAll builds production executables for all supported platforms.

func Clean

func Clean() error

Clean cleans build artifacts, by deleting the dist directory.

func Coverage

func Coverage() error

Coverage runs backend tests and makes a coverage report.

func Debugger

func Debugger() error

Debugger makes a new debug build, re-launches the plugin and attaches the Delve debugger, in headless mode listening on port 3222.

The plugin process is killed after re-building, in order to make Grafana launch the new version. Once the new version is up, we attach to it with Delve.

func Format

func Format() error

Format formats the sources.

func Lint

func Lint() error

Lint audits the source style

func ReloadPlugin added in v0.37.0

func ReloadPlugin() error

ReloadPlugin - kills any running instances and waits for grafana to reload the plugin

func SetBeforeBuildCallback added in v0.64.0

func SetBeforeBuildCallback(cb BeforeBuildCallback) error

SetBeforeBuildCallback configures a custom callback

func Test

func Test() error

Test runs backend tests.

func Watch added in v0.143.0

func Watch() error

Watch rebuilds the plugin backend debug version when files change.

Types

type BeforeBuildCallback added in v0.64.0

type BeforeBuildCallback func(cfg Config) (Config, error)

BeforeBuildCallback hooks into the build process

type Build

type Build mg.Namespace

Build is a namespace.

func (Build) Backend

func (Build) Backend() error

Backend build a production build for the current platform

func (Build) Darwin

func (Build) Darwin() error

Darwin builds the back-end plugin for OSX on AMD64.

func (Build) DarwinARM64 added in v0.89.0

func (Build) DarwinARM64() error

DarwinARM64 builds the back-end plugin for OSX on ARM (M1/M2).

func (Build) Debug

func (Build) Debug() error

Debug builds the debug version for the current platform.

func (Build) DebugDarwinAMD64 added in v0.212.0

func (Build) DebugDarwinAMD64() error

DebugDarwinAMD64 builds the debug version targeted for OSX on AMD64.

func (Build) DebugDarwinARM64 added in v0.212.0

func (Build) DebugDarwinARM64() error

DebugDarwinARM64 builds the debug version targeted for OSX on ARM (M1/M2).

func (Build) DebugLinuxAMD64 added in v0.212.0

func (Build) DebugLinuxAMD64() error

DebugLinuxAMD64 builds the debug version targeted for linux on AMD64.

func (Build) DebugLinuxARM64 added in v0.212.0

func (Build) DebugLinuxARM64() error

DebugLinuxARM64 builds the debug version targeted for linux on ARM64.

func (Build) DebugWindowsAMD64 added in v0.212.0

func (Build) DebugWindowsAMD64() error

DebugWindowsAMD64 builds the debug version targeted for windows on AMD64.

func (Build) GenerateManifestFile added in v0.150.0

func (Build) GenerateManifestFile() error

GenerateManifestFile generates a manifest file for plugin submissions

func (Build) Linux

func (Build) Linux() error

Linux builds the back-end plugin for Linux.

func (Build) LinuxARM added in v0.78.0

func (Build) LinuxARM() error

LinuxARM builds the back-end plugin for Linux on ARM.

func (Build) LinuxARM64 added in v0.77.0

func (Build) LinuxARM64() error

LinuxARM64 builds the back-end plugin for Linux on ARM64.

func (Build) Windows

func (Build) Windows() error

Windows builds the back-end plugin for Windows.

type Config added in v0.64.0

type Config struct {
	OS               string // GOOS
	Arch             string // GOOS
	EnableDebug      bool
	CustomVars       map[string]string
	Env              map[string]string
	EnableCGo        bool
	RootPackagePath  string
	OutputBinaryPath string
	PluginJSONPath   string
}

Config holds the setup variables required for a build

type E2E added in v0.127.0

type E2E mg.Namespace

E2E is a namespace.

func (E2E) Append added in v0.127.0

func (E2E) Append() error

Append starts the E2E proxy in append mode.

func (E2E) Certificate added in v0.127.0

func (E2E) Certificate() error

Certificate prints the CA certificate to stdout.

func (E2E) Overwrite added in v0.127.0

func (E2E) Overwrite() error

Overwrite starts the E2E proxy in overwrite mode.

func (E2E) Replay added in v0.127.0

func (E2E) Replay() error

Replay starts the E2E proxy in replay mode.

type Info added in v0.93.0

type Info struct {
	Time     int64  `json:"time,omitempty"`
	PluginID string `json:"pluginID,omitempty"`
	Version  string `json:"version,omitempty"`
	Repo     string `json:"repo,omitempty"`
	Branch   string `json:"branch,omitempty"`
	Hash     string `json:"hash,omitempty"`
	Build    int64  `json:"build,omitempty"`
	PR       int64  `json:"pr,omitempty"`
}

Info See also PluginBuildInfo in https://github.com/grafana/grafana/blob/master/pkg/plugins/models.go

type InfoGetter added in v0.192.0

type InfoGetter interface {
	// GetInfo returns the build info.
	GetInfo() (Info, error)
}

InfoGetter is an interface with a method for returning the build info.

type InfoGetterFunc added in v0.192.0

type InfoGetterFunc func() (Info, error)

InfoGetterFunc can be used to adapt ordinary functions into types satisfying the InfoGetter interface .

func (InfoGetterFunc) GetInfo added in v0.192.0

func (f InfoGetterFunc) GetInfo() (Info, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL