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

[Release] BuildGVFSForWindows.bat: use nuget on PATH when possible #1678

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 3 additions & 4 deletions MirrorProvider/Scripts/Windows/Build.bat
Expand Up @@ -4,10 +4,9 @@ SET SRC=%~dp0\..\..\..
SET ROOT=%SRC%\..
SET SLN=%SRC%\MirrorProvider\MirrorProvider.sln

SET nuget="%ROOT%\.tools\nuget.exe"
IF NOT EXIST %nuget% (
mkdir %nuget%\..
powershell -ExecutionPolicy Bypass -Command "Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/latest/nuget.exe' -OutFile %nuget%"
FOR /F "tokens=* USEBACKQ" %%F IN (`where nuget.exe`) DO (
SET nuget=%%F
ECHO Found nuget.exe at '%%F'
)

%nuget% restore %SLN%
Expand Down
1 change: 1 addition & 0 deletions Readme.md
Expand Up @@ -39,6 +39,7 @@ If you'd like to build your own VFS for Git Windows installer:
* .NET Core runtime
* Windows 10 SDK (10.0.10240.0)
* Install the .NET Core 2.1 SDK (https://www.microsoft.com/net/download/dotnet-core/2.1)
* Install [`nuget.exe`](https://www.nuget.org/downloads)
* Create a folder to clone into, e.g. `C:\Repos\VFSForGit`
* Clone this repo into the `src` subfolder, e.g. `C:\Repos\VFSForGit\src`
* Run `\src\Scripts\BuildGVFSForWindows.bat`
Expand Down
12 changes: 8 additions & 4 deletions Scripts/BuildGVFSForWindows.bat
Expand Up @@ -8,10 +8,14 @@ IF "%2"=="" (SET "GVFSVersion=0.2.173.2") ELSE (SET "GVFSVersion=%2")

SET SolutionConfiguration=%Configuration%.Windows

SET nuget="%VFS_TOOLSDIR%\nuget.exe"
FOR /F "tokens=* USEBACKQ" %%F IN (`where nuget.exe`) DO (
SET nuget=%%F
ECHO Found nuget.exe at '%%F'
)

IF NOT EXIST %nuget% (
mkdir %nuget%\..
powershell -ExecutionPolicy Bypass -Command "Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/latest/nuget.exe' -OutFile %nuget%"
ECHO ERROR: Could not find nuget.exe on the PATH
exit /b 10
)

:: Acquire vswhere to find dev15 installations reliably.
Expand All @@ -27,7 +31,7 @@ IF NOT EXIST "c:\Program Files (x86)\Windows Kits\10\Include\10.0.10240.0" (

:: Use vswhere to find the latest VS installation with the msbuild component.
:: See https://github.com/Microsoft/vswhere/wiki/Find-MSBuild
for /f "usebackq tokens=*" %%i in (`%vswhere% -all -prerelease -latest -products * -requires Microsoft.Component.MSBuild Microsoft.VisualStudio.Workload.ManagedDesktop Microsoft.VisualStudio.Workload.NativeDesktop Microsoft.VisualStudio.Workload.NetCoreTools Microsoft.Net.Core.Component.SDK.2.1 -find MSBuild\**\Bin\amd64\MSBuild.exe`) do (
for /f "usebackq tokens=*" %%i in (`%vswhere% -all -prerelease -latest -products * -requires Microsoft.Component.MSBuild Microsoft.VisualStudio.Workload.ManagedDesktop Microsoft.VisualStudio.Workload.NativeDesktop Microsoft.Net.Core.Component.SDK.2.1 -find MSBuild\**\Bin\amd64\MSBuild.exe`) do (
set msbuild="%%i"
)

Expand Down
7 changes: 3 additions & 4 deletions Scripts/RestorePackages.bat
Expand Up @@ -7,10 +7,9 @@ IF "%1"=="" (SET "Configuration=Debug") ELSE (SET "Configuration=%1")

SET SolutionConfiguration=%Configuration%.Windows

SET nuget="%VFS_TOOLSDIR%\nuget.exe"
IF NOT EXIST %nuget% (
mkdir %nuget%\..
powershell -ExecutionPolicy Bypass -Command "Invoke-WebRequest 'https://dist.nuget.org/win-x86-commandline/latest/nuget.exe' -OutFile %nuget%"
FOR /F "tokens=* USEBACKQ" %%F IN (`where nuget.exe`) DO (
SET nuget=%%F
ECHO Found nuget.exe at '%%F'
)

dotnet restore %VFS_SRCDIR%\GVFS.sln /p:Configuration=%SolutionConfiguration% /p:VCTargetsPath="C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140" --packages %VFS_PACKAGESDIR% || exit /b 1
Expand Down