2020-01-02 06:52:18 -07:00
|
|
|
param([switch]$NoTests)
|
2019-10-22 17:28:56 -07:00
|
|
|
Set-StrictMode -Version Latest
|
2019-10-20 19:30:31 -07:00
|
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
$ProgressPreference = 'SilentlyContinue'
|
2018-03-11 15:44:07 -07:00
|
|
|
|
|
|
|
$env:CONFIGURATION -match '^(?<compiler>\w+)_(?<bits>32|64)(?:-(?<option>\w+))?$'
|
|
|
|
$compiler = $Matches.compiler
|
2019-10-22 17:28:56 -07:00
|
|
|
$compileOption = if ($Matches -contains 'option') {$Matches.option} else {''}
|
2018-03-11 15:44:07 -07:00
|
|
|
$bits = $Matches.bits
|
2019-04-08 15:17:07 -07:00
|
|
|
$cmakeBuildType = $(if ($env:CMAKE_BUILD_TYPE -ne $null) {$env:CMAKE_BUILD_TYPE} else {'RelWithDebInfo'});
|
2019-04-07 15:14:01 -07:00
|
|
|
$buildDir = [System.IO.Path]::GetFullPath("$(pwd)")
|
2018-03-11 15:44:07 -07:00
|
|
|
$depsCmakeVars = @{
|
|
|
|
CMAKE_BUILD_TYPE = $cmakeBuildType;
|
|
|
|
}
|
|
|
|
$nvimCmakeVars = @{
|
|
|
|
CMAKE_BUILD_TYPE = $cmakeBuildType;
|
|
|
|
BUSTED_OUTPUT_TYPE = 'nvim';
|
2019-04-07 15:14:01 -07:00
|
|
|
DEPS_PREFIX=$(if ($env:DEPS_PREFIX -ne $null) {$env:DEPS_PREFIX} else {".deps/usr"});
|
2018-03-11 15:44:07 -07:00
|
|
|
}
|
2019-07-27 02:55:17 -07:00
|
|
|
if ($env:DEPS_BUILD_DIR -eq $null) {
|
|
|
|
$env:DEPS_BUILD_DIR = ".deps";
|
|
|
|
}
|
2018-10-18 21:07:58 -07:00
|
|
|
$uploadToCodeCov = $false
|
2018-03-11 15:44:07 -07:00
|
|
|
|
|
|
|
function exitIfFailed() {
|
|
|
|
if ($LastExitCode -ne 0) {
|
|
|
|
exit $LastExitCode
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-20 17:49:48 -07:00
|
|
|
if (-not $NoTests) {
|
|
|
|
node --version
|
|
|
|
npm.cmd --version
|
2020-01-11 11:04:35 -07:00
|
|
|
}
|
|
|
|
|
2019-07-27 02:55:17 -07:00
|
|
|
if (-Not (Test-Path -PathType container $env:DEPS_BUILD_DIR)) {
|
|
|
|
write-host "cache dir not found: $($env:DEPS_BUILD_DIR)"
|
|
|
|
mkdir $env:DEPS_BUILD_DIR
|
2019-04-07 16:19:38 -07:00
|
|
|
} else {
|
2019-07-27 02:55:17 -07:00
|
|
|
write-host "cache dir $($env:DEPS_BUILD_DIR) size: $(Get-ChildItem $env:DEPS_BUILD_DIR -recurse | Measure-Object -property length -sum | Select -expand sum)"
|
2019-04-07 15:14:01 -07:00
|
|
|
}
|
|
|
|
|
2022-05-15 15:59:58 -07:00
|
|
|
$cmakeGeneratorArgs = '/verbosity:normal'
|
|
|
|
$cmakeGenerator = 'Visual Studio 16 2019'
|
|
|
|
|
|
|
|
$installationPath = vswhere.exe -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
|
|
|
|
if ($installationPath -and (test-path "$installationPath\Common7\Tools\vsdevcmd.bat")) {
|
|
|
|
& "${env:COMSPEC}" /s /c "`"$installationPath\Common7\Tools\vsdevcmd.bat`" -arch=x${bits} -no_logo && set" | foreach-object {
|
|
|
|
$name, $value = $_ -split '=', 2
|
|
|
|
set-content env:\"$name" $value
|
2018-03-11 15:44:07 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-01-02 06:52:18 -07:00
|
|
|
if (-not $NoTests) {
|
2022-01-26 07:12:33 -07:00
|
|
|
python -m ensurepip
|
2021-02-04 20:18:19 -07:00
|
|
|
python -m pip install pynvim ; exitIfFailed
|
2020-01-02 06:52:18 -07:00
|
|
|
# Sanity check
|
|
|
|
python -c "import pynvim; print(str(pynvim))" ; exitIfFailed
|
|
|
|
|
2020-10-18 09:13:27 -07:00
|
|
|
gem.cmd install --pre neovim
|
2020-01-02 06:52:18 -07:00
|
|
|
Get-Command -CommandType Application neovim-ruby-host.bat
|
|
|
|
|
|
|
|
npm.cmd install -g neovim
|
|
|
|
Get-Command -CommandType Application neovim-node-host.cmd
|
|
|
|
npm.cmd link neovim
|
2019-10-20 19:30:31 -07:00
|
|
|
}
|
2019-06-09 04:26:48 -07:00
|
|
|
|
2018-03-11 15:44:07 -07:00
|
|
|
function convertToCmakeArgs($vars) {
|
|
|
|
return $vars.GetEnumerator() | foreach { "-D$($_.Key)=$($_.Value)" }
|
|
|
|
}
|
|
|
|
|
2019-07-27 02:55:17 -07:00
|
|
|
cd $env:DEPS_BUILD_DIR
|
2022-05-15 15:59:58 -07:00
|
|
|
if ($bits -eq 32) {
|
|
|
|
cmake -G $cmakeGenerator -A Win32 $(convertToCmakeArgs($depsCmakeVars)) "$buildDir/third-party/" ; exitIfFailed
|
2021-10-23 18:38:58 -07:00
|
|
|
} else {
|
2022-05-15 15:59:58 -07:00
|
|
|
cmake -G $cmakeGenerator -A x64 $(convertToCmakeArgs($depsCmakeVars)) "$buildDir/third-party/" ; exitIfFailed
|
2021-10-23 18:38:58 -07:00
|
|
|
}
|
2018-03-11 15:44:07 -07:00
|
|
|
cmake --build . --config $cmakeBuildType -- $cmakeGeneratorArgs ; exitIfFailed
|
2019-04-07 15:14:01 -07:00
|
|
|
cd $buildDir
|
2018-03-11 15:44:07 -07:00
|
|
|
|
|
|
|
# Build Neovim
|
|
|
|
mkdir build
|
|
|
|
cd build
|
2022-05-15 15:59:58 -07:00
|
|
|
if ($bits -eq 32) {
|
|
|
|
cmake -G $cmakeGenerator -A Win32 $(convertToCmakeArgs($nvimCmakeVars)) .. ; exitIfFailed
|
2021-10-23 18:38:58 -07:00
|
|
|
} else {
|
2022-05-15 15:59:58 -07:00
|
|
|
cmake -G $cmakeGenerator -A x64 $(convertToCmakeArgs($nvimCmakeVars)) .. ; exitIfFailed
|
2021-10-23 18:38:58 -07:00
|
|
|
}
|
2018-03-11 15:44:07 -07:00
|
|
|
cmake --build . --config $cmakeBuildType -- $cmakeGeneratorArgs ; exitIfFailed
|
2019-06-15 17:33:47 -07:00
|
|
|
.\bin\nvim --version ; exitIfFailed
|
|
|
|
|
|
|
|
# Ensure that the "win32" feature is set.
|
|
|
|
.\bin\nvim -u NONE --headless -c 'exe !has(\"win32\").\"cq\"' ; exitIfFailed
|
2018-03-11 15:44:07 -07:00
|
|
|
|
2019-10-08 18:07:42 -07:00
|
|
|
if ($env:USE_LUACOV -eq 1) {
|
|
|
|
& $env:DEPS_PREFIX\luarocks\luarocks.bat install cluacov
|
|
|
|
}
|
|
|
|
|
2020-01-02 06:52:18 -07:00
|
|
|
if (-not $NoTests) {
|
|
|
|
# Functional tests
|
|
|
|
# The $LastExitCode from MSBuild can't be trusted
|
|
|
|
$failed = $false
|
2020-01-26 15:26:01 -07:00
|
|
|
|
|
|
|
# Run only this test file:
|
|
|
|
# $env:TEST_FILE = "test\functional\foo.lua"
|
2020-01-02 06:52:18 -07:00
|
|
|
cmake --build . --config $cmakeBuildType --target functionaltest -- $cmakeGeneratorArgs 2>&1 |
|
|
|
|
foreach { $failed = $failed -or
|
|
|
|
$_ -match 'functional tests failed with error'; $_ }
|
|
|
|
|
|
|
|
if ($uploadToCodecov) {
|
|
|
|
if ($env:USE_LUACOV -eq 1) {
|
|
|
|
& $env:DEPS_PREFIX\bin\luacov.bat
|
|
|
|
}
|
|
|
|
bash -l /c/projects/neovim/ci/common/submit_coverage.sh functionaltest
|
|
|
|
}
|
|
|
|
if ($failed) {
|
|
|
|
exit $LastExitCode
|
2019-10-08 18:07:42 -07:00
|
|
|
}
|
2018-03-11 15:44:07 -07:00
|
|
|
|
2020-01-02 06:52:18 -07:00
|
|
|
# Old tests
|
|
|
|
# Add MSYS to path, required for e.g. `find` used in test scripts.
|
|
|
|
# But would break functionaltests, where its `more` would be used then.
|
2022-03-02 06:28:41 -07:00
|
|
|
$OldPath = $env:PATH
|
|
|
|
$env:PATH = "C:\msys64\usr\bin;$env:PATH"
|
|
|
|
& "C:\msys64\mingw$bits\bin\mingw32-make.exe" -C $(Convert-Path ..\src\nvim\testdir) VERBOSE=1 ; exitIfFailed
|
|
|
|
$env:PATH = $OldPath
|
|
|
|
|
|
|
|
if ($uploadToCodecov) {
|
|
|
|
bash -l /c/projects/neovim/ci/common/submit_coverage.sh oldtest
|
|
|
|
}
|
2018-03-11 15:44:07 -07:00
|
|
|
}
|
|
|
|
|
2021-10-30 08:49:15 -07:00
|
|
|
# Ensure choco's cpack is not in PATH otherwise, it conflicts with CMake's
|
2021-10-31 11:09:10 -07:00
|
|
|
if (Test-Path -Path $env:ChocolateyInstall\bin\cpack.exe) {
|
2021-10-31 05:42:30 -07:00
|
|
|
Remove-Item -Path $env:ChocolateyInstall\bin\cpack.exe -Force
|
|
|
|
}
|
2021-10-30 08:49:15 -07:00
|
|
|
|
2018-03-11 15:44:07 -07:00
|
|
|
# Build artifacts
|
2022-02-07 13:49:09 -07:00
|
|
|
cpack -C $cmakeBuildType
|