Skip to content

Commit

Permalink
Merge pull request #3089 from arturcic/feature/cake-update
Browse files Browse the repository at this point in the history
Update cake 2.2.0
  • Loading branch information
arturcic authored Apr 15, 2022
2 parents b17d33e + c612c99 commit 26ee631
Show file tree
Hide file tree
Showing 18 changed files with 71 additions and 155 deletions.
7 changes: 4 additions & 3 deletions build/Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<Project>
<ItemGroup>
<PackageReference Include="Cake.Common" Version="2.1.0" />
<PackageReference Include="Cake.Common" Version="2.2.0" />
<PackageReference Include="Cake.Compression" Version="0.2.6" />
<PackageReference Include="Cake.Frosting" Version="2.1.0" />
<PackageReference Include="Cake.Frosting" Version="2.2.0" />
<PackageReference Include="Cake.Incubator" Version="7.0.0" />
<PackageReference Include="Cake.DotNetLocalTools.Module" Version="1.0.2" />

<PackageReference Include="Cake.Docker" Version="1.1.1" />
<PackageReference Include="Cake.Docker" Version="1.1.2" />

</ItemGroup>
</Project>
7 changes: 6 additions & 1 deletion build/artifacts/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
using Artifacts;
using Common.Lifetime;
using Common.Utilities;

return new CakeHost()
.UseContext<BuildContext>()
.UseStartup<Startup>()
.UseLifetime<BuildLifetime>()
.UseTaskLifetime<BuildTaskLifetime>()
.UseRootDirectory()
.InstallToolsFromRootManifest()
.Run(args);
18 changes: 0 additions & 18 deletions build/artifacts/Startup.cs

This file was deleted.

8 changes: 7 additions & 1 deletion build/build/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
using Build;
using Common.Lifetime;
using Common.Utilities;

return new CakeHost()
.UseContext<BuildContext>()
.UseStartup<Startup>()
.UseLifetime<BuildLifetime>()
.UseTaskLifetime<BuildTaskLifetime>()
.UseRootDirectory()
.InstallToolsFromRootManifest()
.InstallNugetTool(Tools.NugetCmd, Tools.Versions[Tools.NugetCmd])
.Run(args);
20 changes: 0 additions & 20 deletions build/build/Startup.cs

This file was deleted.

24 changes: 24 additions & 0 deletions build/common/Utilities/CakeHostExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using Cake.DotNetLocalTools.Module;

namespace Common.Utilities;

public static class ServicesExtensions
{
public static CakeHost UseRootDirectory(this CakeHost host)
{
host = host.ConfigureServices(services => services.UseWorkingDirectory(Extensions.GetRootDirectory()));
return host;
}

public static CakeHost InstallToolsFromRootManifest(this CakeHost host)
{
host = host.UseModule<LocalToolsModule>().InstallToolsFromManifest(Extensions.GetRootDirectory().CombineWithFilePath("dotnet-tools.json").FullPath);
return host;
}

public static CakeHost InstallNugetTool(this CakeHost host, string toolName, string toolVersion)
{
var toolUrl = new Uri($"nuget:?package={toolName}&version={toolVersion}");
return host.ConfigureServices(services => services.UseTool(toolUrl));
}
}
2 changes: 1 addition & 1 deletion build/common/Utilities/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static DirectoryPath GetRootDirectory()
var currentPath = DirectoryPath.FromString(Directory.GetCurrentDirectory());
while (!Directory.Exists(currentPath.Combine(".git").FullPath))
{
currentPath = DirectoryPath.FromString(Directory.GetParent(currentPath.FullPath)?.FullName);
currentPath = currentPath.GetParent();
}

return currentPath;
Expand Down
18 changes: 0 additions & 18 deletions build/common/Utilities/ServicesExtensions.cs

This file was deleted.

12 changes: 1 addition & 11 deletions build/common/Utilities/Tools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,8 @@ public class Tools
{
public const string NugetCmd = "NuGet.CommandLine";

public const string GitVersion = "GitVersion.Tool";
public const string GitReleaseManager = "GitReleaseManager.Tool";
public const string Codecov = "Codecov.Tool";
public const string Wyam2 = "Wyam2.Tool";

public static readonly Dictionary<string, string> Versions = new()
{
{ NugetCmd, "6.0.0" },

{ GitVersion, "5.8.3" },
{ GitReleaseManager, "0.13.0" },
{ Codecov, "1.13.0" },
{ Wyam2, "3.0.0-rc3&prerelease" },
{ NugetCmd, "6.1.0" },
};
}
7 changes: 6 additions & 1 deletion build/docker/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
using Common.Lifetime;
using Common.Utilities;
using Docker;

return new CakeHost()
.UseContext<BuildContext>()
.UseStartup<Startup>()
.UseLifetime<BuildLifetime>()
.UseTaskLifetime<BuildTaskLifetime>()
.UseRootDirectory()
.InstallToolsFromRootManifest()
.Run(args);
18 changes: 0 additions & 18 deletions build/docker/Startup.cs

This file was deleted.

7 changes: 6 additions & 1 deletion build/docs/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
using Common.Lifetime;
using Common.Utilities;
using Docs;

return new CakeHost()
.UseContext<BuildContext>()
.UseStartup<Startup>()
.UseLifetime<BuildLifetime>()
.UseTaskLifetime<BuildTaskLifetime>()
.UseRootDirectory()
.InstallToolsFromRootManifest()
.Run(args);
19 changes: 0 additions & 19 deletions build/docs/Startup.cs

This file was deleted.

7 changes: 6 additions & 1 deletion build/publish/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
using Common.Lifetime;
using Common.Utilities;
using Publish;

return new CakeHost()
.UseContext<BuildContext>()
.UseStartup<Startup>()
.UseLifetime<BuildLifetime>()
.UseTaskLifetime<BuildTaskLifetime>()
.UseRootDirectory()
.InstallToolsFromRootManifest()
.Run(args);
18 changes: 0 additions & 18 deletions build/publish/Startup.cs

This file was deleted.

7 changes: 6 additions & 1 deletion build/release/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
using Common.Lifetime;
using Common.Utilities;
using Release;

return new CakeHost()
.UseContext<BuildContext>()
.UseStartup<Startup>()
.UseLifetime<BuildLifetime>()
.UseTaskLifetime<BuildTaskLifetime>()
.UseRootDirectory()
.InstallToolsFromRootManifest()
.Run(args);
19 changes: 0 additions & 19 deletions build/release/Startup.cs

This file was deleted.

8 changes: 4 additions & 4 deletions dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
]
},
"gitversion.tool": {
"version": "5.8.2",
"version": "5.10.1",
"commands": [
"dotnet-gitversion"
]
Expand All @@ -20,10 +20,10 @@
"dotnet-gitreleasemanager"
]
},
"wyam.tool": {
"version": "2.2.9",
"Wyam2.Tool": {
"version": "3.0.0-rc3",
"commands": [
"wyam"
"wyam2"
]
}
}
Expand Down

0 comments on commit 26ee631

Please sign in to comment.