-
Notifications
You must be signed in to change notification settings - Fork 22
/
PackTarget.cs
32 lines (28 loc) · 1.17 KB
/
PackTarget.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
// ReSharper disable StringLiteralTypo
// ReSharper disable HeapView.DelegateAllocation
// ReSharper disable HeapView.ClosureAllocation
// ReSharper disable ClassNeverInstantiated.Global
// ReSharper disable ReturnTypeCanBeEnumerable.Local
// ReSharper disable InvertIf
namespace Build;
internal class PackTarget(
Commands commands,
ITeamCityArtifactsWriter artifactsWriter,
[Tag(typeof(CompatibilityCheckTarget))]
ITarget<IReadOnlyCollection<Package>> compatibilityCheckTarget)
: IInitializable, ITarget<IReadOnlyCollection<Package>>
{
public Task InitializeAsync(CancellationToken cancellationToken) => commands.RegisterAsync(
this, "Creates NuGet packages", "pack", "p");
[SuppressMessage("Performance", "CA1861:Avoid constant arrays as arguments")]
public async Task<IReadOnlyCollection<Package>> RunAsync(CancellationToken cancellationToken)
{
var packages = await compatibilityCheckTarget.RunAsync(cancellationToken);
foreach (var package in packages)
{
WriteLine(package.Path, Color.Details);
artifactsWriter.PublishArtifact($"{package.Path} => .");
}
return packages;
}
}