@@ -18,10 +18,10 @@ import {
1818  downloadFileGot , 
1919}  from  "../utils/download.mjs" ; 
2020import  Settings ,  {  HOME_VAR  }  from  "../settings.mjs" ; 
21- import  {  openOCDVersion  }  from  "../webview/newProjectPanel.mjs" ; 
2221import  findPython ,  {  showPythonNotFoundError  }  from  "../utils/pythonHelper.mjs" ; 
2322import  {  ensureGit  }  from  "../utils/gitUtil.mjs" ; 
24- import  {  type  VersionBundle  }  from  "../utils/versionBundles.mjs" ; 
23+ import  VersionBundlesLoader  from  "./versionBundles.mjs" ; 
24+ import  {  OPENOCD_VERSION  }  from  "./sharedConstants.mjs" ; 
2525
2626const  _logger  =  new  Logger ( "zephyrSetup" ) ; 
2727
@@ -48,10 +48,10 @@ manifest:
4848` ; 
4949
5050interface  ZephyrSetupValue  { 
51-   versionBundle : VersionBundle  |  undefined ; 
5251  cmakeMode : number ; 
5352  cmakePath : string ; 
5453  cmakeVersion : string ; 
54+   extUri : Uri ; 
5555} 
5656
5757interface  ZephyrSetupOutputs  { 
@@ -90,7 +90,17 @@ export async function setupZephyr(
9090
9191    return ; 
9292  } 
93+   _logger . info ( "Setting up Zephyr..." ) ; 
9394
95+   const  latestVb  =  await  new  VersionBundlesLoader ( data . extUri ) . getLatest ( ) ; 
96+   if  ( latestVb  ===  undefined )  { 
97+     _logger . error ( "Failed to get latest version bundles." ) ; 
98+     void  window . showErrorMessage ( 
99+       "Failed to get latest version bundles. Cannot continue Zephyr setup." 
100+     ) ; 
101+ 
102+     return ; 
103+   } 
94104  const  output : ZephyrSetupOutputs  =  {  cmakeExecutable : ""  } ; 
95105
96106  let  python3Path : string  |  undefined  =  "" ; 
@@ -131,11 +141,7 @@ export async function setupZephyr(
131141
132142      // Handle CMake install 
133143      switch  ( data . cmakeMode )  { 
134-         case  0 :
135-           if  ( data . versionBundle  !==  undefined )  { 
136-             data . cmakeVersion  =  data . versionBundle . cmake ; 
137-           } 
138-         // eslint-disable-next-line no-fallthrough 
144+         case  4 :
139145        case  2 :
140146          installedSuccessfully  =  false ; 
141147          prog2LastState  =  0 ; 
@@ -215,7 +221,7 @@ export async function setupZephyr(
215221            message : "Failed" , 
216222            increment : 100 , 
217223          } ) ; 
218-           void  window . showErrorMessage ( "Unknown cmake selection ." ) ; 
224+           void  window . showErrorMessage ( "Unknown CMake version selected ." ) ; 
219225
220226          return ; 
221227      } 
@@ -227,13 +233,16 @@ export async function setupZephyr(
227233        } , 
228234        async  progress2  =>  { 
229235          if  ( 
230-             await  downloadAndInstallNinja ( "v1.12.1" ,  ( prog : GotProgress )  =>  { 
231-               const  per  =  prog . percent  *  100 ; 
232-               progress2 . report ( { 
233-                 increment : per  -  prog2LastState , 
234-               } ) ; 
235-               prog2LastState  =  per ; 
236-             } ) 
236+             await  downloadAndInstallNinja ( 
237+               latestVb [ 1 ] . ninja , 
238+               ( prog : GotProgress )  =>  { 
239+                 const  per  =  prog . percent  *  100 ; 
240+                 progress2 . report ( { 
241+                   increment : per  -  prog2LastState , 
242+                 } ) ; 
243+                 prog2LastState  =  per ; 
244+               } 
245+             ) 
237246          )  { 
238247            progress2 . report ( { 
239248              message : "Successfully downloaded and installed Ninja." , 
@@ -259,13 +268,16 @@ export async function setupZephyr(
259268        } , 
260269        async  progress2  =>  { 
261270          if  ( 
262-             await  downloadAndInstallPicotool ( "2.1.1" ,  ( prog : GotProgress )  =>  { 
263-               const  per  =  prog . percent  *  100 ; 
264-               progress2 . report ( { 
265-                 increment : per  -  prog2LastState , 
266-               } ) ; 
267-               prog2LastState  =  per ; 
268-             } ) 
271+             await  downloadAndInstallPicotool ( 
272+               latestVb [ 1 ] . picotool , 
273+               ( prog : GotProgress )  =>  { 
274+                 const  per  =  prog . percent  *  100 ; 
275+                 progress2 . report ( { 
276+                   increment : per  -  prog2LastState , 
277+                 } ) ; 
278+                 prog2LastState  =  per ; 
279+               } 
280+             ) 
269281          )  { 
270282            progress2 . report ( { 
271283              message : "Successfully downloaded and installed Picotool." , 
@@ -322,6 +334,7 @@ export async function setupZephyr(
322334          } , 
323335          async  progress2  =>  { 
324336            if  ( 
337+               // TODO: integrate into extension system for github api caching 
325338              await  downloadAndInstallArchive ( 
326339                "https://github.com/oss-winget/oss-winget-storage/raw/"  + 
327340                  "96ea1b934342f45628a488d3b50d0c37cf06012c/packages/dtc/"  + 
@@ -355,6 +368,7 @@ export async function setupZephyr(
355368          } , 
356369          async  progress2  =>  { 
357370            if  ( 
371+               // TODO: integrate into extension system for github api caching 
358372              await  downloadAndInstallArchive ( 
359373                "https://sourceforge.net/projects/gnuwin32/files/gperf/3.0.1/"  + 
360374                  "gperf-3.0.1-bin.zip/download" , 
@@ -391,6 +405,7 @@ export async function setupZephyr(
391405          } , 
392406          async  progress2  =>  { 
393407            if  ( 
408+               // TODO: integrate into extension system for github api caching 
394409              await  downloadAndInstallArchive ( 
395410                "https:///eternallybored.org/misc/wget/releases/"  + 
396411                  "wget-1.21.4-win64.zip" , 
@@ -498,7 +513,7 @@ export async function setupZephyr(
498513        async  progress2  =>  { 
499514          if  ( 
500515            await  downloadAndInstallOpenOCD ( 
501-               openOCDVersion , 
516+               OPENOCD_VERSION , 
502517              ( prog : GotProgress )  =>  { 
503518                const  per  =  prog . percent  *  100 ; 
504519                progress2 . report ( { 
@@ -844,12 +859,13 @@ export async function setupZephyr(
844859              windowsHide : true , 
845860              env : customEnv , 
846861            } ) ; 
847-             _logger . info ( "stdout: " ,  child . stdout . toString ( ) ) ; 
848-             _logger . info ( "stderr: " ,  child . stderr . toString ( ) ) ; 
862+             _logger . debug ( "stdout: " ,  child . stdout . toString ( ) ) ; 
863+             _logger . debug ( "stderr: " ,  child . stderr . toString ( ) ) ; 
864+ 
849865            if  ( child . status )  { 
850-               _logger . info ( "exit code: " ,  child . status ) ; 
866+               _logger . debug ( "exit code: " ,  child . status ) ; 
851867              if  ( child . status  !==  0 )  { 
852-                 window . showErrorMessage ( 
868+                 void   window . showErrorMessage ( 
853869                  "Error installing Zephyr SDK."  +  "Exiting Zephyr Setup." 
854870                ) ; 
855871              } 
@@ -873,7 +889,8 @@ export async function setupZephyr(
873889      ) ; 
874890
875891      if  ( installedSuccessfully )  { 
876-         window . showInformationMessage ( "Zephyr setup complete" ) ; 
892+         // TODO: duplicate signaling 
893+         void  window . showInformationMessage ( "Zephyr setup complete" ) ; 
877894        progress . report ( { 
878895          message : "Zephyr setup complete." , 
879896          increment : 100 , 
0 commit comments