Ejemplo n.º 1
0
// xcPlat: Cross compile for a particular platform
// 0.3.0 - breaking change - changed 'call []string' to 'workingDirectory string'.
func xcPlat(dest platforms.Platform, tp TaskParams, exeName string, packagePath string) (string, error) {
	log.Printf("building %s for platform %v.", exeName, dest)
	args := []string{}
	absoluteBin, err := core.GetAbsoluteBin(dest.Os, dest.Arch, tp.Settings.AppName, exeName, tp.WorkingDirectory, tp.Settings.GetFullVersionName(), tp.Settings.OutPath, tp.Settings.ArtifactsDest)
	if err != nil {
		return "", err
	}
	outDir := filepath.Dir(absoluteBin)
	err = os.MkdirAll(outDir, 0755)
	if err != nil {
		return "", err
	}
	args = append(args, "-o", absoluteBin, ".")
	//log.Printf("building %s", exeName)
	//v0.8.5 no longer using CGO_ENABLED
	envExtra := []string{"GOOS=" + dest.Os, "GOARCH=" + dest.Arch}
	if dest.Os == platforms.LINUX && dest.Arch == platforms.ARM {
		// see http://dave.cheney.net/2012/09/08/an-introduction-to-cross-compilation-with-go
		goarm := tp.Settings.GetTaskSettingString(TASK_XC, "GOARM")
		if goarm != "" {
			envExtra = append(envExtra, "GOARM="+goarm)
		}
	}
	err = executils.InvokeGo(packagePath, "build", args, envExtra, tp.Settings)
	return absoluteBin, err
}
Ejemplo n.º 2
0
func runTaskGoInstall(tp TaskParams) error {
	for _, mainDir := range tp.MainDirs {
		err := executils.InvokeGo(mainDir, "install", []string{}, []string{}, tp.Settings)
		if err != nil {
			return err
		}
	}
	return nil
}
Ejemplo n.º 3
0
Archivo: go-vet.go Proyecto: yl10/goxc
func runTaskGoVet(tp TaskParams) error {
	dir := tp.Settings.GetTaskSettingString(TASK_GO_VET, "dir")
	args := []string{dir}
	err := executils.InvokeGo(tp.WorkingDirectory, "vet", args, []string{}, tp.Settings)
	//v0.8.3 treat this as a warning only.
	if err != nil {
		log.Print("Go-vet failed (goxc just treats this as a warning for now)")
	}
	return nil
}
Ejemplo n.º 4
0
func runTaskGoTest(tp TaskParams) error {
	dir := tp.Settings.GetTaskSettingString(TASK_GO_TEST, "dir")
	i := tp.Settings.GetTaskSettingBool(TASK_GO_TEST, "i") //this should be false by default! leaving it exposed for invocation as a flag
	args := []string{dir}
	if i {
		args = []string{"-i", dir}
	}
	//args = append(args, executils.GetLdFlagVersionArgs(tp.Settings.GetFullVersionName())...)
	err := executils.InvokeGo(tp.WorkingDirectory, "test", args, []string{}, tp.Settings)
	return err
}
Ejemplo n.º 5
0
func runTaskGoTest(tp TaskParams) error {
	dir := tp.Settings.GetTaskSettingString(TASK_GO_TEST, "dir")
	i := tp.Settings.GetTaskSettingBool(TASK_GO_TEST, "i")
	args := []string{dir}
	if i {
		args = []string{"-i", dir}
	}
	//args = append(args, executils.GetLdFlagVersionArgs(tp.Settings.GetFullVersionName())...)
	err := executils.InvokeGo(tp.WorkingDirectory, "test", args, []string{}, tp.Settings)
	return err
}
Ejemplo n.º 6
0
Archivo: go-test.go Proyecto: yl10/goxc
func runTaskGoTest(tp TaskParams) error {
	dir := tp.Settings.GetTaskSettingString(TASK_GO_TEST, "dir")
	i := tp.Settings.GetTaskSettingBool(TASK_GO_TEST, "i") //this should be false by default! leaving it exposed for invocation as a flag
	short := tp.Settings.GetTaskSettingBool(TASK_GO_TEST, "short")
	args := []string{}
	if i {
		args = append(args, "-i")
	}
	if short {
		args = append(args, "-short")
	}
	args = append(args, dir)
	if tp.Settings.IsVerbose() {
		log.Printf("Running `go test` with args: %v", args)
	}
	err := executils.InvokeGo(tp.WorkingDirectory, "test", args, []string{}, tp.Settings)
	return err
}
Ejemplo n.º 7
0
Archivo: go-fmt.go Proyecto: yl10/goxc
func runTaskGoFmt(tp TaskParams) error {
	dir := tp.Settings.GetTaskSettingString(TASK_GO_FMT, "dir")
	err := executils.InvokeGo(tp.WorkingDirectory, "fmt", []string{dir}, []string{}, tp.Settings)
	return err
}
Ejemplo n.º 8
0
func runTaskGoClean(tp TaskParams) error {
	err := executils.InvokeGo(tp.WorkingDirectory, "clean", []string{}, []string{}, tp.Settings)
	return err
}