Skip to content

Commit

Permalink
download nuget in build script (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
Scottj1s authored Apr 23, 2020
1 parent f446988 commit f86b8b5
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions build.cmd
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
@echo off

set Net5SdkVersion=5.0.100-preview.4.20213.16
set Net5SdkVersion=5.0.100-preview.4.20217.5

rem Install required .NET 5 SDK version, if necessary
rem Install required .NET 5 SDK version and add to environment
set DOTNET_ROOT=%LocalAppData%\Microsoft\dotnet
set DOTNET_ROOT(86)=%LocalAppData%\Microsoft\dotnet\x86
set path=%DOTNET_ROOT%;%path%
powershell -NoProfile -ExecutionPolicy unrestricted -Command ^
"Write-Host \"##vso[task.setvariable variable=PATH;]${env:LocalAppData}\Microsoft\dotnet;${env:PATH}\"; ^
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ^
&([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) ^
-Version '%Net5SdkVersion%' -Architecture 'x64' -AzureFeed 'https://dotnetcli.blob.core.windows.net/dotnet' "

nuget update -self

rem Set dotnet root and add to path
set DOTNET_ROOT=%LocalAppData%\Microsoft\dotnet
set path=%DOTNET_ROOT%;%path%
-Version '%Net5SdkVersion%' -InstallDir "%DOTNET_ROOT%" -Architecture 'x64' ^
-AzureFeed 'https://dotnetcli.blob.core.windows.net/dotnet' "
powershell -NoProfile -ExecutionPolicy unrestricted -Command ^
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; ^
&([scriptblock]::Create((Invoke-WebRequest -UseBasicParsing 'https://dot.net/v1/dotnet-install.ps1'))) ^
-Version '%Net5SdkVersion%' -InstallDir "%DOTNET_ROOT(86)%" -Architecture 'x86' ^
-AzureFeed 'https://dotnetcli.blob.core.windows.net/dotnet' "

rem User expected to provide global.json with allowPrerelease=true
if not exist %~dp0global.json (
Expand All @@ -27,6 +29,7 @@ if not exist %~dp0global.json (
echo } >> global.json
)

rem Preserve above for Visual Studio launch inheritance
setlocal ENABLEDELAYEDEXPANSION

set cswinrt_platform=%1
Expand Down Expand Up @@ -58,14 +61,20 @@ if "%cswinrt_configuration%"=="" (
set cswinrt_configuration=Release
)

:restore
if not exist .nuget md .nuget
if not exist .nuget\nuget.exe powershell -Command "Invoke-WebRequest https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile .nuget\nuget.exe"
.nuget\nuget update -self
.nuget\nuget.exe restore

:build
echo Building cswinrt for %cswinrt_platform% %cswinrt_configuration%
msbuild cswinrt.sln /p:platform=%cswinrt_platform%;configuration=%cswinrt_configuration%;GenerateTestProjection=true

:test
rem Build/Run xUnit tests, generating xml output report for Azure Devops reporting, via XunitXml.TestLogger NuGet
echo Running cswinrt unit tests for %cswinrt_platform% %cswinrt_configuration%
set dotnet_exe="%LocalAppData%\Microsoft\dotnet\dotnet.exe"
set dotnet_exe="%DOTNET_ROOT%\dotnet.exe"
if not exist %dotnet_exe% (
if %cswinrt_platform%==x86 (
set dotnet_exe="%ProgramFiles(x86)%\dotnet\dotnet.exe"
Expand All @@ -85,4 +94,4 @@ set cswinrt_bin_dir=%~dp0_build\%cswinrt_platform%\%cswinrt_configuration%\cswin
set cswinrt_exe=%cswinrt_bin_dir%cswinrt.exe
set netstandard2_runtime=%~dp0WinRT.Runtime\bin\%cswinrt_configuration%\netstandard2.0\WinRT.Runtime.dll
set netcoreapp5_runtime=%~dp0WinRT.Runtime\bin\%cswinrt_configuration%\netcoreapp5.0\WinRT.Runtime.dll
nuget pack nuget/Microsoft.Windows.CsWinRT.nuspec -Properties cswinrt_exe=%cswinrt_exe%;netstandard2_runtime=%netstandard2_runtime%;netcoreapp5_runtime=%netcoreapp5_runtime% -Version %cswinrt_version% -OutputDirectory %cswinrt_bin_dir% -NonInteractive -Verbosity Detailed
.nuget\nuget pack nuget/Microsoft.Windows.CsWinRT.nuspec -Properties cswinrt_exe=%cswinrt_exe%;netstandard2_runtime=%netstandard2_runtime%;netcoreapp5_runtime=%netcoreapp5_runtime% -Version %cswinrt_version% -OutputDirectory %cswinrt_bin_dir% -NonInteractive -Verbosity Detailed

0 comments on commit f86b8b5

Please sign in to comment.