Skip to content

Commit 045b9c1

Browse files
committed
Improve deploy_windows.ps1 fetching of dependencies
Updated Install-Dependency to create a unique empty directory for unpacking the fetched zip file into, for ASIO and NSIS. This avoids having to know the top-level directory name used within the archive, which for ASIO is not consistent between versions.
1 parent dfb671a commit 045b9c1

1 file changed

Lines changed: 11 additions & 10 deletions

File tree

windows/deploy_windows.ps1

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,7 @@ param (
1111
#
1212
# The following version pinnings are semi-automatically checked for
1313
# updates. Verify .github/workflows/bump-dependencies.yaml when changing those manually:
14-
[string] $AsioSDKName = "asiosdk_2.3.3_2019-06-14",
1514
[string] $AsioSDKUrl = "https://download.steinberg.net/sdk_downloads/asiosdk_2.3.3_2019-06-14.zip",
16-
[string] $NsisName = "nsis-3.11",
1715
[string] $NsisUrl = "https://downloads.sourceforge.net/project/nsis/NSIS%203/3.11/nsis-3.11.zip",
1816
[string] $BuildOption = ""
1917
)
@@ -128,8 +126,6 @@ Function Install-Dependency
128126
[Parameter(Mandatory=$true)]
129127
[string] $Uri,
130128
[Parameter(Mandatory=$true)]
131-
[string] $Name,
132-
[Parameter(Mandatory=$true)]
133129
[string] $Destination
134130
)
135131

@@ -140,7 +136,11 @@ Function Install-Dependency
140136
}
141137

142138
$TempFileName = [System.IO.Path]::GetTempFileName() + ".zip"
143-
$TempDir = [System.IO.Path]::GetTempPath()
139+
$TempPath = [System.IO.Path]::GetTempPath()
140+
$TempGuid = [System.Guid]::NewGuid()
141+
# Create a unique empty directory to unpack into
142+
$TempDir = (Join-Path $TempPath $TempGuid)
143+
New-Item -ItemType Directory -Path $TempDir
144144

145145
if ($Uri -Match "downloads.sourceforge.net")
146146
{
@@ -151,7 +151,10 @@ Function Install-Dependency
151151
echo $TempFileName
152152
Expand-Archive -Path $TempFileName -DestinationPath $TempDir -Force
153153
echo $WindowsPath\$Destination
154-
Move-Item -Path "$TempDir\$Name" -Destination "$WindowsPath\$Destination" -Force
154+
# Because we unpacked into a new directory, we can use * for the directory in the archive,
155+
# so that we do not need to know the directory name the archive was packed from.
156+
Move-Item -Path "$TempDir\*" -Destination "$WindowsPath\$Destination" -Force
157+
Remove-Item -Path $TempDir -Recurse -Force
155158
Remove-Item -Path $TempFileName -Force
156159
}
157160

@@ -162,14 +165,12 @@ Function Install-Dependencies
162165
Install-PackageProvider -Name "Nuget" -Scope CurrentUser -Force
163166
}
164167
Initialize-Module-Here -m "VSSetup"
165-
Install-Dependency -Uri $NsisUrl `
166-
-Name $NsisName -Destination "..\libs\NSIS\NSIS-source"
168+
Install-Dependency -Uri $NsisUrl -Destination "..\libs\NSIS\NSIS-source"
167169

168170
if ($BuildOption -Notmatch "jack") {
169171
# Don't download ASIO SDK on Jamulus JACK builds to save
170172
# resources and to be extra-sure license-wise.
171-
Install-Dependency -Uri $AsioSDKUrl `
172-
-Name $AsioSDKName -Destination "..\libs\ASIOSDK2"
173+
Install-Dependency -Uri $AsioSDKUrl -Destination "..\libs\ASIOSDK2"
173174
}
174175
}
175176

0 commit comments

Comments
 (0)