Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overhaul build and project systems and drop Mac/POSIX code #1744

Merged
merged 35 commits into from
Jun 29, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
9ec87a2
build: drop old Azure Pipelines YAML CI/PR builds
mjcheetham Jun 28, 2021
3aa29b2
build: drop all old scripts
mjcheetham Jun 28, 2021
bfc909d
GitHooksLoader: move under GVFS dir and migrate proj
mjcheetham Jun 28, 2021
0ce4d9e
build: drop old targets/props and add new ones
mjcheetham Jun 28, 2021
7004ac7
build: drop more Mac/POSIX code
mjcheetham Jun 28, 2021
8602d8a
build: replace GVFS.Build with simpler MSBuild code
mjcheetham Jun 28, 2021
026b7b9
build: migrate VC++ projects to new build
mjcheetham Jun 28, 2021
d53ae03
build: migrate GVFS.Common project
mjcheetham Jun 28, 2021
fc39a8a
build: migrate GVFS.GVFlt project
mjcheetham Jun 28, 2021
edc5a4f
build: migrate GVFS.Virtualization project
mjcheetham Jun 28, 2021
1abeca4
build: migrate GVFS.Platform project
mjcheetham Jun 28, 2021
b60b9da
build: migrate GVFS.Hooks project
mjcheetham Jun 28, 2021
4eb8677
build: migrate GVFS.Upgrader project
mjcheetham Jun 28, 2021
57c2248
build: migrate GVFS.Mount project
mjcheetham Jun 28, 2021
2dbf900
build: migrate GVFS.Service project
mjcheetham Jun 28, 2021
480006a
build: migrate GVFS.Service.UI project
mjcheetham Jun 28, 2021
e5ce040
build: migrate GVFS project
mjcheetham Jun 28, 2021
c55c731
build: migrate FastFetch project
mjcheetham Jun 28, 2021
b9fc1a2
build: migrate GVFS.UnitTests and .Tests projects
mjcheetham Jun 28, 2021
e38a129
build: migrate GVFS.FunctionalTests.LockHolder project
mjcheetham Jun 28, 2021
7c5c374
build: migrate GVFS.PerfProfiling project
mjcheetham Jun 28, 2021
173d930
build: replace GVFS.SignFiles with GVFS.Payload project
mjcheetham Jun 28, 2021
fbf300b
build: migrate GVFS.Installer.Windows project
mjcheetham Jun 28, 2021
5039078
build: merge GVFS.FunctionalTests.Windows tests into main project
mjcheetham Jun 28, 2021
0a93076
build: migrate GVFS.FunctionalTests project file
mjcheetham Jun 28, 2021
2945674
build: drop Mac/POSIX tests and drop WinOnly category
mjcheetham Jun 28, 2021
5853b5a
build: update FTs to run always against PATH
mjcheetham Jun 28, 2021
7437854
build: ignore functional tests that fail in CI only
mjcheetham Jun 28, 2021
5a464b6
build: migrate solution file
mjcheetham Jun 28, 2021
26376f2
build: add back new build scripts (for Windows only)
mjcheetham Jun 28, 2021
073780f
build: add GitHub Actions CI/PR workflow
mjcheetham Jun 28, 2021
072d7bc
build: add (currently unused) AzDO YAML release build
mjcheetham Jun 28, 2021
9f3b02c
build: run functional tests in PR builds
mjcheetham Jun 28, 2021
6933600
build: drop AnyCPU and x86 solution configurations
mjcheetham Jun 28, 2021
103dbfd
build: add releases/shipped to PR build trigger
mjcheetham Jun 29, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions scripts/Build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
@ECHO OFF
CALL %~dp0\InitializeEnvironment.bat || EXIT /b 10
SETLOCAL
SETLOCAL EnableDelayedExpansion

IF "%~1"=="" (
SET CONFIGURATION=Debug
) ELSE (
SET CONFIGURATION=%1
)

IF "%~2"=="" (
SET GVFSVERSION=0.2.173.2
) ELSE (
SET GVFSVERSION=%2
)

IF "%~3"=="" (
SET VERBOSITY=minimal
) ELSE (
SET VERBOSITY=%3
)

REM If we have MSBuild on the PATH then go straight to the build phase
FOR /F "tokens=* USEBACKQ" %%F IN (`where msbuild.exe`) DO (
SET MSBUILD_EXEC=%%F
ECHO INFO: Found msbuild.exe at '%%F'
GOTO :BUILD
)

:LOCATE_MSBUILD
REM Locate MSBuild via the vswhere tool
mjcheetham marked this conversation as resolved.
Show resolved Hide resolved
FOR /F "tokens=* USEBACKQ" %%F IN (`where nuget.exe`) DO (
SET NUGET_EXEC=%%F
ECHO INFO: Found nuget.exe at '%%F'
)

REM NuGet is required to be on the PATH to install vswhere
IF NOT EXIST "%NUGET_EXEC%" (
ECHO ERROR: Could not find nuget.exe on the PATH
EXIT /B 10
)

REM Acquire vswhere to find VS installations reliably
SET VSWHERE_VER=2.6.7
"%NUGET_EXEC%" install vswhere -Version %VSWHERE_VER% || exit /b 1
SET VSWHERE_EXEC=%VFS_PACKAGESDIR%\vswhere.%VSWHERE_VER%\tools\vswhere.exe

REM Assumes default installation location for Windows 10 SDKs
IF NOT EXIST "C:\Program Files (x86)\Windows Kits\10\Include\10.0.16299.0" (
ECHO ERROR: Could not find Windows 10 SDK Version 16299
EXIT /B 1
)

REM Use vswhere to find the latest VS installation with the MSBuild component
REM See https://github.com/Microsoft/vswhere/wiki/Find-MSBuild
FOR /F "tokens=* USEBACKQ" %%F IN (`%VSWHERE_EXEC% -all -prerelease -latest -products * -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\amd64\MSBuild.exe`) DO (
SET MSBUILD_EXEC=%%F
ECHO INFO: Found msbuild.exe at '%%F'
)

:BUILD
IF NOT DEFINED MSBUILD_EXEC (
ECHO ERROR: Could not locate a Visual Studio installation with required components.
ECHO Refer to Readme.md for a list of the required Visual Studio components.
EXIT /B 10
)

ECHO ^**********************
ECHO ^* Restoring Packages *
ECHO ^**********************
"%MSBUILD_EXEC%" %VFS_SRCDIR%\GVFS.sln ^
/t:Restore ^
/v:%VERBOSITY% ^
/p:Configuration=%CONFIGURATION% || GOTO ERROR

ECHO ^*********************
ECHO ^* Building Solution *
ECHO ^*********************
"%MSBUILD_EXEC%" %VFS_SRCDIR%\GVFS.sln ^
/t:Build ^
/v:%VERBOSITY% ^
/p:Configuration=%CONFIGURATION% || GOTO ERROR

GOTO :EOF

:USAGE
ECHO usage: %~n0%~x0 [^<configuration^>] [^<version^>] [^<verbosity^>]
ECHO.
ECHO configuration Solution configuration (default: Debug).
ECHO version GVFS version (default: 0.2.173.2).
ECHO verbosity MSBuild verbosity (default: minimal).
ECHO.
EXIT 1

:ERROR
ECHO ERROR: Build failed with exit code %ERRORLEVEL%
EXIT /B %ERRORLEVEL%
88 changes: 88 additions & 0 deletions scripts/CreateBuildArtifacts.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
@ECHO OFF
CALL %~dp0\InitializeEnvironment.bat || EXIT /b 10
SETLOCAL

IF "%~1"=="" (
SET CONFIGURATION=Debug
) ELSE (
SET CONFIGURATION=%1
)

IF "%~2"=="" (
SET OUTROOT=%VFS_PUBLISHDIR%
) ELSE (
SET OUTROOT=%2
)

REM Check NuGet is on the PATH
where /q nuget.exe
IF ERRORLEVEL 1 (
ECHO ERROR: Could not find nuget.exe on the PATH
EXIT /B 1
)

IF EXIST %OUTROOT% (
rmdir /s /q %OUTROOT%
)

ECHO ^**********************
ECHO ^* Collecting Symbols *
ECHO ^**********************
mkdir %OUTROOT%\Symbols
SET COPY_SYM_CMD="&{Get-ChildItem -Recurse -Path '%VFS_OUTDIR%' -Include *.pdb | Where-Object FullName -Match '\\bin\\.*\\?%CONFIGURATION%\\' | Copy-Item -Destination '%OUTROOT%\Symbols'}"
powershell ^
-NoProfile ^
-ExecutionPolicy Bypass ^
-Command %COPY_SYM_CMD% || GOTO ERROR

ECHO ^******************************
ECHO ^* Collecting GVFS.Installers *
ECHO ^******************************
mkdir %OUTROOT%\GVFS.Installers
xcopy /S /Y ^
%VFS_OUTDIR%\GVFS.Installers\bin\%CONFIGURATION%\win-x64 ^
%OUTROOT%\GVFS.Installers\ || GOTO ERROR

ECHO ^************************
ECHO ^* Collecting FastFetch *
ECHO ^************************
ECHO Collecting FastFetch...
mkdir %OUTROOT%\FastFetch
xcopy /S /Y ^
%VFS_OUTDIR%\FastFetch\bin\%CONFIGURATION%\net461\win-x64 ^
%OUTROOT%\FastFetch\ || GOTO ERROR

ECHO ^***********************************
ECHO ^* Collecting GVFS.FunctionalTests *
ECHO ^***********************************
mkdir %OUTROOT%\GVFS.FunctionalTests
xcopy /S /Y ^
%VFS_OUTDIR%\GVFS.FunctionalTests\bin\%CONFIGURATION%\net461\win-x64 ^
%OUTROOT%\GVFS.FunctionalTests\ || GOTO ERROR

ECHO ^*************************************
ECHO ^* Creating Installers NuGet Package *
ECHO ^*************************************
mkdir %OUTROOT%\NuGetPackages
nuget.exe pack ^
%VFS_OUTDIR%\GVFS.Installers\bin\%CONFIGURATION%\win-x64\GVFS.Installers.nuspec ^
-BasePath %VFS_OUTDIR%\GVFS.Installers\bin\%CONFIGURATION%\win-x64 ^
-OutputDirectory %OUTROOT%\NuGetPackages || GOTO ERROR

REM Move the nuspec file to the NuGetPackages artifact directory
move %OUTROOT%\GVFS.Installers\GVFS.Installers.nuspec ^
%OUTROOT%\NuGetPackages

GOTO :EOF

:USAGE
ECHO usage: %~n0%~x0 [^<configuration^>] [^<destination^>]
ECHO.
ECHO configuration Solution configuration (default: Debug).
ECHO destination Destination directory to copy artifacts (default: %VFS_PUBLISHDIR%).
ECHO.
EXIT 1

:ERROR
ECHO ERROR: Create build artifacts failed with exit code %ERRORLEVEL%
EXIT /B %ERRORLEVEL%
25 changes: 25 additions & 0 deletions scripts/InitializeEnvironment.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
@IF "%_echo%"=="" (ECHO OFF) ELSE (ECHO ON)

REM Set environment variables for interesting paths that scripts might need access to.
PUSHD %~dp0
SET VFS_SCRIPTSDIR=%CD%
POPD

CALL :RESOLVEPATH "%VFS_SCRIPTSDIR%\.."
SET VFS_SRCDIR=%_PARSED_PATH_%

CALL :RESOLVEPATH "%VFS_SRCDIR%\.."
SET VFS_ENLISTMENTDIR=%_PARSED_PATH_%

SET VFS_OUTDIR=%VFS_ENLISTMENTDIR%\out
SET VFS_PACKAGESDIR=%VFS_ENLISTMENTDIR%\packages
SET VFS_PUBLISHDIR=%VFS_ENLISTMENTDIR%\publish

REM Clean up
SET _PARSED_PATH_=

GOTO :EOF

:RESOLVEPATH
SET "_PARSED_PATH_=%~f1"
GOTO :EOF
37 changes: 37 additions & 0 deletions scripts/RunFunctionalTests.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
@ECHO OFF
CALL %~dp0\InitializeEnvironment.bat || EXIT /b 10

IF "%1"=="" (SET "CONFIGURATION=Debug") ELSE (SET "CONFIGURATION=%1")

REM Ensure GVFS installation is on the PATH for the Functional Tests to find
SETLOCAL
SET PATH=C:\Program Files\GVFS;C:\Program Files\Git\cmd;%PATH%

ECHO PATH = %PATH%

ECHO gvfs location:
where gvfs
IF NOT %ERRORLEVEL% == 0 (
ECHO error: unable to locate GVFS on the PATH (has it been installed?)
EXIT /b 1
)

ECHO GVFS.Service location:
where GVFS.Service
IF NOT %ERRORLEVEL% == 0 (
ECHO error: unable to locate GVFS.Service on the PATH (has it been installed?)
EXIT /b 1
)

ECHO git location:
where git
IF NOT %ERRORLEVEL% == 0 (
ECHO error: unable to locate Git on the PATH (has it been installed?)
EXIT /b 1
)

%VFS_OUTDIR%\GVFS.FunctionalTests\bin\%CONFIGURATION%\net461\win-x64\GVFS.FunctionalTests.exe /result:TestResult.xml %2 %3 %4 %5

SET error=%ERRORLEVEL%
CALL %VFS_SCRIPTSDIR%\StopAllServices.bat
EXIT /b %error%
10 changes: 10 additions & 0 deletions scripts/RunUnitTests.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@ECHO OFF
CALL %~dp0\InitializeEnvironment.bat || EXIT /b 10

IF "%1"=="" (SET "CONFIGURATION=Debug") ELSE (SET "CONFIGURATION=%1")

SET RESULT=0

%VFS_OUTDIR%\GVFS.UnitTests\bin\%CONFIGURATION%\net461\win-x64\GVFS.UnitTests.exe || SET RESULT=1

EXIT /b %RESULT%
5 changes: 5 additions & 0 deletions scripts/StopAllServices.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
@ECHO OFF
CALL %~dp0\InitializeEnvironment.bat || EXIT /b 10

CALL %VFS_SCRIPTSDIR%\StopService.bat GVFS.Service
CALL %VFS_SCRIPTSDIR%\StopService.bat Test.GVFS.Service
2 changes: 2 additions & 0 deletions scripts/StopService.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sc stop %1
verify >nul