當前位置: 首頁>>代碼示例>>Golang>>正文


Golang Settings.GetTaskSettingString方法代碼示例

本文整理匯總了Golang中github.com/laher/goxc/config.Settings.GetTaskSettingString方法的典型用法代碼示例。如果您正苦於以下問題:Golang Settings.GetTaskSettingString方法的具體用法?Golang Settings.GetTaskSettingString怎麽用?Golang Settings.GetTaskSettingString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在github.com/laher/goxc/config.Settings的用法示例。


在下文中一共展示了Settings.GetTaskSettingString方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: buildToolchain

// Build toolchain for a given target platform
func buildToolchain(goos string, arch string, settings *config.Settings) error {
	goroot := settings.GoRoot
	scriptpath := core.GetMakeScriptPath(goroot)
	cmd := exec.Command(scriptpath)

	cmd.Dir = filepath.Join(goroot, "src")

	noClean := settings.GetTaskSettingBool(TASK_BUILD_TOOLCHAIN, "no-clean")
	if noClean {
		cmd.Args = append(cmd.Args, "--no-clean")
	}
	//0.8.5: no longer using cgoEnabled
	env := []string{"GOOS=" + goos, "GOARCH=" + arch}
	extraEnv := settings.GetTaskSettingStringSlice(TASK_BUILD_TOOLCHAIN, "extra-env")
	if settings.IsVerbose() {
		log.Printf("extra-env: %v", extraEnv)
	}
	env = append(env, extraEnv...)
	if goos == platforms.LINUX && arch == platforms.ARM {
		// see http://dave.cheney.net/2012/09/08/an-introduction-to-cross-compilation-with-go
		//NOTE: I don't think it has any effect on fp
		goarm := settings.GetTaskSettingString(TASK_BUILD_TOOLCHAIN, "GOARM")
		if goarm != "" {
			env = append(env, "GOARM="+goarm)
		}
	}

	if settings.IsVerbose() {
		log.Printf("Setting env: %v", env)
	}
	cmd.Env = append([]string{}, os.Environ()...)
	cmd.Env = append(cmd.Env, env...)
	if settings.IsVerbose() {
		log.Printf("'make' env: GOOS=%s GOARCH=%s GOROOT=%s", goos, arch, goroot)
		log.Printf("Invoking '%v' from %s", executils.PrintableArgs(cmd.Args), cmd.Dir)
	}
	executils.RedirectIO(cmd)
	err := cmd.Start()
	if err != nil {
		log.Printf("Build toolchain: Launch error: %s", err)
		return err
	}
	err = cmd.Wait()
	if err != nil {
		log.Printf("Build Toolchain: wait error: %s", err)
		return err
	}
	if settings.IsVerbose() {
		log.Printf("Complete")
	}
	return err
}
開發者ID:himanshugpt,項目名稱:evergreen,代碼行數:53,代碼來源:toolchain.go

示例2: getArmArchName

func getArmArchName(settings *config.Settings) string {
	armArchName := settings.GetTaskSettingString(TASK_PKG_BUILD, "armarch")
	if armArchName == "" {
		//derive it from GOARM version:
		goArm := settings.GetTaskSettingString(TASK_XC, "GOARM")
		if goArm == "5" {
			armArchName = "armel"
		} else {
			armArchName = "armhf"
		}
	}
	return armArchName
}
開發者ID:kc87654321,項目名稱:goxc,代碼行數:13,代碼來源:pkg-build.go

示例3: codesignPlat

func codesignPlat(goos, arch string, binPath string, settings *config.Settings) error {
	// settings.codesign only works on OS X for binaries generated for OS X.
	id := settings.GetTaskSettingString("codesign", "id")
	if id != "" && runtime.GOOS == platforms.DARWIN && goos == platforms.DARWIN {
		if err := signBinary(binPath, id); err != nil {
			log.Printf("codesign failed: %s", err)
			return err
		} else {
			log.Printf("Signed with ID: %q", id)
			return nil
		}
	}
	return nil
}
開發者ID:kc87654321,項目名稱:goxc,代碼行數:14,代碼來源:codesign.go


注:本文中的github.com/laher/goxc/config.Settings.GetTaskSettingString方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。