aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crosssdk/sdk.go
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-11-29 08:54:00 +0100
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-11-29 11:10:30 +0100
commit2f7828d01f4c4ca2909f95f098627cd5475ed225 (patch)
treeb5e71920b813b95cae3e32044be08b99223348ec /lib/crosssdk/sdk.go
parent5caebfb4b7c3b73988f067082b219ce5b7f409ba (diff)
Refit source files to have a public xs-apiv1 lib package.
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'lib/crosssdk/sdk.go')
-rw-r--r--lib/crosssdk/sdk.go56
1 files changed, 0 insertions, 56 deletions
diff --git a/lib/crosssdk/sdk.go b/lib/crosssdk/sdk.go
deleted file mode 100644
index 5be8954..0000000
--- a/lib/crosssdk/sdk.go
+++ /dev/null
@@ -1,56 +0,0 @@
-package crosssdk
-
-import (
- "fmt"
- "path/filepath"
-
- uuid "github.com/satori/go.uuid"
-)
-
-// SDK Define a cross tool chain used to build application
-type SDK struct {
- 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
-func NewCrossSDK(path string) (*SDK, error) {
- // Assume that we have .../<profile>/<version>/<arch>
- s := SDK{Path: path}
-
- s.Arch = filepath.Base(path)
-
- d := filepath.Dir(path)
- s.Version = filepath.Base(d)
-
- d = filepath.Dir(d)
- s.Profile = filepath.Base(d)
-
- // Use V3 to ensure that we get same uuid on restart
- s.ID = uuid.NewV3(uuid.FromStringOrNil("sdks"), s.Profile+"_"+s.Arch+"_"+s.Version).String()
- s.Name = s.Arch + " (" + s.Version + ")"
-
- envFile := filepath.Join(path, "environment-setup*")
- ef, err := filepath.Glob(envFile)
- if err != nil {
- return nil, fmt.Errorf("Cannot retrieve environment setup file: %v", err)
- }
- if len(ef) != 1 {
- return nil, fmt.Errorf("No environment setup file found match %s", envFile)
- }
- s.EnvFile = ef[0]
-
- return &s, nil
-}
-
-// GetEnvCmd returns the command used to initialized the environment
-func (s *SDK) GetEnvCmd() []string {
- return []string{"source", s.EnvFile}
-}