diff options
| author | Egor Tensin <egor@tensin.name> | 2026-06-15 16:18:45 +0200 |
|---|---|---|
| committer | Egor Tensin <egor@tensin.name> | 2026-06-15 16:18:45 +0200 |
| commit | 3ba9bd382c33307d726b71177e6be2252df3f758 (patch) | |
| tree | 419c37f090df678dada1657ee761269fb8ee9eae /scripts/build.ps1 | |
| parent | test.ps1: add a test for nt_namespace (diff) | |
| download | windows7-drivers-3ba9bd382c33307d726b71177e6be2252df3f758.tar.gz windows7-drivers-3ba9bd382c33307d726b71177e6be2252df3f758.zip | |
move {build,test}.ps1 to km/
Diffstat (limited to 'scripts/build.ps1')
| -rw-r--r-- | scripts/build.ps1 | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/scripts/build.ps1 b/scripts/build.ps1 deleted file mode 100644 index 3cfc554..0000000 --- a/scripts/build.ps1 +++ /dev/null @@ -1,102 +0,0 @@ -param( - [Parameter(Mandatory=$true)] - [string] $InstallDir = $null, - [Parameter(Mandatory=$true)] - [string] $Platform = $null, - [Parameter(Mandatory=$true)] - [string] $Configuration = $null, - [Parameter(Mandatory=$true)] - [string] $WDK = $null -) - -$ErrorActionPreference = "Stop"; -Set-PSDebug -Strict - -function Invoke-Exe { - param( - [ScriptBlock] $Cmd, - [int[]] $AllowedExitCodes = @(0) - ) - - $backupErrorActionPreference = $script:ErrorActionPreference - $script:ErrorActionPreference = 'Continue' - - try { - & $Cmd - if ($AllowedExitCodes -notcontains $LastExitCode) { - throw "External command failed with exit code ${LastExitCode}: $Cmd" - } - } finally { - $script:ErrorActionPreference = $backupErrorActionPreference - } -} - -function Test-AppVeyor { - return Test-Path env:APPVEYOR -} - -function Get-DriverBuildDir { - param( - [Parameter(Mandatory=$true)] - [string] $DriverName - ) - - return "$script:PSScriptRoot\..\km\build\$script:WDK\$DriverName" -} - -function Get-DriverSolutionPath { - param( - [Parameter(Mandatory=$true)] - [string] $DriverName - ) - - $build_dir = Get-DriverBuildDir -DriverName $DriverName - return "$build_dir\$DriverName.sln" -} - -function Build-Driver { - param( - [Parameter(Mandatory=$true)] - [string] $DriverName - ) - - $build_dir = Get-DriverBuildDir -DriverName $DriverName - $solution_path = Get-DriverSolutionPath -DriverName $DriverName - - $msbuild_params = @() - $msbuild_params += "/p:Platform=$script:Platform" - $msbuild_params += "/p:Configuration=$script:Configuration" - $msbuild_params += "/p:SignMode=TestSign" - $msbuild_params += "/p:OutDir=$InstallDir\lib" - - cd $build_dir - Invoke-Exe { msbuild.exe $msbuild_params $solution_path } -} - -function Build-ProjectKernelMode { - $drivers = 'minimal', 'simple', 'nt_namespace' - - foreach ($driver in $drivers) { - Build-Driver -DriverName $driver - } -} - -function Build-Project { - if (Test-AppVeyor) { - $appveyor_cwd = pwd - } - - New-Item -ItemType Directory -Force $script:InstallDir | Out-Null - $script:InstallDir = (Resolve-Path $script:InstallDir).Path - - try { - Build-ProjectKernelMode - } finally { - if (Test-AppVeyor) { - cd $appveyor_cwd - Set-PSDebug -Off - } - } -} - -Build-Project |
