Update magefile
This commit is contained in:
parent
97a5b11407
commit
7357b0f489
35
magefile.go
35
magefile.go
|
@ -27,44 +27,44 @@ import (
|
|||
"github.com/magefile/mage/mg"
|
||||
"github.com/magefile/mage/sh"
|
||||
|
||||
"github.com/elastic/beats/dev-tools/mage"
|
||||
devtools "github.com/elastic/beats/dev-tools/mage"
|
||||
)
|
||||
|
||||
func init() {
|
||||
mage.SetBuildVariableSources(mage.DefaultBeatBuildVariableSources)
|
||||
devtools.SetBuildVariableSources(devtools.DefaultBeatBuildVariableSources)
|
||||
|
||||
mage.BeatDescription = "One sentence description of the Beat."
|
||||
devtools.BeatDescription = "One sentence description of the Beat."
|
||||
}
|
||||
|
||||
// Build builds the Beat binary.
|
||||
func Build() error {
|
||||
return mage.Build(mage.DefaultBuildArgs())
|
||||
return devtools.Build(devtools.DefaultBuildArgs())
|
||||
}
|
||||
|
||||
// GolangCrossBuild build the Beat binary inside of the golang-builder.
|
||||
// Do not use directly, use crossBuild instead.
|
||||
func GolangCrossBuild() error {
|
||||
return mage.GolangCrossBuild(mage.DefaultGolangCrossBuildArgs())
|
||||
return devtools.GolangCrossBuild(devtools.DefaultGolangCrossBuildArgs())
|
||||
}
|
||||
|
||||
// BuildGoDaemon builds the go-daemon binary (use crossBuildGoDaemon).
|
||||
func BuildGoDaemon() error {
|
||||
return mage.BuildGoDaemon()
|
||||
return devtools.BuildGoDaemon()
|
||||
}
|
||||
|
||||
// CrossBuild cross-builds the beat for all target platforms.
|
||||
func CrossBuild() error {
|
||||
return mage.CrossBuild()
|
||||
return devtools.CrossBuild()
|
||||
}
|
||||
|
||||
// CrossBuildGoDaemon cross-builds the go-daemon binary using Docker.
|
||||
func CrossBuildGoDaemon() error {
|
||||
return mage.CrossBuildGoDaemon()
|
||||
return devtools.CrossBuildGoDaemon()
|
||||
}
|
||||
|
||||
// Clean cleans all generated files and build artifacts.
|
||||
func Clean() error {
|
||||
return mage.Clean()
|
||||
return devtools.Clean()
|
||||
}
|
||||
|
||||
// Package packages the Beat for distribution.
|
||||
|
@ -74,16 +74,16 @@ func Package() {
|
|||
start := time.Now()
|
||||
defer func() { fmt.Println("package ran for", time.Since(start)) }()
|
||||
|
||||
mage.UseCommunityBeatPackaging()
|
||||
devtools.UseCommunityBeatPackaging()
|
||||
|
||||
mg.Deps(Update)
|
||||
mg.Deps(CrossBuild, CrossBuildGoDaemon)
|
||||
mg.SerialDeps(mage.Package, TestPackages)
|
||||
mg.SerialDeps(devtools.Package, TestPackages)
|
||||
}
|
||||
|
||||
// TestPackages tests the generated packages (i.e. file modes, owners, groups).
|
||||
func TestPackages() error {
|
||||
return mage.TestPackages()
|
||||
return devtools.TestPackages()
|
||||
}
|
||||
|
||||
// Update updates the generated files (aka make update).
|
||||
|
@ -93,19 +93,24 @@ func Update() error {
|
|||
|
||||
// Fields generates a fields.yml for the Beat.
|
||||
func Fields() error {
|
||||
return mage.GenerateFieldsYAML()
|
||||
return devtools.GenerateFieldsYAML()
|
||||
}
|
||||
|
||||
// GoTestUnit executes the Go unit tests.
|
||||
// Use TEST_COVERAGE=true to enable code coverage profiling.
|
||||
// Use RACE_DETECTOR=true to enable the race detector.
|
||||
func GoTestUnit(ctx context.Context) error {
|
||||
return mage.GoTest(ctx, mage.DefaultGoTestUnitArgs())
|
||||
return devtools.GoTest(ctx, devtools.DefaultGoTestUnitArgs())
|
||||
}
|
||||
|
||||
// GoTestIntegration executes the Go integration tests.
|
||||
// Use TEST_COVERAGE=true to enable code coverage profiling.
|
||||
// Use RACE_DETECTOR=true to enable the race detector.
|
||||
func GoTestIntegration(ctx context.Context) error {
|
||||
return mage.GoTest(ctx, mage.DefaultGoTestIntegrationArgs())
|
||||
return devtools.GoTest(ctx, devtools.DefaultGoTestIntegrationArgs())
|
||||
}
|
||||
|
||||
// Config generates both the short/reference/docker configs.
|
||||
func Config() error {
|
||||
return devtools.Config(devtools.AllConfigTypes, devtools.ConfigFileParams{}, ".")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue