"strings"
"sync"
- common "gerrit.automotivelinux.org/gerrit/src/xds/xds-common.git/golib"
- "gerrit.automotivelinux.org/gerrit/src/xds/xds-server/lib/xsapiv1"
+ common "gerrit.automotivelinux.org/gerrit/src/xds/xds-common.git"
+ "gerrit.automotivelinux.org/gerrit/src/xds/xds-server.git/lib/xdsconfig"
+ "gerrit.automotivelinux.org/gerrit/src/xds/xds-server.git/lib/xsapiv1"
)
// SDKs List of installed SDK
stop chan struct{} // signals intentional stop
}
-// NewSDKs creates a new instance of SDKs
-func NewSDKs(ctx *Context) (*SDKs, error) {
+// SDKsConstructor creates a new instance of SDKs
+func SDKsConstructor(ctx *Context) (*SDKs, error) {
s := SDKs{
Context: ctx,
Sdks: make(map[string]*CrossSDK),
scriptsDir := ctx.Config.FileConf.SdkScriptsDir
if !common.Exists(scriptsDir) {
- // allow to use scripts/sdk in debug mode
+ // allow to use scripts/sdk when debugging with vscode(EXEPATH=WORKSPACE)
scriptsDir = filepath.Join(filepath.Dir(ctx.Config.FileConf.SdkScriptsDir), "scripts", "sdks")
if !common.Exists(scriptsDir) {
return &s, fmt.Errorf("scripts directory doesn't exist (%v)", scriptsDir)
}
}
- ctx.Log.Debugf("Cross SDKs: %d defined, %d installed", len(s.Sdks), nbInstalled)
+ ctx.Log.Infof("Cross SDKs: %d defined, %d installed", len(s.Sdks), nbInstalled)
// Start monitor thread to detect new SDKs
sdksDirs := []string{}
// Update path when not set
if sdk.Path == "" {
- sdkDef, err := GetSDKInfo(scriptDir, sdk.URL, "", "", s.Log)
+ sdkDef, err := GetSDKInfo(scriptDir, sdk.URL, "", "", sdk.UUID, s.Log)
if err != nil || sdkDef.Path == "" {
return nil, fmt.Errorf("cannot retrieve sdk path %v", err)
}
} else if filepath != "" {
// FIXME support any location and also sharing either by pathmap or Syncthing
- baseDir := "${HOME}/xds-workspace/sdks"
+
+ baseDir := path.Join(xdsconfig.WorkspaceRootDir(), "sdks")
sdkFilename, _ = common.ResolveEnvVar(path.Join(baseDir, path.Base(filepath)))
if !common.Exists(sdkFilename) {
return nil, fmt.Errorf("SDK file not accessible, must be in %s", baseDir)
}
for _, sf := range s.SdksFamilies {
- sdkDef, err := GetSDKInfo(sf.ScriptsDir, "", sdkFilename, "", s.Log)
+ sdkDef, err := GetSDKInfo(sf.ScriptsDir, "", sdkFilename, "", "", s.Log)
if err == nil {
// OK, sdk found
sdk = &sdkDef