-
Notifications
You must be signed in to change notification settings - Fork 31
/
params.go
59 lines (51 loc) · 1.32 KB
/
params.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package build
import "time"
// Last-minute adjustments for the manifest, typically constructed from command line
type ManifestAdjustments struct {
Platform string
BuildVars map[string]string
CDefs map[string]string
CFlags []string
CXXFlags []string
ExtraLibs []SWModule
// Libs and module version requirements.
DepsVersions *DepsManifest
StrictDepsVersions bool
}
// Note: this struct gets transmitted to the server
type BuildParams struct {
ManifestAdjustments
Clean bool
DryRun bool
Verbose bool
BuildTarget string
CustomLibLocations map[string]string
CustomModuleLocations map[string]string
LibsUpdateInterval time.Duration
NoPlatformCheck bool
SaveBuildStat bool
PreferPrebuiltLibs bool
// Host -> credentials, used for authentication when fetching libs.
Credentials map[string]Credentials
}
type Credentials struct {
User string
Pass string
}
func GetCredentialsForHost(credsMap map[string]Credentials, host string) *Credentials {
if len(credsMap) == 0 {
return nil
}
creds, ok := credsMap[host]
if ok {
return &creds
}
creds, ok = credsMap[""]
if ok {
return &creds
}
return nil
}
func (bp *BuildParams) GetCredentialsForHost(host string) *Credentials {
return GetCredentialsForHost(bp.Credentials, host)
}