Skip to content

Commit 93b850a

Browse files
committed
[Android] fix NDK extract location
The Android NDK is being extracted with an extra intermediate directory: $BinaryCache\android-ndk-r26b\android-ndk-r26b The Android build fails because it expects the NDK contents to live immediately under the directory: $BinaryCache\android-ndk-r26b The extra android-ndk-r26b sub-dir comes from the NDK zip archive itself, which we have no control over. To work-around, allow callers of Extract-ZipFile to control whether or not it should create the extraction sub-dir. Override the default behavior for NDK extraction only.
1 parent f88da38 commit 93b850a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

utils/build.ps1

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -629,11 +629,13 @@ function Fetch-Dependencies {
629629
(
630630
[string]$ZipFileName,
631631
[string]$BinaryCache,
632-
[string]$ExtractPath
632+
[string]$ExtractPath,
633+
[bool]$CreateExtractPath = $true
633634
)
634635

635636
$source = Join-Path -Path $BinaryCache -ChildPath $ZipFileName
636637
$destination = Join-Path -Path $BinaryCache -ChildPath $ExtractPath
638+
$extractRoot = if ($CreateExtractPath) { $destination } else { $BinaryCache }
637639

638640
# Check if the extracted directory already exists and is up to date.
639641
if (Test-Path $destination) {
@@ -648,9 +650,10 @@ function Fetch-Dependencies {
648650

649651
Write-Output "Extracting '$ZipFileName' ..."
650652
New-Item -ItemType Directory -ErrorAction Ignore -Path $BinaryCache | Out-Null
651-
Expand-Archive -Path $source -DestinationPath $destination -Force
653+
Expand-Archive -Path $source -DestinationPath $extractRoot -Force
652654
}
653655

656+
654657
function Extract-Toolchain {
655658
param
656659
(
@@ -727,7 +730,7 @@ function Fetch-Dependencies {
727730
$NDKHash = "A478D43D4A45D0D345CDA6BE50D79642B92FB175868D9DC0DFC86181D80F691E"
728731
DownloadAndVerify $NDKURL "$BinaryCache\android-ndk-$AndroidNDKVersion-windows.zip" $NDKHash
729732

730-
Extract-ZipFile -ZipFileName "android-ndk-$AndroidNDKVersion-windows.zip" -BinaryCache $BinaryCache -ExtractPath "android-ndk-$AndroidNDKVersion"
733+
Extract-ZipFile -ZipFileName "android-ndk-$AndroidNDKVersion-windows.zip" -BinaryCache $BinaryCache -ExtractPath "android-ndk-$AndroidNDKVersion" -CreateExtractPath $false
731734
}
732735

733736
if ($WinSDKVersion) {

0 commit comments

Comments
 (0)