8 // SDK Define a cross tool chain used to build application
10 ID string `json:"id" binding:"required"`
11 Name string `json:"name"`
12 Profile string `json:"profile"`
13 Version string `json:"version"`
14 Arch string `json:"arch"`
15 Path string `json:"path"`
17 // Not exported fields
18 EnvFile string `json:"-"`
21 // NewCrossSDK creates a new instance of Syncthing
22 func NewCrossSDK(path string) (*SDK, error) {
23 // Assume that we have .../<profile>/<version>/<arch>
26 s.Arch = filepath.Base(path)
28 d := filepath.Dir(path)
29 s.Version = filepath.Base(d)
32 s.Profile = filepath.Base(d)
34 s.ID = s.Profile + "_" + s.Arch + "_" + s.Version
35 s.Name = s.Arch + " (" + s.Version + ")"
37 envFile := filepath.Join(path, "environment-setup*")
38 ef, err := filepath.Glob(envFile)
40 return nil, fmt.Errorf("Cannot retrieve environment setup file: %v", err)
43 return nil, fmt.Errorf("No environment setup file found match %s", envFile)
50 // GetEnvCmd returns the command used to initialized the environment
51 func (s *SDK) GetEnvCmd() []string {
52 return []string{"source", s.EnvFile}