From 24053c7dce982e6c6daff52e5b587574efd7c4a1 Mon Sep 17 00:00:00 2001 From: Morteza Jamshidi Date: Mon, 23 Sep 2024 10:28:40 +0200 Subject: [PATCH] Add webview2 plugin to windows 10 node in the CI Add a script to download windows app sdk and webview2 to be used for CI This script downloads NUGET, then tries to download Windows App SDK, WebView2 and CppWinRT libraries and sets appropriate environment paths to be used later by webview2 plugin. Task-number: QTBUG-128447 Task-number: QTBUG-75747 Change-Id: I1b7ff29b1870d0445034590d01caa503c9e3ae0f Reviewed-by: Toni Saario (cherry picked from commit e95025936a706179b7965e3a1aa2b603a381db99) Reviewed-by: Qt Cherry-pick Bot --- coin/platform_configs/cmake_platforms.yaml | 1 + .../provisioning/common/windows/winappsdk.ps1 | 49 +++++++++++++++++++ .../100-winappsdk.ps1 | 1 + 3 files changed, 51 insertions(+) create mode 100644 coin/provisioning/common/windows/winappsdk.ps1 create mode 100644 coin/provisioning/qtci-windows-10_22H2-x86_64/100-winappsdk.ps1 diff --git a/coin/platform_configs/cmake_platforms.yaml b/coin/platform_configs/cmake_platforms.yaml index 9873cf47..96a6cf5c 100644 --- a/coin/platform_configs/cmake_platforms.yaml +++ b/coin/platform_configs/cmake_platforms.yaml @@ -132,6 +132,7 @@ Configurations: 'NON_QTBASE_CMAKE_ARGS=-DFFMPEG_DIR={{.Env.FFMPEG_DIR_MSVC}} -DQT_DEPLOY_FFMPEG=TRUE -DFEATURE_clangcpp=OFF -DINPUT_headersclean=ON', 'LLVM_INSTALL_DIR={{.Env.LLVM_INSTALL_DIR_msvc}}', 'Protobuf_ROOT={{.Env.Protobuf_ROOT_msvc}}', + 'WEBVIEW2_SDK_ROOT={{.Env.WEBVIEW2_SDK_ROOT_x64}}', ] - Id: 'windows-11_24H2-msvc2022' diff --git a/coin/provisioning/common/windows/winappsdk.ps1 b/coin/provisioning/common/windows/winappsdk.ps1 new file mode 100644 index 00000000..9f02ef42 --- /dev/null +++ b/coin/provisioning/common/windows/winappsdk.ps1 @@ -0,0 +1,49 @@ +. "$PSScriptRoot\helpers.ps1" + +# This script installs Windows App SDK + +$nugetPackage = "nuget.exe" +$packageRoot = "C:\Utils\WindowsAppSdk\" + +$cachedUrl = "\\ci-files01-hki.ci.qt.io\provisioning\windows\nuget\$nugetPackage" +$officialUrl = "https://dist.nuget.org/win-x86-commandline/v6.11.0/nuget.exe" +$sdkChecksumSha1 = "5443887cfb5283da5021388d146ebb5febdc82e9" +$package_path = "$packageRoot\\$nugetPackage" + +New-Item -ItemType Directory -Path "$packageRoot" +Download $officialUrl $cachedUrl $package_path +Verify-Checksum $package_path $sdkChecksumSha1 sha1 +Write-Host "Installing Nuget" +Run-Executable "$package_path" "install Microsoft.WindowsAppSDK -OutputDirectory $packageRoot" + +if ([System.Environment]::Is64BitProcess) { + $cppWinRt_path = "C:\Program Files*\Windows Kits\*\bin\*\x64\cppwinrt.exe" +} else { + $cppWinRt_path = "C:\Program Files*\Windows Kits\*\bin\*\x86\cppwinrt.exe" +} + +if (Resolve-Path -Path $cppWinRt_path) { + $cppWinRt_path = $(Resolve-Path -Path $cppWinRt_path).Path +} +else { + Run-Executable "$package_path" "install Microsoft.Windows.CppWinRT -OutputDirectory $packageRoot" + $cppWinRt_path = $(Resolve-Path -Path "$packageRoot\\Microsoft.Windows.CppWinRT.*\\bin\\cppwinrt.exe").Path +} + +$winAppSDK_path = $(Resolve-Path -Path "$packageRoot\Microsoft.WindowsAppSDK.*").Path +$webview2_path = $(Resolve-Path -Path "$packageRoot\Microsoft.Web.WebView*").Path + +Write-Output "CppWinRT Path = $cppWinRt_path" +Write-Output "WindowsAppSdk Path = $winAppSDK_path" +Write-Output "WebView2 Path = $webview2_path" + +if ([System.Environment]::Is64BitProcess) { + Set-EnvironmentVariable "WIN_APP_SDK_ROOT_x64" "$winAppSDK_path" + Set-EnvironmentVariable "WEBVIEW2_SDK_ROOT_x64" "$webview2_path" + Set-EnvironmentVariable "CPP_WIN_RT_PATH_x64" "$cppWinRt_path" +} else { + Set-EnvironmentVariable "WIN_APP_SDK_ROOT_x86" "$winAppSDK_path" + Set-EnvironmentVariable "WEBVIEW2_SDK_ROOT_x86" "$webview2_path" + Set-EnvironmentVariable "CPP_WIN_RT_PATH_x86" "$cppWinRt_path" +} + diff --git a/coin/provisioning/qtci-windows-10_22H2-x86_64/100-winappsdk.ps1 b/coin/provisioning/qtci-windows-10_22H2-x86_64/100-winappsdk.ps1 new file mode 100644 index 00000000..0d20b1ee --- /dev/null +++ b/coin/provisioning/qtci-windows-10_22H2-x86_64/100-winappsdk.ps1 @@ -0,0 +1 @@ +. "$PSScriptRoot\..\common\windows\winappsdk.ps1"