mirror of
https://github.com/libgit2/libgit2.git
synced 2026-06-22 06:26:26 +00:00
azure: only override PATH when building
We currently unconditionally override the PATH variable with a custom path with the main intent of making available our own custom MinGW installation. This worked quite well so far, but is heavily dependent on the machine we're running this on. And naturally, it fails on the new Windows machines we need to upgrade to, as tools like CMake are not contained in the path we currently set up. Fix this by remodeling the way we set up the PATH environment. Instead of overriding it completely, we now override it only when executing the CMake build.
This commit is contained in:
@@ -107,8 +107,8 @@ jobs:
|
||||
- template: azure-pipelines/powershell.yml
|
||||
parameters:
|
||||
environmentVariables:
|
||||
BUILD_PATH: $(Agent.TempDirectory)\mingw64\bin;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\CMake\bin
|
||||
CMAKE_OPTIONS: -G"MinGW Makefiles" -DDEPRECATE_HARD=ON
|
||||
PATH: $(Agent.TempDirectory)\mingw64\bin;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\CMake\bin
|
||||
|
||||
- job: windows_mingw_x86
|
||||
displayName: 'Windows (x86; MinGW)'
|
||||
@@ -124,8 +124,8 @@ jobs:
|
||||
- template: azure-pipelines/powershell.yml
|
||||
parameters:
|
||||
environmentVariables:
|
||||
BUILD_PATH: $(Agent.TempDirectory)\mingw32\bin;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\CMake\bin
|
||||
CMAKE_OPTIONS: -G"MinGW Makefiles" -DDEPRECATE_HARD=ON
|
||||
PATH: $(Agent.TempDirectory)\mingw32\bin;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\CMake\bin
|
||||
|
||||
- job: documentation
|
||||
displayName: 'Generate Documentation'
|
||||
|
||||
@@ -110,8 +110,8 @@ jobs:
|
||||
- template: powershell.yml
|
||||
parameters:
|
||||
environmentVariables:
|
||||
BUILD_PATH: $(Agent.TempDirectory)\mingw64\bin;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\CMake\bin
|
||||
CMAKE_OPTIONS: -G"MinGW Makefiles" -DDEPRECATE_HARD=ON
|
||||
PATH: $(Agent.TempDirectory)\mingw64\bin;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\CMake\bin
|
||||
RUN_INVASIVE_TESTS: true
|
||||
|
||||
- job: windows_mingw_x86
|
||||
@@ -128,8 +128,8 @@ jobs:
|
||||
- template: powershell.yml
|
||||
parameters:
|
||||
environmentVariables:
|
||||
BUILD_PATH: $(Agent.TempDirectory)\mingw32\bin;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\CMake\bin
|
||||
CMAKE_OPTIONS: -G"MinGW Makefiles" -DDEPRECATE_HARD=ON
|
||||
PATH: $(Agent.TempDirectory)\mingw32\bin;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\CMake\bin
|
||||
RUN_INVASIVE_TESTS: true
|
||||
|
||||
- job: linux_x86_bionic_gcc_openssl
|
||||
|
||||
10
ci/build.ps1
10
ci/build.ps1
@@ -6,6 +6,12 @@ $PSDefaultParameterValues['*:ErrorAction'] = 'Stop'
|
||||
if ($Env:SOURCE_DIR) { $SourceDirectory = $Env:SOURCE_DIR } else { $SourceDirectory = Split-Path (Split-Path $MyInvocation.MyCommand.Path -Parent) -Parent }
|
||||
$BuildDirectory = $(Get-Location).Path
|
||||
|
||||
# Resolve CMake before modifying PATH
|
||||
$CMAKE = (Get-Command cmake).Path
|
||||
|
||||
# Prepend BUILD_PATH to make available our own tools
|
||||
if ($Env:BUILD_PATH) { $Env:PATH = $Env:BUILD_PATH }
|
||||
|
||||
Write-Host "Source directory: ${SourceDirectory}"
|
||||
Write-Host "Build directory: ${BuildDirectory}"
|
||||
Write-Host ""
|
||||
@@ -18,7 +24,7 @@ Write-Host "####################################################################
|
||||
Write-Host "## Configuring build environment"
|
||||
Write-Host "##############################################################################"
|
||||
|
||||
Invoke-Expression "cmake ${SourceDirectory} -DBUILD_EXAMPLES=ON ${Env:CMAKE_OPTIONS}"
|
||||
Invoke-Expression "& '${CMAKE}' ${SourceDirectory} -DBUILD_EXAMPLES=ON ${Env:CMAKE_OPTIONS}"
|
||||
if ($LastExitCode -ne 0) { [Environment]::Exit($LastExitCode) }
|
||||
|
||||
Write-Host ""
|
||||
@@ -26,5 +32,5 @@ Write-Host "####################################################################
|
||||
Write-Host "## Building libgit2"
|
||||
Write-Host "##############################################################################"
|
||||
|
||||
cmake --build .
|
||||
Invoke-Expression "& '${CMAKE}' --build ."
|
||||
if ($LastExitCode -ne 0) { [Environment]::Exit($LastExitCode) }
|
||||
|
||||
Reference in New Issue
Block a user