Skip to content

Commit 2d891a4

Browse files
committed
Add extra sdk arguments for code-workspace tests
1 parent ada344f commit 2d891a4

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

assets/test.code-workspace

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
{
1616
"name": "command-plugin",
1717
"path": "./test/command-plugin"
18-
},
18+
}
1919
],
2020
"settings": {
2121
"swift.disableAutoResolve": true,
@@ -85,7 +85,7 @@
8585
"disableASLR": false,
8686
"initCommands": [
8787
"settings set target.disable-aslr false"
88-
],
88+
]
8989
},
9090
{
9191
"type": "swift",
@@ -98,7 +98,7 @@
9898
"disableASLR": false,
9999
"initCommands": [
100100
"settings set target.disable-aslr false"
101-
],
101+
]
102102
}
103103
],
104104
"compounds": []

scripts/test_windows.ps1

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
function Update-SwiftBuildAndPackageArguments {
1616
param (
1717
[string]$jsonFilePath = "./assets/test/.vscode/settings.json",
18+
[string]$codeWorkspaceFilePath = "./assets/test.code-workspace",
1819
[string]$windowsSdkVersion = "10.0.22000.0",
1920
[string]$vcToolsVersion = "14.43.34808"
2021
)
@@ -28,9 +29,17 @@ function Update-SwiftBuildAndPackageArguments {
2829
exit 1
2930
}
3031

32+
try {
33+
$codeWorkspaceContent = Get-Content -Raw -Path $codeWorkspaceFilePath | ConvertFrom-Json
34+
} catch {
35+
Write-Host "Invalid JSON content in $codeWorkspaceFilePath"
36+
exit 1
37+
}
38+
3139
if ($jsonContent.PSObject.Properties['swift.buildArguments']) {
3240
$jsonContent.PSObject.Properties.Remove('swift.buildArguments')
3341
}
42+
3443

3544
$jsonContent | Add-Member -MemberType NoteProperty -Name "swift.buildArguments" -Value @(
3645
"-Xbuild-tools-swiftc", "-windows-sdk-root", "-Xbuild-tools-swiftc", $windowsSdkRoot,
@@ -54,10 +63,20 @@ function Update-SwiftBuildAndPackageArguments {
5463
"-Xswiftc", "-visualc-tools-version", "-Xswiftc", $vcToolsVersion
5564
)
5665

66+
67+
$codeWorkspaceContent.PSObject.Properties.Remove('settings')
68+
$codeWorkspaceContent | Add-Member -MemberType NoteProperty -Name "settings" -Value $jsonContent
69+
5770
$jsonContent | ConvertTo-Json -Depth 32 | Set-Content -Path $jsonFilePath
5871

72+
73+
$codeWorkspaceContent | ConvertTo-Json -Depth 32 | Set-Content -Path $codeWorkspaceFilePath
74+
5975
Write-Host "Contents of ${jsonFilePath}:"
6076
Get-Content -Path $jsonFilePath
77+
78+
Write-Host "Contents of ${codeWorkspaceFilePath}:"
79+
Get-Content -Path $codeWorkspaceFilePath
6180
}
6281

6382
$swiftVersionOutput = & swift --version

0 commit comments

Comments
 (0)