@@ -47,6 +47,7 @@ import {
4747  WINDOWS_X86_PYTHON_DOWNLOAD_URL , 
4848}  from  "./sharedConstants.mjs" ; 
4949import  {  compareGe  }  from  "./semverUtil.mjs" ; 
50+ import  LastUsedDepsStore  from  "./lastUsedDeps.mjs" ; 
5051
5152/// Translate nodejs platform names to ninja platform names 
5253const  NINJA_PLATFORMS : {  [ key : string ] : string  }  =  { 
@@ -573,8 +574,15 @@ export async function downloadAndInstallSDK(
573574        `SDK ${ version }  
574575      ) ; 
575576
576-       return  initSubmodules ( targetDirectory ,  gitPath ) ; 
577+       const  result  =  await  initSubmodules ( targetDirectory ,  gitPath ) ; 
578+       if  ( result )  { 
579+         await  LastUsedDepsStore . instance . record ( "pico-sdk" ,  version ) ; 
580+       } 
581+ 
582+       return  result ; 
577583    }  else  { 
584+       await  LastUsedDepsStore . instance . record ( "pico-sdk" ,  version ) ; 
585+ 
578586      return  true ; 
579587    } 
580588  } 
@@ -610,7 +618,12 @@ export async function downloadAndInstallSDK(
610618      return  false ; 
611619    } 
612620
613-     return  initSubmodules ( targetDirectory ,  gitPath ) ; 
621+     const  result  =  await  initSubmodules ( targetDirectory ,  gitPath ) ; 
622+     if  ( result )  { 
623+       await  LastUsedDepsStore . instance . record ( "pico-sdk" ,  version ) ; 
624+     } 
625+ 
626+     return  result ; 
614627  } 
615628
616629  return  false ; 
@@ -745,7 +758,6 @@ export async function downloadAndInstallGithubAsset(
745758        // eslint-disable-next-line @typescript-eslint/naming-convention 
746759        "User-Agent" : EXT_USER_AGENT , 
747760      } , 
748-       maxRedirections : 0 ,  // don't automatically follow redirects 
749761    } ; 
750762  }  else  { 
751763    const  urlObj  =  new  URL ( url ) ; 
@@ -757,7 +769,6 @@ export async function downloadAndInstallGithubAsset(
757769        // eslint-disable-next-line @typescript-eslint/naming-convention 
758770        "User-Agent" : EXT_USER_AGENT , 
759771      } , 
760-       maxRedirections : 0 ,  // don't automatically follow redirects 
761772    } ; 
762773  } 
763774
@@ -934,7 +945,7 @@ export async function downloadAndInstallTools(
934945  }  -${ TOOLS_PLATFORMS [ process . platform ] } ${ assetExt } ; 
935946  const  releaseVersion  =  TOOLS_RELEASES [ version ]  ??  "v"  +  version  +  "-0" ; 
936947
937-   return  downloadAndInstallGithubAsset ( 
948+   const   result   =   await  downloadAndInstallGithubAsset ( 
938949    version , 
939950    releaseVersion , 
940951    GithubRepository . tools , 
@@ -946,6 +957,11 @@ export async function downloadAndInstallTools(
946957    undefined , 
947958    progressCallback 
948959  ) ; 
960+   if  ( result )  { 
961+     await  LastUsedDepsStore . instance . record ( "pico-sdk-tools" ,  version ) ; 
962+   } 
963+ 
964+   return  result ; 
949965} 
950966
951967export  async  function  downloadAndInstallPicotool ( 
@@ -964,7 +980,7 @@ export async function downloadAndInstallPicotool(
964980  }  -${ TOOLS_PLATFORMS [ process . platform ] } ${ assetExt } ; 
965981  const  releaseVersion  =  PICOTOOL_RELEASES [ version ]  ??  "v"  +  version  +  "-0" ; 
966982
967-   return  downloadAndInstallGithubAsset ( 
983+   const   result   =   await  downloadAndInstallGithubAsset ( 
968984    version , 
969985    releaseVersion , 
970986    GithubRepository . tools , 
@@ -976,6 +992,12 @@ export async function downloadAndInstallPicotool(
976992    undefined , 
977993    progressCallback 
978994  ) ; 
995+ 
996+   if  ( result )  { 
997+     await  LastUsedDepsStore . instance . record ( "picotool" ,  version ) ; 
998+   } 
999+ 
1000+   return  result ; 
9791001} 
9801002
9811003export  async  function  downloadAndInstallToolchain ( 
@@ -999,7 +1021,7 @@ export async function downloadAndInstallToolchain(
9991021
10001022  const  archiveFileName  =  `${ toolchain . version } ${ artifactExt }  ; 
10011023
1002-   return  downloadAndInstallArchive ( 
1024+   const   result   =   await  downloadAndInstallArchive ( 
10031025    downloadUrl , 
10041026    targetDirectory , 
10051027    archiveFileName , 
@@ -1009,6 +1031,16 @@ export async function downloadAndInstallToolchain(
10091031    undefined , 
10101032    progressCallback 
10111033  ) ; 
1034+   if  ( result )  { 
1035+     await  LastUsedDepsStore . instance . record ( 
1036+       toolchain . version . toLowerCase ( ) . includes ( "risc" ) 
1037+         ? "riscv-toolchain" 
1038+         : "arm-toolchain" , 
1039+       toolchain . version 
1040+     ) ; 
1041+   } 
1042+ 
1043+   return  result ; 
10121044} 
10131045
10141046/** 
@@ -1032,7 +1064,7 @@ export async function downloadAndInstallNinja(
10321064      : ""  
10331065  }  .zip`; 
10341066
1035-   return  downloadAndInstallGithubAsset ( 
1067+   const   result   =   await  downloadAndInstallGithubAsset ( 
10361068    version , 
10371069    version , 
10381070    GithubRepository . ninja , 
@@ -1044,6 +1076,11 @@ export async function downloadAndInstallNinja(
10441076    undefined , 
10451077    progressCallback 
10461078  ) ; 
1079+   if  ( result )  { 
1080+     await  LastUsedDepsStore . instance . record ( "ninja" ,  version ) ; 
1081+   } 
1082+ 
1083+   return  result ; 
10471084} 
10481085
10491086/// Detects if the current system is a Raspberry Pi with Debian 
@@ -1102,7 +1139,7 @@ export async function downloadAndInstallOpenOCD(
11021139    } 
11031140  } ; 
11041141
1105-   return  downloadAndInstallGithubAsset ( 
1142+   const   result   =   await  downloadAndInstallGithubAsset ( 
11061143    version , 
11071144    OPENOCD_RELEASES [ version ] , 
11081145    GithubRepository . tools , 
@@ -1114,6 +1151,11 @@ export async function downloadAndInstallOpenOCD(
11141151    undefined , 
11151152    progressCallback 
11161153  ) ; 
1154+   if  ( result )  { 
1155+     await  LastUsedDepsStore . instance . record ( "openocd" ,  version ) ; 
1156+   } 
1157+ 
1158+   return  result ; 
11171159} 
11181160
11191161/** 
@@ -1155,7 +1197,7 @@ export async function downloadAndInstallCmake(
11551197    //chmodSync(join(targetDirectory, "CMake.app", "Contents", "bin", "cmake"), 0o755); 
11561198  } ; 
11571199
1158-   return  downloadAndInstallGithubAsset ( 
1200+   const   result   =   await  downloadAndInstallGithubAsset ( 
11591201    version , 
11601202    version , 
11611203    GithubRepository . cmake , 
@@ -1167,6 +1209,11 @@ export async function downloadAndInstallCmake(
11671209    undefined , 
11681210    progressCallback 
11691211  ) ; 
1212+   if  ( result )  { 
1213+     await  LastUsedDepsStore . instance . record ( "cmake" ,  version ) ; 
1214+   } 
1215+ 
1216+   return  result ; 
11701217} 
11711218
11721219function  _runCommand ( 
@@ -1363,8 +1410,9 @@ export async function downloadEmbedPython(
13631410    await  workspace . fs . createDirectory ( Uri . file ( dllDir ) ) ; 
13641411
13651412    // Write to *._pth to allow use of installed packages 
1366-     const  versionAppend  = 
1367-       CURRENT_PYTHON_VERSION . split ( "." ) . slice ( 0 ,  2 ) . join ( "" ) ; 
1413+     const  versionAppend  =  CURRENT_PYTHON_VERSION . split ( "." ) 
1414+       . slice ( 0 ,  2 ) 
1415+       . join ( "" ) ; 
13681416    const  pthFile  =  `${ targetDirectory } ${ versionAppend }  ; 
13691417    let  pthContents  =  ( 
13701418      await  workspace . fs . readFile ( Uri . file ( pthFile ) ) 
@@ -1405,5 +1453,10 @@ export async function downloadEmbedPython(
14051453    } 
14061454  } 
14071455
1456+   await  LastUsedDepsStore . instance . record ( 
1457+     "embedded-python" , 
1458+     CURRENT_PYTHON_VERSION 
1459+   ) ; 
1460+ 
14081461  return  pythonExe ; 
14091462} 
0 commit comments