@@ -12,7 +12,7 @@ import (
12
12
semver "go.bug.st/relaxed-semver"
13
13
)
14
14
15
- func PlatformInstall (ctx context.Context , req * rpc.PlatformInstallReq ) (* rpc.PlatformInstallResp , error ) {
15
+ func PlatformInstall (ctx context.Context , req * rpc.PlatformInstallReq , progress commands. ProgressCB ) (* rpc.PlatformInstallResp , error ) {
16
16
var version * semver.Version
17
17
if req .Version != "" {
18
18
if v , err := semver .Parse (req .Version ); err == nil {
@@ -32,15 +32,17 @@ func PlatformInstall(ctx context.Context, req *rpc.PlatformInstallReq) (*rpc.Pla
32
32
return nil , fmt .Errorf ("Could not determine platform dependencies" , err )
33
33
}
34
34
35
- err = installPlatform (pm , platform , tools )
35
+ err = installPlatform (pm , platform , tools , progress )
36
36
if err != nil {
37
37
return nil , err
38
38
}
39
39
40
40
return & rpc.PlatformInstallResp {}, nil
41
41
}
42
42
43
- func installPlatform (pm * packagemanager.PackageManager , platformRelease * cores.PlatformRelease , requiredTools []* cores.ToolRelease ) error {
43
+ func installPlatform (pm * packagemanager.PackageManager ,
44
+ platformRelease * cores.PlatformRelease , requiredTools []* cores.ToolRelease ,
45
+ progress commands.ProgressCB ) error {
44
46
log := pm .Log .WithField ("platform" , platformRelease )
45
47
46
48
// Prerequisite checks before install
@@ -60,13 +62,10 @@ func installPlatform(pm *packagemanager.PackageManager, platformRelease *cores.P
60
62
}
61
63
62
64
// Package download
63
- print := func (curr * rpc.DownloadProgress ) {
64
- fmt .Printf (">> %v\n " , curr )
65
- }
66
65
for _ , tool := range toolsToInstall {
67
- downloadTool (pm , tool , print )
66
+ downloadTool (pm , tool , progress )
68
67
}
69
- downloadPlatform (pm , platformRelease , print )
68
+ downloadPlatform (pm , platformRelease , progress )
70
69
71
70
for _ , tool := range toolsToInstall {
72
71
InstallToolRelease (pm , tool )
0 commit comments