Skip to content

Commit dd965dd

Browse files
authored
Merge pull request #232 from microsoft/dilan/powershell-osx-specific-buildscripts
PowerShell: OS-specific buildscripts
2 parents d1c2fa0 + 0d38a98 commit dd965dd

File tree

4 files changed

+39
-3
lines changed

4 files changed

+39
-3
lines changed

.github/workflows/powershell-pr-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
- name: Install PowerShell
2727
run: |
2828
$path = Split-Path (Get-Command codeql).Source
29-
./powershell/build.ps1 $path
29+
./powershell/build-win64.ps1 $path
3030
- name: Run QL tests
3131
run: |
3232
codeql test run --threads=0 powershell/ql/test

powershell/build-linux64.ps1

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
param (
2+
[Parameter(Mandatory=$true)][string]$cliFolder
3+
)
4+
5+
$toolsLinux64Folder = Join-Path (Join-Path (Join-Path $cliFolder "powershell") "tools") "linux64"
6+
dotnet publish (Join-Path "$PSScriptRoot/extractor" "powershell.sln" | Resolve-Path) -o $toolsLinux64Folder -r linux-x64
7+
if ($LASTEXITCODE -ne 0) {
8+
Write-Host "Build failed"
9+
exit 1
10+
}
11+
12+
$powershellFolder = Join-Path -Path $cliFolder -ChildPath "powershell"
13+
Copy-Item -Path "$PSScriptRoot/codeql-extractor.yml" -Destination $powershellFolder -Force
14+
Copy-Item -Path "$PSScriptRoot/downgrades" -Destination $powershellFolder -Recurse -Force
15+
$qlLibFolder = Join-Path -Path "$PSScriptRoot/ql" -ChildPath "lib"
16+
Copy-Item -Path (Join-Path $qlLibFolder "semmlecode.powershell.dbscheme") -Destination $powershellFolder -Force
17+
Copy-Item -Path (Join-Path $qlLibFolder "semmlecode.powershell.dbscheme.stats") -Destination $powershellFolder -Force
18+
Copy-Item -Path "$PSScriptRoot/tools" -Destination $powershellFolder -Recurse -Force

powershell/build-osx64.ps1

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
param (
2+
[Parameter(Mandatory=$true)][string]$cliFolder
3+
)
4+
5+
$toolsOsx64Folder = Join-Path (Join-Path (Join-Path $cliFolder "powershell") "tools") "osx64"
6+
dotnet publish (Join-Path "$PSScriptRoot/extractor" "powershell.sln" | Resolve-Path) -o $toolsOsx64Folder -r osx-x64
7+
if ($LASTEXITCODE -ne 0) {
8+
Write-Host "Build failed"
9+
exit 1
10+
}
11+
12+
$powershellFolder = Join-Path -Path $cliFolder -ChildPath "powershell"
13+
Copy-Item -Path "$PSScriptRoot/codeql-extractor.yml" -Destination $powershellFolder -Force
14+
Copy-Item -Path "$PSScriptRoot/downgrades" -Destination $powershellFolder -Recurse -Force
15+
$qlLibFolder = Join-Path -Path "$PSScriptRoot/ql" -ChildPath "lib"
16+
Copy-Item -Path (Join-Path $qlLibFolder "semmlecode.powershell.dbscheme") -Destination $powershellFolder -Force
17+
Copy-Item -Path (Join-Path $qlLibFolder "semmlecode.powershell.dbscheme.stats") -Destination $powershellFolder -Force
18+
Copy-Item -Path "$PSScriptRoot/tools" -Destination $powershellFolder -Recurse -Force

powershell/build.ps1 renamed to powershell/build-win64.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ param (
33
)
44

55
$toolsWin64Folder = Join-Path (Join-Path (Join-Path $cliFolder "powershell") "tools") "win64"
6-
dotnet publish (Join-Path "$PSScriptRoot/extractor" "powershell.sln" | Resolve-Path) -o $toolsWin64Folder
6+
dotnet publish (Join-Path "$PSScriptRoot/extractor" "powershell.sln" | Resolve-Path) -o $toolsWin64Folder -r win-x64
77
if ($LASTEXITCODE -ne 0) {
88
Write-Host "Build failed"
99
exit 1
@@ -15,4 +15,4 @@ Copy-Item -Path "$PSScriptRoot/downgrades" -Destination $powershellFolder -Recur
1515
$qlLibFolder = Join-Path -Path "$PSScriptRoot/ql" -ChildPath "lib"
1616
Copy-Item -Path (Join-Path $qlLibFolder "semmlecode.powershell.dbscheme") -Destination $powershellFolder -Force
1717
Copy-Item -Path (Join-Path $qlLibFolder "semmlecode.powershell.dbscheme.stats") -Destination $powershellFolder -Force
18-
Copy-Item -Path "$PSScriptRoot/tools" -Destination $powershellFolder -Recurse -Force
18+
Copy-Item -Path "$PSScriptRoot/tools" -Destination $powershellFolder -Recurse -Force

0 commit comments

Comments
 (0)