예제 #1
0
func (s *Settings) GetTaskSettingBool(taskName, settingName string) bool {
	retUntyped := s.GetTaskSetting(taskName, settingName)
	if retUntyped == nil {
		return false
	}
	ret, err := typeutils.ToBool(retUntyped, taskName+"."+settingName)
	if err != nil {
		//already logged
	}
	return ret
}
예제 #2
0
func buildSettingsFromMap(m map[string]interface{}) (*BuildSettings, error) {
	var err error
	bs := BuildSettings{}
	FillBuildSettingsDefaults(&bs)
	for k, v := range m {
		switch k {
		//case "GoRoot":
		//	bs.GoRoot, err = typeutils.ToString(v, k)
		case "Processors":
			var fp float64
			fp, err = typeutils.ToFloat64(v, k)
			if err == nil {
				processors := int(fp)
				bs.Processors = &processors
			}
		case "Race":
			var race bool
			race, err = typeutils.ToBool(v, k)
			if err == nil {
				bs.Race = &race
			}
		case "Verbose":
			var verbose bool
			verbose, err = typeutils.ToBool(v, k)
			if err == nil {
				bs.Verbose = &verbose
			}
		case "PrintCommands":
			var printCommands bool
			printCommands, err = typeutils.ToBool(v, k)
			if err == nil {
				bs.PrintCommands = &printCommands
			}
		case "CcFlags":
			var ccFlags string
			ccFlags, err = typeutils.ToString(v, k)
			if err == nil {
				bs.CcFlags = &ccFlags
			}
		case "Compiler":
			var s string
			s, err = typeutils.ToString(v, k)
			if err == nil {
				bs.Compiler = &s
			}
		case "GccGoFlags":
			var s string
			s, err = typeutils.ToString(v, k)
			if err == nil {
				bs.GccGoFlags = &s
			}
		case "GcFlags":
			var s string
			s, err = typeutils.ToString(v, k)
			if err == nil {
				bs.GcFlags = &s
			}
		case "InstallSuffix":
			var s string
			s, err = typeutils.ToString(v, k)
			if err == nil {
				bs.InstallSuffix = &s
			}
		case "LdFlags":
			var s string
			s, err = typeutils.ToString(v, k)
			if err == nil {
				bs.LdFlags = &s
			}
		case "Tags":
			var s string
			s, err = typeutils.ToString(v, k)
			if err == nil {
				bs.Tags = &s
			}
		case "LdFlagsXVars":
			var xVars map[string]interface{}
			xVars, err = typeutils.ToMap(v, k)
			if err == nil {
				bs.LdFlagsXVars = &xVars
			}
		case "ExtraArgs":
			bs.ExtraArgs, err = typeutils.ToStringSlice(v, k)
		default:
			log.Printf("Warning!! Unrecognised Setting '%s' (value %v)", k, v)
		}
		if err != nil {
			return &bs, err
		}

	}
	return &bs, err
}