Skip to content

Commit 2abefa7

Browse files
authored
Merge pull request #3612 from softins/windows-install-dependencies
Improve deploy_windows.ps1 fetching of dependencies
2 parents dfb671a + 2c53690 commit 2abefa7

2 files changed

Lines changed: 13 additions & 12 deletions

File tree

.github/workflows/bump-dependencies.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ jobs:
7979
changelog_name: ASIO SDK (Windows-only)
8080
get_upstream_version: |
8181
curl -s -o /dev/null --location --range 0-5 --write-out '%{url_effective}' https://www.steinberg.net/asiosdk |
82-
grep -oP '.*asiosdk_\K.*(?=\.zip)'
83-
local_version_regex: (.*["\/]asiosdk_)([^"]+?)(".*|\.zip.*)
82+
grep -oP '.*\K(?:ASIO-SDK|asiosdk)_.*(?=\.zip)'
83+
local_version_regex: (.*["\/])((?:ASIO-SDK|asiosdk)_[^"]+?)(".*|\.zip.*)
8484

8585
steps:
8686
- uses: actions/checkout@v6

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)