Fix Windows build

This commit is contained in:
Filipe PINTO 2025-09-23 14:30:09 +02:00 committed by hurl-bot
parent 48e20ecc48
commit 2f54903dcd
No known key found for this signature in database
GPG Key ID: 1283A2B4A0DCAF8D
7 changed files with 28 additions and 25 deletions

View File

@ -615,8 +615,6 @@ jobs:
package-windows-x64: package-windows-x64:
runs-on: windows-latest runs-on: windows-latest
env:
VCPKGRS_DYNAMIC: 1
steps: steps:
- name: Set git to use LF - name: Set git to use LF
run: | run: |

View File

@ -409,8 +409,6 @@ jobs:
test-windows-x64: test-windows-x64:
runs-on: windows-latest runs-on: windows-latest
env:
VCPKGRS_DYNAMIC: 1
steps: steps:
- name: Set git to use LF - name: Set git to use LF
run: | run: |

View File

@ -3,7 +3,8 @@ $ErrorActionPreference = 'Stop'
write-host -foregroundcolor Cyan "----- activate python venv -----" write-host -foregroundcolor Cyan "----- activate python venv -----"
$global:OriginalPath = $env:PATH
python -m venv "$env:TMP\venv" python -m venv "$env:TMP\venv"
. $env:TMP\venv\Scripts\activate.ps1 . $env:TMP\venv\Scripts\activate.ps1
$env:PATH = "$env:PATH" + ";" + "$global:OriginalPath"
python -m pip install --upgrade pip --quiet python -m pip install --upgrade pip --quiet

View File

@ -8,18 +8,16 @@ $vcpkg_dir=((Get-command vcpkg).Source | Split-Path)
$lib_dir="$vcpkg_dir\installed\x64-windows\bin" $lib_dir="$vcpkg_dir\installed\x64-windows\bin"
git -C $vcpkg_dir pull git -C $vcpkg_dir pull
# install libxml and libcurl[openssl] # install libxml and libcurl
vcpkg install --recurse curl[core,non-http,schannel,ssl,sspi,http2]:x64-windows vcpkg install --recurse curl[core,sspi,http2,non-http,ssl]:x64-windows
vcpkg install --recurse libxml2[core,iconv]:x64-windows vcpkg install --recurse libxml2[core,iconv]:x64-windows
vcpkg update vcpkg update
if ($LASTEXITCODE) { Throw } if ($LASTEXITCODE) { Throw }
vcpkg upgrade --no-dry-run vcpkg upgrade --no-dry-run
if ($LASTEXITCODE) { Throw } if ($LASTEXITCODE) { Throw }
vcpkg integrate install vcpkg integrate install
if ($LASTEXITCODE) { Throw } if ($LASTEXITCODE) { Throw }
Set-ItemProperty -Path HKCU:\Environment -Name VCPKGRS_DYNAMIC -Value "1"
$env:VCPKGRS_DYNAMIC = [System.Environment]::GetEnvironmentVariable("VCPKGRS_DYNAMIC","User")
if ($LASTEXITCODE) { Throw }
# install python 3.11 # install python 3.11
choco install --confirm python311 choco install --confirm python311

View File

@ -6,8 +6,15 @@ write-host -foregroundcolor Cyan "----- create windows64 installer -----"
$actual_dir=(Get-Location).Path $actual_dir=(Get-Location).Path
# install NSIS # install NSIS
if (Get-Command makensis) {echo "makensis already installed"} else {choco install --confirm --no-progress nsis} if (Get-Command makensis -ErrorAction SilentlyContinue) {
echo "makensis already installed"
} else {
choco install --confirm --no-progress nsis
$env:Path = 'C:\Program Files (x86)\NSIS' + ";" + "$env:Path"
}
makensis /VERSION
$nsis_dir=(Get-Command makensis).path | Split-Path -Parent $nsis_dir=(Get-Command makensis).path | Split-Path -Parent
echo "nsis_dir=$nsis_dir"
Expand-Archive -Path "$PSScriptRoot\..\..\bin\windows\EnVar_plugin.zip" -DestinationPath "$nsis_dir" -Force -Verbose Expand-Archive -Path "$PSScriptRoot\..\..\bin\windows\EnVar_plugin.zip" -DestinationPath "$nsis_dir" -Force -Verbose
# create win64 installer # create win64 installer
@ -16,4 +23,3 @@ makensis.exe /NOCD /V4 ..\..\bin\windows\hurl.nsi
if ($LASTEXITCODE) { Throw } if ($LASTEXITCODE) { Throw }
cd $actual_dir cd $actual_dir

View File

@ -6,12 +6,19 @@ write-host -foregroundcolor Cyan "----- build release -----"
$actual_dir=(Get-Location).Path $actual_dir=(Get-Location).Path
$project_root_path=(Resolve-Path -LiteralPath $PSScriptRoot\..\..).path $project_root_path=(Resolve-Path -LiteralPath $PSScriptRoot\..\..).path
# link libs
$actual_path=$env:Path
$vcpkg_dir=(Split-Path -Parent (Get-Command vcpkg).Source) -replace '\\','/'
$lib_dir="$vcpkg_dir/installed/x64-windows/bin"
$env:VCPKGRS_DYNAMIC=1
$env:BINDGEN_EXTRA_CLANG_ARGS="-I$vcpkg_dir/installed/x64-windows/include/libxml2 -v"
$env:Path="$lib_dir" + ";" + "$actual_path"
# build # build
cargo build --release --verbose --locked cargo build --release --verbose --locked
if ($LASTEXITCODE) { Throw } if ($LASTEXITCODE) { Throw }
# create final package # create final package
$lib_dir=((Get-Command vcpkg).Source | Split-path) + "\installed\x64-windows\bin"
$release_dir="$project_root_path\target\release" $release_dir="$project_root_path\target\release"
$package_dir="$project_root_path\target\win-package" $package_dir="$project_root_path\target\win-package"
New-Item -ItemType Directory -Force -Path $package_dir New-Item -ItemType Directory -Force -Path $package_dir
@ -28,7 +35,7 @@ Get-Content $package_dir\version.txt
# add hurl to PATH # add hurl to PATH
$registry_user_path=(Get-ItemProperty -Path 'HKCU:\Environment').Path $registry_user_path=(Get-ItemProperty -Path 'HKCU:\Environment').Path
$registry_machine_path=(Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment').Path $registry_machine_path=(Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager\Environment').Path
$env:Path = "$package_dir;$registry_user_path;$registry_machine_path" $env:Path = $actual_path + ";" + $package_dir + ";" + $registry_user_path + ";" + $registry_machine_path
sleep 10 sleep 10
# hurl infos # hurl infos

View File

@ -3,20 +3,15 @@ $ErrorActionPreference = 'Stop'
write-host -foregroundcolor Cyan "----- unit tests -----" write-host -foregroundcolor Cyan "----- unit tests -----"
# exe dir
$original_env_path="$env:Path"
# lib dir
$vcpkg_dir=((Get-command vcpkg).Source | Split-Path)
$lib_dir="$vcpkg_dir\installed\x64-windows\bin"
# link libs # link libs
$env:Path = "$lib_dir" + ";" + "$original_env_path" $actual_path=$env:Path
$vcpkg_dir=(Split-Path -Parent (Get-Command vcpkg).Source) -replace '\\','/'
$lib_dir="$vcpkg_dir/installed/x64-windows/bin"
$env:VCPKGRS_DYNAMIC=1
$env:BINDGEN_EXTRA_CLANG_ARGS="-I$vcpkg_dir/installed/x64-windows/include/libxml2 -v"
$env:Path="$lib_dir" + ";" + "$actual_path"
# execute test units # execute test units
cargo test --release --tests cargo test --release --tests
if ($LASTEXITCODE) { Throw } if ($LASTEXITCODE) { Throw }
# unlink libs
$env:Path = "$original_env_path"