55var target = Argument ( "target" , "Default" ) ;
66var configuration = Argument ( "configuration" , "Release" ) ;
77
8+ //////////////////////////////////////////////////////////////////////
9+ // MODULES
10+ //////////////////////////////////////////////////////////////////////
11+
12+ #module nuget : ? package = Cake . DotNetTool . Module & version = 0.4 .0
13+
814//////////////////////////////////////////////////////////////////////
915// TOOLS / ADDINS
1016//////////////////////////////////////////////////////////////////////
1117
12- #addin "nuget:https://www.nuget.org/api/v2 ?package=MagicChunks&version=1. 2.0.58 "
13- #tool "nuget :?package=gitreleasemanager &version=0.6 .0"
14- #tool "nuget :?package=GitVersion.CommandLine &version=3.4 .1"
18+ #addin "nuget:?package=MagicChunks&version=2.0.0.119 "
19+ #tool "dotnet :?package=GitReleaseManager.Tool &version=0.11 .0"
20+ #tool "dotnet :?package=GitVersion.Tool &version=5.5 .1"
1521
1622//////////////////////////////////////////////////////////////////////
1723// EXTERNAL SCRIPTS
@@ -88,7 +94,7 @@ Task("Clean")
8894Task( "Create-Release-Notes" )
8995 . Does ( ( ) =>
9096{
91- GitReleaseManagerCreate ( parameters . GitHub . UserName , parameters . GitHub . Password , "cake-build" , "cake-vs" , new GitReleaseManagerCreateSettings {
97+ GitReleaseManagerCreate ( parameters . GitHub . Token , "cake-build" , "cake-vs" , new GitReleaseManagerCreateSettings {
9298 Milestone = parameters . Version . Milestone ,
9399 Name = parameters . Version . Milestone ,
94100 Prerelease = true ,
@@ -114,18 +120,48 @@ Task("Restore")
114120 NuGetRestore ( solutionPath ) ;
115121} ) ;
116122
123+ Task( "Download-Nupkgs" )
124+ . Does ( ( ) =>
125+ {
126+ if ( ! DirectoryExists ( "./nupkgs" ) )
127+ {
128+ Information ( "Creating nupkgs directory..." ) ;
129+ CreateDirectory ( "./nupkgs" ) ;
130+ }
131+
132+ var downloads = new Dictionary < string , string > ( ) ;
133+ downloads . Add ( "https://www.nuget.org/api/v2/package/Cake.Core/0.38.5" , "./nupkgs/cake.core.0.38.5.nupkg" ) ;
134+ downloads . Add ( "https://www.nuget.org/api/v2/package/Cake.Testing/0.38.5" , "./nupkgs/cake.testing.0.38.5.nupkg" ) ;
135+ downloads . Add ( "https://www.nuget.org/api/v2/package/xunit/2.4.1" , "./nupkgs/xunit.2.4.1.nupkg" ) ;
136+ downloads . Add ( "https://www.nuget.org/api/v2/package/xunit.abstractions/2.0.3" , "./nupkgs/xunit.abstractions.2.0.3.nupkg" ) ;
137+ downloads . Add ( "https://www.nuget.org/api/v2/package/xunit.assert/2.4.1" , "./nupkgs/xunit.assert.2.4.1.nupkg" ) ;
138+ downloads . Add ( "https://www.nuget.org/api/v2/package/xunit.core/2.4.1" , "./nupkgs/xunit.core.2.4.1.nupkg" ) ;
139+ downloads . Add ( "https://www.nuget.org/api/v2/package/xunit.extensibility.core/2.4.1" , "./nupkgs/xunit.extensibility.core.2.4.1.nupkg" ) ;
140+ downloads . Add ( "https://www.nuget.org/api/v2/package/xunit.extensibility.execution/2.4.1" , "./nupkgs/xunit.extensibility.execution.2.4.1.nupkg" ) ;
141+ downloads . Add ( "https://www.nuget.org/api/v2/package/xunit.runner.visualstudio/2.4.3" , "./nupkgs/xunit.runner.visualstudio.2.4.3.nupkg" ) ;
142+
143+ foreach ( var download in downloads )
144+ {
145+ if ( ! FileExists ( download . Value ) )
146+ {
147+ Information ( "Downloading {0}" , download . Key ) ;
148+ DownloadFile ( download . Key , download . Value ) ;
149+ }
150+ }
151+ } ) ;
152+
117153Task( "Build" )
118154 . IsDependentOn ( "Clean" )
119155 . IsDependentOn ( "Restore" )
156+ . IsDependentOn ( "Download-Nupkgs" )
120157 . IsDependentOn ( "Update-Manifest-Version" )
121158 . Does ( ( ) =>
122159{
123160 Information ( "Building solution..." ) ;
124161 MSBuild ( solutionPath , settings =>
125162 settings . SetPlatformTarget ( PlatformTarget . MSIL )
126163 . SetMSBuildPlatform ( MSBuildPlatform . x86 )
127- . UseToolVersion ( MSBuildToolVersion . VS2017 )
128- . WithProperty ( "TreatWarningsAsErrors" , "true" )
164+ . UseToolVersion ( MSBuildToolVersion . VS2019 )
129165 . SetVerbosity ( Verbosity . Quiet )
130166 . WithTarget ( "Build" )
131167 . SetConfiguration ( configuration ) ) ;
@@ -145,8 +181,8 @@ Task("Publish-GitHub-Release")
145181 var buildResultDir = Directory ( artifacts ) ;
146182 var packageFile = File ( "Cake.VisualStudio.vsix" ) ;
147183
148- GitReleaseManagerAddAssets ( parameters . GitHub . UserName , parameters . GitHub . Password , "cake-build" , "cake-vs" , parameters . Version . Milestone , buildResultDir + packageFile ) ;
149- GitReleaseManagerClose ( parameters . GitHub . UserName , parameters . GitHub . Password , "cake-build" , "cake-vs" , parameters . Version . Milestone ) ;
184+ GitReleaseManagerAddAssets ( parameters . GitHub . Token , "cake-build" , "cake-vs" , parameters . Version . Milestone , buildResultDir + packageFile ) ;
185+ GitReleaseManagerClose ( parameters . GitHub . Token , "cake-build" , "cake-vs" , parameters . Version . Milestone ) ;
150186} )
151187. OnError ( exception =>
152188{
@@ -182,3 +218,4 @@ Task("AppVeyor")
182218 . IsDependentOn ( "Publish-Extension" ) ;
183219
184220RunTarget( target ) ;
221+
0 commit comments