@@ -584,6 +584,32 @@ function Fetch-Dependencies {
584584 }
585585 }
586586
587+ function Extract-ZipFile {
588+ param (
589+ [string ]$ZipFileName ,
590+ [string ]$BinaryCache ,
591+ [string ]$ExtractPath
592+ )
593+
594+ $zipFilePath = Join-Path - Path $BinaryCache - ChildPath $ZipFileName
595+ $extractedPath = Join-Path - Path $BinaryCache - ChildPath $ExtractPath
596+
597+ # Check if the extracted directory already exists and is up to date.
598+ if (Test-Path $extractedPath ) {
599+ $zipLastWriteTime = (Get-Item $zipFilePath ).LastWriteTime
600+ $extractedLastWriteTime = (Get-Item $extractedPath ).LastWriteTime
601+ # Compare the last write times
602+ if ($zipLastWriteTime -le $extractedLastWriteTime ) {
603+ Write-Output " '$ZipFileName ' is already extracted and up to date."
604+ return
605+ }
606+ }
607+
608+ Write-Output " Extracting '$ZipFileName ' ..."
609+ New-Item - ItemType Directory - ErrorAction Ignore - Path $BinaryCache | Out-Null
610+ Expand-Archive - Path $zipFilePath - DestinationPath $BinaryCache - Force
611+ }
612+
587613 $WiXVersion = " 4.0.4"
588614 $WiXURL = " https://www.nuget.org/api/v2/package/wix/$WiXVersion "
589615 $WiXHash = " A9CA12214E61BB49430A8C6E5E48AC5AE6F27DC82573B5306955C4D35F2D34E2"
@@ -635,10 +661,7 @@ function Fetch-Dependencies {
635661 $NDKHash = " A478D43D4A45D0D345CDA6BE50D79642B92FB175868D9DC0DFC86181D80F691E"
636662 DownloadAndVerify $NDKURL " $BinaryCache \android-ndk-$AndroidNDKVersion -windows.zip" $NDKHash
637663
638- # TODO(compnerd) stamp/validate that we need to re-extract
639- Write-Output " Extracting Android NDK $AndroidNDKVersion ..."
640- New-Item - ItemType Directory - ErrorAction Ignore $BinaryCache | Out-Null
641- Expand-Archive - Path $BinaryCache \android- ndk- $AndroidNDKVersion - windows.zip - Destination $BinaryCache - Force
664+ Extract- ZipFile - ZipFileName " android-ndk-$AndroidNDKVersion -windows.zip" - BinaryCache $BinaryCache - ExtractPath " android-ndk-$AndroidNDKVersion "
642665 }
643666
644667 if ($WinSDKVersion ) {
0 commit comments