Code Review
/
src
/
xds
/
xds-server.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge remote-tracking branch 'origin/master' into wip
[src/xds/xds-server.git]
/
lib
/
crosssdk
/
sdk.go
diff --git
a/lib/crosssdk/sdk.go
b/lib/crosssdk/sdk.go
index
2f22f22
..
5be8954
100644
(file)
--- a/
lib/crosssdk/sdk.go
+++ b/
lib/crosssdk/sdk.go
@@
-2,17
+2,22
@@
package crosssdk
import (
"fmt"
import (
"fmt"
- "path"
"path/filepath"
"path/filepath"
+
+ uuid "github.com/satori/go.uuid"
)
// SDK Define a cross tool chain used to build application
type SDK struct {
)
// 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
}
// NewCrossSDK creates a new instance of Syncthing
@@
-28,6
+33,10
@@
func NewCrossSDK(path string) (*SDK, error) {
d = filepath.Dir(d)
s.Profile = 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 {
envFile := filepath.Join(path, "environment-setup*")
ef, err := filepath.Glob(envFile)
if err != nil {
@@
-41,7
+50,7
@@
func NewCrossSDK(path string) (*SDK, error) {
return &s, nil
}
return &s, nil
}
-// GetEnvCmd returns the command
to initialized the environment to use a cross SDK
-func (s *SDK) GetEnvCmd() string {
- return
". " + path.Join(s.Path, s.EnvFile)
+// GetEnvCmd returns the command
used to initialized the environment
+func (s *SDK) GetEnvCmd()
[]
string {
+ return
[]string{"source", s.EnvFile}
}
}