From 2770eca1bf061bbaaec90d4cbcd876d383ef4114 Mon Sep 17 00:00:00 2001 From: Konstantinos Karakostas Date: Sun, 2 Oct 2022 20:22:48 +0300 Subject: [PATCH] tools: use dotnet build in VS2015 CI --- appveyor.yml | 8 ++++++ build/VStudio/dotnet/winfsp.net.csproj | 20 ++------------ build/VStudio/testing/memfs-dotnet.csproj | 32 +++++++++++------------ tools/build.bat | 8 ++++++ tools/gensrc/remove-build-dotnet.bat | 17 ++++++++++++ tools/gensrc/remove-sln-project.ps1 | 12 +++++++++ 6 files changed, 63 insertions(+), 34 deletions(-) create mode 100644 tools/gensrc/remove-build-dotnet.bat create mode 100644 tools/gensrc/remove-sln-project.ps1 diff --git a/appveyor.yml b/appveyor.yml index 45c7c2c4..9afddef1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -51,6 +51,11 @@ install: $targets.Save("C:\Program Files (x86)\Windows Kits\10\build\WindowsDriver.Common.targets") Add-AppveyorMessage "Hack to make WDK 1903 work on VS2015" } +# Install .NET SDK on VS2015 image +- ps: | + if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2015") { + & ([scriptblock]::Create((New-Object System.Net.WebClient).DownloadString('https://dot.net/v1/dotnet-install.ps1'))) -InstallDir "C:\dotnet" + } # Submodules - git submodule update --init --recursive # Kernel and user mode dumps @@ -76,6 +81,9 @@ build_script: # remove ARM64 project configurations to build in VS2015/VS2017 - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" tools\gensrc\remove-build-arm64.bat - if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" tools\gensrc\remove-build-arm64.bat +# remove .NET library from solution for VS2015 and use the .NET SDK instead +- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" tools\gensrc\remove-build-dotnet.bat build\VStudio +- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" set PATH=C:\dotnet;%PATH% # build winfsp - tools\build.bat %CONFIGURATION% diff --git a/build/VStudio/dotnet/winfsp.net.csproj b/build/VStudio/dotnet/winfsp.net.csproj index d1eb9a0e..34dbc2f2 100644 --- a/build/VStudio/dotnet/winfsp.net.csproj +++ b/build/VStudio/dotnet/winfsp.net.csproj @@ -9,25 +9,9 @@ Fsp $(MyProductFileName)-msil 512 + true + $(BaseIntermediateOutputPath)$(Configuration)\$(MyProductFileName)-msil.xml true - - - true - full - false - DEBUG;TRACE - prompt - 4 - $(BaseIntermediateOutputPath)$(Configuration)\$(MyProductFileName)-msil.xml - 1591 - - - pdbonly - true - TRACE - prompt - 4 - $(BaseIntermediateOutputPath)$(Configuration)\$(MyProductFileName)-msil.xml 1591 diff --git a/build/VStudio/testing/memfs-dotnet.csproj b/build/VStudio/testing/memfs-dotnet.csproj index 857ce9f4..f47c2304 100644 --- a/build/VStudio/testing/memfs-dotnet.csproj +++ b/build/VStudio/testing/memfs-dotnet.csproj @@ -1,17 +1,17 @@ - - - - Exe - net452 - memfs-dotnet - memfs - memfs-dotnet-msil - 512 - - - - - - - + + + + Exe + net452 + memfs-dotnet + memfs + memfs-dotnet-msil + 512 + + + + + + + \ No newline at end of file diff --git a/tools/build.bat b/tools/build.bat index 9e5ebad7..a95877e0 100755 --- a/tools/build.bat +++ b/tools/build.bat @@ -27,6 +27,7 @@ if X%~nx0==Xbuild-choco.bat ( set BuildArm64=yes if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" ( set BuildArm64=no + set UseDotnetSdk=yes ) if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" ( set BuildArm64=no @@ -56,6 +57,13 @@ if X%SignedPackage%==X ( if exist build\ for /R build\ %%d in (%Configuration%) do ( if exist "%%d" rmdir /s/q "%%d" ) + + if X%UseDotnetSdk%==Xyes ( + dotnet build ./dotnet/ -c "%Configuration%" -p:SolutionDir=..\ + if errorlevel 1 goto fail + dotnet build ./testing/memfs-dotnet.csproj -c "%Configuration%" -p:SolutionDir=..\ + if errorlevel 1 goto fail + ) if X%BuildArm64%==Xyes ( devenv winfsp.sln /build "%Configuration%|ARM64" diff --git a/tools/gensrc/remove-build-dotnet.bat b/tools/gensrc/remove-build-dotnet.bat new file mode 100644 index 00000000..a12423d2 --- /dev/null +++ b/tools/gensrc/remove-build-dotnet.bat @@ -0,0 +1,17 @@ +@echo off + +setlocal +setlocal EnableDelayedExpansion + +if "%1"=="" ( + cd %~dp0..\.. +) else ( + cd "%1" +) + + +if exist winfsp.sln ( + powershell -NoProfile -ExecutionPolicy Bypass -Command "& '%~dp0remove-sln-project.ps1' -Path '%cd%\winfsp.sln' -Match '*dotnet*' +) else ( + echo winfsp.sln not found in %cd% +) diff --git a/tools/gensrc/remove-sln-project.ps1 b/tools/gensrc/remove-sln-project.ps1 new file mode 100644 index 00000000..ccf8856e --- /dev/null +++ b/tools/gensrc/remove-sln-project.ps1 @@ -0,0 +1,12 @@ +param ( + [Parameter(Mandatory)][string]$Path, + [Parameter(Mandatory)][string]$Match +) + +echo "Removing projects that match $($Match) from $($Path)" + +Get-Content $Path -Delimiter 'EndProject' | + Where-Object {$_ -notlike $Match} | + Set-Content "$($Path).new" + + Move-Item -Path "$($Path).new" -Destination $Path -Force \ No newline at end of file