diff --git a/mage_helpers/build.go b/mage_helpers/build.go index 4ce7219116da0bbe8686c6d9c5a6681981171d56..9d85d34c5b34cca5f81f95a11f71e649035db427 100644 --- a/mage_helpers/build.go +++ b/mage_helpers/build.go @@ -59,7 +59,7 @@ func Build(dir string, module string, isDebug bool) error { } // Copy shared files - sharedDir := currentDir+"/core/utils" + sharedDir := currentDir + "/core/utils" _, err = os.Stat(sharedDir) if err == nil { err = copyFilesToBuildDir(sharedDir, outputDir) @@ -111,6 +111,32 @@ func BuildGolangApp(outputDir string, appPath string, module string, isDebug boo return nil } +func BuildGolangAppWindows(outputDir string, appPath string, module string, isDebug bool) error { + commandArgs := []string{ + `build`, + fmt.Sprintf(`-ldflags=-X %v/globals.BuildVersion=%v -X %v/globals.OSType=%v -X %v/globals.IsDebugBuild=%v`, module, CurrentCommit(), module, runtime.GOOS, module, isDebug), + } + + if isDebug { + commandArgs = append(commandArgs, "-gcflags", "all=-N -l") + } + + commandArgs = append(commandArgs, `-o`, + outputDir, + appPath) + + env := map[string]string{ + "GOOS": "windows", + "GOARCH": "amd64", + } + + err := sh.RunWith(env, "go", commandArgs...) + if err != nil { + return err + } + return nil +} + func BuildMJML(filename string) error { // Get the full path to the file currentDir, _ := os.Getwd()