Skip to content

Commit df2b00a

Browse files
committed
Hiding irrelevant commands.
1 parent 76a7bd8 commit df2b00a

File tree

4 files changed

+23
-19
lines changed

4 files changed

+23
-19
lines changed

src/PostSharp.Engineering.BuildTools/AppExtensions.cs

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,21 +71,30 @@ internal static void AddCommands( this CommandApp app, Product product )
7171
.WithData( data )
7272
.WithDescription( "Verify that the dependencies of public artifacts have already been publicly deployed" );
7373

74-
root.AddCommand<PrePublishCommand>( "prepublish" )
75-
.WithData( data )
76-
.WithDescription( "Prepares publishing of all packages that have been previously built by the 'build' command" );
74+
if ( product.IsBundle )
75+
{
76+
root.AddCommand<PrePublishCommand>( "prepublish" )
77+
.WithData( data )
78+
.WithDescription( "Prepares publishing of all packages that have been previously built by the 'build' command" );
79+
}
7780

7881
root.AddCommand<PublishCommand>( "publish" )
7982
.WithData( data )
8083
.WithDescription( "Publishes all packages that have been previously built by the 'build' command" );
8184

82-
root.AddCommand<PostPublishCommand>( "postpublish" )
83-
.WithData( data )
84-
.WithDescription( "Finalizes publishing of all packages that have been previously built by the 'build' command" );
85+
if ( product.IsBundle )
86+
{
87+
root.AddCommand<PostPublishCommand>( "postpublish" )
88+
.WithData( data )
89+
.WithDescription( "Finalizes publishing of all packages that have been previously built by the 'build' command" );
90+
}
8591

86-
root.AddCommand<SwapCommand>( "swap" )
87-
.WithData( data )
88-
.WithDescription( "Swaps deployment slots" );
92+
if ( product.Configurations.All.Any( c => c.Swappers is { Length: > 0 } ) )
93+
{
94+
root.AddCommand<SwapCommand>( "swap" )
95+
.WithData( data )
96+
.WithDescription( "Swaps deployment slots" );
97+
}
8998

9099
if ( product.DependencyDefinition.IsVersioned )
91100
{

src/PostSharp.Engineering.BuildTools/Build/Model/Product.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -226,15 +226,7 @@ internal ContainerImageSpec? DockerSpec
226226
/// Gets or sets a value indicating whether the <c>prepare</c> command should generate the <c>nuget.config</c> file.
227227
/// </summary>
228228
public bool GenerateNuGetConfig { get; init; }
229-
230-
/// <summary>
231-
/// Gets or sets path patterns (accepting the <c>*</c> character) that
232-
/// match the name of NuGet packages generated by this product. This is used
233-
/// to generate package mapping settings when <see cref="GenerateNuGetConfig"/>
234-
/// is <c>true</c>.
235-
/// </summary>
236-
public string[] OwnPackagePatterns { get; init; } = [];
237-
229+
238230
/// <summary>
239231
/// Gets or sets the content of the <c>global.json</c> file, if it must be generated by the <c>prepare</c> command. If this property is <c>null</c>,
240232
/// the <c>global.json</c> file is not generated.

src/PostSharp.Engineering.BuildTools/Build/Swapping/SwapCommand.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public static bool ExecuteAfterPublishing( BuildContext context, PublishSettings
2323
return Execute( context, swapSettings );
2424
}
2525

26-
public static bool Execute( BuildContext context, SwapSettings settings )
26+
private static bool Execute( BuildContext context, SwapSettings settings )
2727
{
2828
var product = context.Product;
2929
var configuration = product.Configurations.GetValue( settings.BuildConfiguration );

src/PostSharp.Engineering.BuildTools/Dependencies/Model/ConfigurationSpecific.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using JetBrains.Annotations;
44
using PostSharp.Engineering.BuildTools.Build;
55
using System;
6+
using System.Collections.Generic;
67
using System.Collections.Immutable;
78

89
namespace PostSharp.Engineering.BuildTools.Dependencies.Model;
@@ -34,6 +35,8 @@ public T this[ BuildConfiguration configuration ]
3435
_ => throw new ArgumentOutOfRangeException()
3536
};
3637

38+
public IReadOnlyList<T> All => [this.Debug, this.Release, this.Public];
39+
3740
public T GetValue( BuildConfiguration configuration ) => this[configuration];
3841

3942
public ConfigurationSpecific<T> WithValue( BuildConfiguration configuration, T value )

0 commit comments

Comments
 (0)