Skip to content

Commit eb2b80d

Browse files
committed
Improve pack-weaver task to auto-delete old package.
Updated comments.
1 parent 3cc3cdb commit eb2b80d

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

build/BenchmarkDotNet.Build/Runners/BuildRunner.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
using Cake.Common.Tools.DotNet.Workload.Install;
99
using Cake.Core;
1010
using Cake.Core.IO;
11+
using System.IO;
1112
using System.Linq;
1213

1314
namespace BenchmarkDotNet.Build.Runners;
@@ -24,6 +25,13 @@ public BuildRunner(BuildContext context)
2425
public void PackWeaver()
2526
{
2627
var weaverPath = context.AllPackableSrcProjects.Single(p => p.GetFilename() == "BenchmarkDotNet.Weaver.csproj");
28+
var outputPackageDir = weaverPath.GetDirectory().Combine("packages");
29+
30+
// Delete old package.
31+
foreach (var file in Directory.EnumerateFiles(outputPackageDir.FullPath))
32+
{
33+
File.Delete(file);
34+
}
2735

2836
context.DotNetRestore(weaverPath.GetDirectory().FullPath,
2937
new DotNetRestoreSettings
@@ -43,7 +51,7 @@ public void PackWeaver()
4351

4452
context.DotNetPack(weaverPath.FullPath, new DotNetPackSettings
4553
{
46-
OutputDirectory = weaverPath.GetDirectory().Combine("packages"),
54+
OutputDirectory = outputPackageDir,
4755
MSBuildSettings = context.MsBuildSettingsPack,
4856
Configuration = context.BuildConfiguration
4957
});

src/BenchmarkDotNet.Weaver/BenchmarkDotNet.Weaver.csproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1-
<!-- When any changes are made to this project, increment the WeaverVersionSuffix in the common.props file,
2-
then re-pack with output to \packages, and delete the old nupkg. -->
1+
<!--
2+
If any changes are made to this project, increment the WeaverVersionSuffix in the common.props file,
3+
then run `build.cmd pack-weaver`.
4+
-->
35

46
<Project Sdk="Microsoft.NET.Sdk">
57
<Import Project="..\..\build\common.props" />

src/BenchmarkDotNet.Weaver/src/WeaveAssemblyTask.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
// *****
2+
// If any changes are made to this file, increment the WeaverVersionSuffix in the common.props file,
3+
// then run `build.cmd pack-weaver`.
4+
// *****
5+
16
using AsmResolver.DotNet;
27
using AsmResolver.PE.DotNet.Metadata.Tables.Rows;
38
using Microsoft.Build.Framework;

0 commit comments

Comments
 (0)