diff options
author | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2017-05-18 11:01:13 +0200 |
---|---|---|
committer | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2017-05-18 11:01:13 +0200 |
commit | 2c9ae6a5a27ae2f2e23495c613e7a53aed8e786c (patch) | |
tree | b23dbe9051c50a7ed8f666ae71c833fd52823770 /lib/crosssdk/sdk.go | |
parent | 51da3506a296b7d5d4185b17364f188292136888 (diff) |
Add Cross SDKs support (part 2)
Diffstat (limited to 'lib/crosssdk/sdk.go')
-rw-r--r-- | lib/crosssdk/sdk.go | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/lib/crosssdk/sdk.go b/lib/crosssdk/sdk.go index 2f22f22..9aeec90 100644 --- a/lib/crosssdk/sdk.go +++ b/lib/crosssdk/sdk.go @@ -2,17 +2,20 @@ package crosssdk import ( "fmt" - "path" "path/filepath" ) // SDK Define a cross tool chain used to build application type SDK struct { - Profile string - Version string - Arch string - Path string - EnvFile string + ID string `json:"id" binding:"required"` + Name string `json:"name"` + Profile string `json:"profile"` + Version string `json:"version"` + Arch string `json:"arch"` + Path string `json:"path"` + + // Not exported fields + EnvFile string `json:"-"` } // NewCrossSDK creates a new instance of Syncthing @@ -28,6 +31,9 @@ func NewCrossSDK(path string) (*SDK, error) { d = filepath.Dir(d) s.Profile = filepath.Base(d) + s.ID = s.Profile + "_" + s.Arch + "_" + s.Version + s.Name = s.Arch + " (" + s.Version + ")" + envFile := filepath.Join(path, "environment-setup*") ef, err := filepath.Glob(envFile) if err != nil { @@ -41,7 +47,7 @@ func NewCrossSDK(path string) (*SDK, error) { return &s, nil } -// GetEnvCmd returns the command to initialized the environment to use a cross SDK +// GetEnvCmd returns the command used to initialized the environment func (s *SDK) GetEnvCmd() string { - return ". " + path.Join(s.Path, s.EnvFile) + return ". " + s.EnvFile } |