Skip to content

Commit 73295d1

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 we could either extract the archive directly into $BinaryCache or move the contents after extraction. This change does the latter in order to preserve the last-write-time optimization used to skip extraction when not needed.
1 parent f88da38 commit 73295d1

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

utils/build.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,14 @@ function Fetch-Dependencies {
649649
Write-Output "Extracting '$ZipFileName' ..."
650650
New-Item -ItemType Directory -ErrorAction Ignore -Path $BinaryCache | Out-Null
651651
Expand-Archive -Path $source -DestinationPath $destination -Force
652+
653+
# If extraction created a subdir in $ExtractPath with the same name, move
654+
# its contents up one level and remove the intermediate directory.
655+
$extractSubDir = Join-Path -Path $destination -ChildPath $ExtractPath
656+
if (Test-Path $extractSubDir) {
657+
Move-Item -Path "$extractSubDir\*" -Destination $destination -Force
658+
Remove-Item -Path $extractSubDir
659+
}
652660
}
653661

654662
function Extract-Toolchain {

0 commit comments

Comments
 (0)