Skip to content

Commit

Permalink
[generator] Remove redundant mage targets in metricbeat generator mag…
Browse files Browse the repository at this point in the history
…efile (#13341)

* remove redundant mage targets in metricbeat generator
  • Loading branch information
fearful-symmetry authored Aug 28, 2019
1 parent 67fe9fd commit 3bb13a1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 49 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-developer.next.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ The list below covers the major changes between 7.0.0-rc2 and master only.
==== Breaking changes

- Move Fields from package libbeat/common to libbeat/mapping. {pull}11198[11198]
- For "metricbeat style" generated custom beats, the mage target `GoTestIntegration` has changed to `GoIntegTest` and `GoTestUnit` has changed to `GoUnitTest`. {pull}13341[13341]

==== Bugfixes

Expand Down
62 changes: 13 additions & 49 deletions generator/metricbeat/{beat}/magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
package main

import (
"context"
"fmt"
"time"

Expand All @@ -32,6 +31,16 @@ import (

// mage:import
_ "github.com/elastic/beats/dev-tools/mage/target/common"
// mage:import
"github.com/elastic/beats/dev-tools/mage/target/build"
// mage:import
"github.com/elastic/beats/dev-tools/mage/target/pkg"
// mage:import
_ "github.com/elastic/beats/dev-tools/mage/target/test"
// mage:import
_ "github.com/elastic/beats/dev-tools/mage/target/unittest"
// mage:import
_ "github.com/elastic/beats/dev-tools/mage/target/integtest"
)

func init() {
Expand All @@ -40,37 +49,11 @@ func init() {
devtools.BeatDescription = "One sentence description of the Beat."
}

//CollectAll generates the docs and the fields.
// CollectAll generates the docs and the fields.
func CollectAll() {
mg.Deps(CollectDocs, FieldsDocs)
}

// Build builds the Beat binary.
func Build() error {
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 devtools.GolangCrossBuild(devtools.DefaultGolangCrossBuildArgs())
}

// BuildGoDaemon builds the go-daemon binary (use crossBuildGoDaemon).
func BuildGoDaemon() error {
return devtools.BuildGoDaemon()
}

// CrossBuild cross-builds the beat for all target platforms.
func CrossBuild() error {
return devtools.CrossBuild()
}

// CrossBuildGoDaemon cross-builds the go-daemon binary using Docker.
func CrossBuildGoDaemon() error {
return devtools.CrossBuildGoDaemon()
}

// Package packages the Beat for distribution.
// Use SNAPSHOT=true to build snapshots.
// Use PLATFORMS to control the target platforms.
Expand All @@ -81,13 +64,8 @@ func Package() {
devtools.UseCommunityBeatPackaging()

mg.Deps(Update)
mg.Deps(CrossBuild, CrossBuildGoDaemon)
mg.SerialDeps(devtools.Package, TestPackages)
}

// TestPackages tests the generated packages (i.e. file modes, owners, groups).
func TestPackages() error {
return devtools.TestPackages()
mg.Deps(build.CrossBuild, build.CrossBuildGoDaemon)
mg.SerialDeps(devtools.Package, pkg.PackageTest)
}

// Update updates the generated files (aka make update).
Expand Down Expand Up @@ -118,20 +96,6 @@ func CollectDocs() error {
return metricbeat.CollectDocs()
}

// 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 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 devtools.GoTest(ctx, devtools.DefaultGoTestIntegrationArgs())
}

// Config generates both the short/reference/docker configs.
func Config() error {
customDeps := devtools.ConfigFileParams{
Expand Down

0 comments on commit 3bb13a1

Please sign in to comment.