Add VC++ Debug redist deployment to `deploy-ebpf.ps1`. (#2613)
* Add VC++ Debug redist deployment. * wip * Update doc. * indent * adjust $null checks in all PS scripts * fix
This commit is contained in:
Родитель
62537b4f15
Коммит
020cdad9b8
|
@ -82,7 +82,7 @@ C:\Windows\system32\msiexec.exe /i eBPF-for-Windows.x.x.x.msi <other options> /l
|
||||||
This method uses a machine that
|
This method uses a machine that
|
||||||
has already built the binaries for `x64/Debug` or `x64/Release`.
|
has already built the binaries for `x64/Debug` or `x64/Release`.
|
||||||
|
|
||||||
1. Deploy the binaries to `C:\Temp` in your VM, as follows:
|
1. Deploy the binaries to `C:\Temp` in your VM, as follows (from within a "*Developer PowerShell for VS 2022*"):
|
||||||
|
|
||||||
- If you **built the binaries from inside the VM**, then from your `ebpf-for-windows` directory in the VM, run:
|
- If you **built the binaries from inside the VM**, then from your `ebpf-for-windows` directory in the VM, run:
|
||||||
|
|
||||||
|
|
|
@ -21,13 +21,10 @@ $source_directory="."
|
||||||
"ebpfnetsh.pdb",
|
"ebpfnetsh.pdb",
|
||||||
"export_program_info.exe",
|
"export_program_info.exe",
|
||||||
"export_program_info.pdb",
|
"export_program_info.pdb",
|
||||||
"MSVCP140D.dll",
|
|
||||||
"NetEbpfExt.sys",
|
"NetEbpfExt.sys",
|
||||||
"NetEbpfExt.pdb",
|
"NetEbpfExt.pdb",
|
||||||
"net-ebpf-ext.guid",
|
"net-ebpf-ext.guid",
|
||||||
"ucrtbased.dll",
|
"ucrtbased.dll")
|
||||||
"VCRUNTIME140_1D.dll",
|
|
||||||
"VCRUNTIME140D.dll")
|
|
||||||
|
|
||||||
[System.Collections.ArrayList]$built_runtime_jit_files=@(
|
[System.Collections.ArrayList]$built_runtime_jit_files=@(
|
||||||
"ebpfsvc.exe",
|
"ebpfsvc.exe",
|
||||||
|
@ -212,6 +209,8 @@ $source_directory="."
|
||||||
$destination_directory="C:\Temp"
|
$destination_directory="C:\Temp"
|
||||||
$error.clear()
|
$error.clear()
|
||||||
$vm="Windows 10 dev environment"
|
$vm="Windows 10 dev environment"
|
||||||
|
$vc_redist_dir = Join-Path -Path $env:VCToolsRedistDir '\debug_nonredist\x64\Microsoft.VC143.DebugCRT\'
|
||||||
|
$copy_redist=$false
|
||||||
|
|
||||||
##
|
##
|
||||||
## Process command-line options
|
## Process command-line options
|
||||||
|
@ -249,7 +248,7 @@ OPTIONS:
|
||||||
$vm=($arg -split "=")[1];
|
$vm=($arg -split "=")[1];
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
"^(?:-l|--list)(?:=(.+))?$"
|
"^(?:-l|--local)(?:=(.+))?$"
|
||||||
{
|
{
|
||||||
if ($matches[1]) {
|
if ($matches[1]) {
|
||||||
$destination_directory = $matches[1]
|
$destination_directory = $matches[1]
|
||||||
|
@ -267,11 +266,13 @@ OPTIONS:
|
||||||
{ @("-t", "--test") -contains $_ }
|
{ @("-t", "--test") -contains $_ }
|
||||||
{
|
{
|
||||||
$built_files= $built_runtime_files + $built_test_files
|
$built_files= $built_runtime_files + $built_test_files
|
||||||
|
$copy_redist=$true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
{ @("-t", "--jittest") -contains $_ }
|
{ @("-t", "--jittest") -contains $_ }
|
||||||
{
|
{
|
||||||
$built_files= $built_runtime_files + $built_runtime_jit_files + $built_test_files
|
$built_files= $built_runtime_files + $built_runtime_jit_files + $built_test_files
|
||||||
|
$copy_redist=$true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
default
|
default
|
||||||
|
@ -297,6 +298,21 @@ if ($vm -eq $null) {
|
||||||
Copy-Item "$source_path" -Destination "$destination_path" -ErrorAction Stop
|
Copy-Item "$source_path" -Destination "$destination_path" -ErrorAction Stop
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($copy_redist) {
|
||||||
|
Write-Host "Copying the VC++ Redist (Debug) files from `"$vc_redist_dir`" to `"$destination_directory`""
|
||||||
|
$files = Get-ChildItem -Path $vc_redist_dir -File
|
||||||
|
foreach ($file in $files) {
|
||||||
|
$source_path = $file.FullName
|
||||||
|
$destination_path = Join-Path -Path $destination_directory -ChildPath $file.Name
|
||||||
|
$destination_full_directory = Split-Path $destination_path -Parent
|
||||||
|
Write-Host " $source_path -> $destination_path"
|
||||||
|
if (!(Test-Path $destination_full_directory)) {
|
||||||
|
New-Item -Type Directory $destination_full_directory -ErrorAction Stop | Write-Verbose
|
||||||
|
}
|
||||||
|
Copy-Item -Path $source_path -Destination $destination_path -ErrorAction Stop
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Write-Host "Copying files from `"$source_directory`" to `"$destination_directory`""
|
Write-Host "Copying files from `"$source_directory`" to `"$destination_directory`""
|
||||||
foreach ( $file in $source_files ) {
|
foreach ( $file in $source_files ) {
|
||||||
$source_path = "$source_directory\$file"
|
$source_path = "$source_directory\$file"
|
||||||
|
@ -346,3 +362,17 @@ foreach ( $file in $source_files ) {
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($copy_redist) {
|
||||||
|
Write-Host "Copying the VC++ Redist (Debug) files from `"$vc_redist_dir`" to `"$destination_directory`" in VM `"$vm`"..."
|
||||||
|
$files = Get-ChildItem -Path $vc_redist_dir -File
|
||||||
|
foreach ($file in $files) {
|
||||||
|
$source_path = $file.FullName
|
||||||
|
$destination_path = Join-Path -Path $destination_directory -ChildPath $file.Name
|
||||||
|
Write-Host " $source_path -> $destination_path"
|
||||||
|
Copy-VMFile "$vm" -SourcePath "$source_path" -DestinationPath "$destination_path" -CreateFullPath -FileSource Host -Force
|
||||||
|
if (! $?) {
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -75,7 +75,7 @@ function Invoke-Test
|
||||||
}
|
}
|
||||||
|
|
||||||
# Parse output to check for errors.
|
# Parse output to check for errors.
|
||||||
if ($null -eq $Output) {
|
if ($Output -eq $null) {
|
||||||
throw ("No output generated by $TestName.")
|
throw ("No output generated by $TestName.")
|
||||||
}
|
}
|
||||||
Out-String -InputObject $Output | Write-Log
|
Out-String -InputObject $Output | Write-Log
|
||||||
|
|
|
@ -94,7 +94,7 @@ if ($Configuration -eq "Release" -and $SkipVerification) {
|
||||||
throw "Invalid parameter. SkipVerification is only supported for Debug builds"
|
throw "Invalid parameter. SkipVerification is only supported for Debug builds"
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($null -eq (Get-Command 'msbuild.exe' -ErrorAction SilentlyContinue)) {
|
if ((Get-Command 'msbuild.exe' -ErrorAction SilentlyContinue) -eq $null) {
|
||||||
throw "Unable to locate msbuild.exe. This command needs to run within a 'Developer Command Prompt'"
|
throw "Unable to locate msbuild.exe. This command needs to run within a 'Developer Command Prompt'"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче