-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added magefile. Added version target for build flags and associated a…
…rgument
- Loading branch information
Bradley Hutchinson
committed
Nov 25, 2019
1 parent
83b7ef9
commit e56a60d
Showing
5 changed files
with
120 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// +build mage | ||
|
||
package main | ||
|
||
import ( | ||
"github.com/magefile/mage/sh" | ||
) | ||
|
||
var Default = Install | ||
|
||
func Build() error { | ||
return sh.Run("go", "build", ".") | ||
} | ||
|
||
func BuildWindows() error { | ||
env := map[string]string{"GOOS": "windows", "GOARCH": "amd64"} | ||
return sh.RunWith(env, "go", "build", ".") | ||
} | ||
|
||
func Install() error { | ||
version, err := sh.Output("git", "describe", "--always", "--long", "--dirty") | ||
if err != nil { | ||
return err | ||
} | ||
return sh.Run("go", "install", "-v", "-ldflags", "-X main.version="+version, ".") | ||
} | ||
|
||
func Test() error { | ||
return sh.RunV("go", "test", "-v") | ||
} | ||
|
||
func Clean() { | ||
sh.Rm("sclipi") | ||
sh.Rm("sclipi.exe") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters