Skip to content

Commit 92f306c

Browse files
committed
Address UI feedback.
1 parent 942de97 commit 92f306c

17 files changed

+95
-293
lines changed

src/Compatibility/ApiDiff/Microsoft.DotNet.ApiDiff.Tool/GenAPIDiffConfigurationBinder.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ internal class GenAPIDiffConfigurationBinder : BinderBase<DiffConfiguration>
2121
private readonly Option<string[]?> _optionAttributesToExclude;
2222
private readonly Option<string[]?> _optionApisToExclude;
2323
private readonly Option<bool> _optionAddPartialModifier;
24-
private readonly Option<bool> _optionHideImplicitDefaultConstructors;
2524
private readonly Option<bool> _optionAttachDebugger;
2625

2726
internal GenAPIDiffConfigurationBinder(Option<string> optionBeforeAssembliesFolderPath,
@@ -36,7 +35,6 @@ internal GenAPIDiffConfigurationBinder(Option<string> optionBeforeAssembliesFold
3635
Option<string[]?> optionAttributesToExclude,
3736
Option<string[]?> optionApisToExclude,
3837
Option<bool> optionAddPartialModifier,
39-
Option<bool> optionHideImplicitDefaultConstructors,
4038
Option<bool> optionAttachDebugger)
4139
{
4240
_optionBeforeAssembliesFolderPath = optionBeforeAssembliesFolderPath;
@@ -51,7 +49,6 @@ internal GenAPIDiffConfigurationBinder(Option<string> optionBeforeAssembliesFold
5149
_optionAttributesToExclude = optionAttributesToExclude;
5250
_optionApisToExclude = optionApisToExclude;
5351
_optionAddPartialModifier = optionAddPartialModifier;
54-
_optionHideImplicitDefaultConstructors = optionHideImplicitDefaultConstructors;
5552
_optionAttachDebugger = optionAttachDebugger;
5653
}
5754

@@ -69,7 +66,6 @@ protected override DiffConfiguration GetBoundValue(BindingContext bindingContext
6966
AttributesToExclude: bindingContext.ParseResult.GetValueForOption(_optionAttributesToExclude),
7067
ApisToExclude: bindingContext.ParseResult.GetValueForOption(_optionApisToExclude),
7168
AddPartialModifier: bindingContext.ParseResult.GetValueForOption(_optionAddPartialModifier),
72-
HideImplicitDefaultConstructors: bindingContext.ParseResult.GetValueForOption(_optionHideImplicitDefaultConstructors),
7369
AttachDebugger: bindingContext.ParseResult.GetValueForOption(_optionAttachDebugger)
7470
);
7571
}

src/Compatibility/ApiDiff/Microsoft.DotNet.ApiDiff.Tool/Program.cs

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,28 @@ public static async Task Main(string[] args)
1919

2020
Option<string> optionBeforeAssembliesFolderPath = new(["--before", "-b"])
2121
{
22-
Description = "The path to the folder containing the old (before) assemblies.",
22+
Description = "The path to the folder containing the old (before) assemblies to be included in the diff.",
2323
Arity = ArgumentArity.ExactlyOne,
2424
IsRequired = true
2525
};
2626

2727
Option<string> optionBeforeRefAssembliesFolderPath = new(["--refbefore", "-rb"])
2828
{
29-
Description = "The path to the folder containing the old (before) reference assemblies.",
29+
Description = "The path to the folder containing the references required by old (before) assemblies, not to be included in the diff.",
3030
Arity = ArgumentArity.ExactlyOne,
3131
IsRequired = false
3232
};
3333

3434
Option<string> optionAfterAssembliesFolderPath = new(["--after", "-a"])
3535
{
36-
Description = "The path to the folder containing the new (after) assemblies.",
36+
Description = "The path to the folder containing the new (after) assemblies to be included in the diff.",
3737
Arity = ArgumentArity.ExactlyOne,
38-
IsRequired = false
38+
IsRequired = true
3939
};
4040

4141
Option<string> optionAfterRefAssembliesFolderPath = new(["--refafter", "-ra"])
4242
{
43-
Description = "The path to the folder containing the new (after) reference assemblies.",
43+
Description = "The path to the folder containing references required by the new (after) reference assemblies, not to be included in the diff.",
4444
Arity = ArgumentArity.ExactlyOne,
4545
IsRequired = false
4646
};
@@ -66,16 +66,16 @@ public static async Task Main(string[] args)
6666
IsRequired = true
6767
};
6868

69-
Option<string> optionTableOfContentsTitle = new(["--tableOfContentsTitle", "-tc"])
69+
Option<string> optionTableOfContentsTitle = new(["--tableOfContentsTitle", "-tc"], () => "api_diff")
7070
{
71-
Description = "The title of the markdown table of contents file that is placed in the output folder.",
72-
Arity = ArgumentArity.ExactlyOne,
71+
Description = $"The optional title of the markdown table of contents file that is placed in the output folder.",
72+
Arity = ArgumentArity.ZeroOrMore,
7373
IsRequired = true
7474
};
7575

7676
Option<string[]?> optionAssembliesToExclude = new(["--assembliesToExclude", "-eas"], () => null)
7777
{
78-
Description = "Assemblies to exclude from the diff.",
78+
Description = "Assemblies from both before and after to exclude from the diff.",
7979
Arity = ArgumentArity.ZeroOrMore,
8080
IsRequired = false,
8181
};
@@ -99,11 +99,6 @@ public static async Task Main(string[] args)
9999
Description = "Add the 'partial' modifier to types."
100100
};
101101

102-
Option<bool> optionHideImplicitDefaultConstructors = new(["--hideImplicitDefaultConstructors", "-hidc"], () => false)
103-
{
104-
Description = "Hide implicit default constructors from types."
105-
};
106-
107102
Option<bool> optionAttachDebugger = new(["--attachDebugger", "-d"], () => false)
108103
{
109104
Description = "Stops the tool at startup, prints the process ID and waits for a debugger to attach."
@@ -122,7 +117,6 @@ public static async Task Main(string[] args)
122117
rootCommand.Add(optionAttributesToExclude);
123118
rootCommand.Add(optionApisToExclude);
124119
rootCommand.Add(optionAddPartialModifier);
125-
rootCommand.Add(optionHideImplicitDefaultConstructors);
126120
rootCommand.Add(optionAttachDebugger);
127121

128122
GenAPIDiffConfigurationBinder c = new(optionBeforeAssembliesFolderPath,
@@ -137,7 +131,6 @@ public static async Task Main(string[] args)
137131
optionAttributesToExclude,
138132
optionApisToExclude,
139133
optionAddPartialModifier,
140-
optionHideImplicitDefaultConstructors,
141134
optionAttachDebugger);
142135

143136
rootCommand.SetHandler(async (DiffConfiguration diffConfig) => await HandleCommandAsync(diffConfig).ConfigureAwait(false), c);
@@ -166,7 +159,6 @@ private static Task HandleCommandAsync(DiffConfiguration diffConfig)
166159
log.LogMessage($" - 'After' friendly name: {diffConfig.AfterFriendlyName}");
167160
log.LogMessage($" - Table of contents title: {diffConfig.TableOfContentsTitle}");
168161
log.LogMessage($" - Add partial modifier to types: {diffConfig.AddPartialModifier}");
169-
log.LogMessage($" - Hide implicit default constructors: {diffConfig.HideImplicitDefaultConstructors}");
170162
log.LogMessage($" - Attach debugger: {diffConfig.AttachDebugger}");
171163
log.LogMessage("");
172164

@@ -188,7 +180,6 @@ private static Task HandleCommandAsync(DiffConfiguration diffConfig)
188180
diffConfig.AttributesToExclude,
189181
diffConfig.ApisToExclude,
190182
diffConfig.AddPartialModifier,
191-
diffConfig.HideImplicitDefaultConstructors,
192183
writeToDisk: true,
193184
diagnosticOptions: null // TODO: If needed, add CLI option to pass specific diagnostic options
194185
);

src/Compatibility/ApiDiff/Microsoft.DotNet.ApiDiff/DiffConfiguration.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,5 @@ public record DiffConfiguration(
1919
string[]? AttributesToExclude,
2020
string[]? ApisToExclude,
2121
bool AddPartialModifier,
22-
bool HideImplicitDefaultConstructors,
2322
bool AttachDebugger
2423
);

src/Compatibility/ApiDiff/Microsoft.DotNet.ApiDiff/DiffGeneratorFactory.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public static class DiffGeneratorFactory
4646
/// <param name="attributesToExclude">An optional list of attributes to avoid showing in the diff. If <see langword="null"/>, the default list of attributes to exclude <see cref="DiffGeneratorFactory.DefaultAttributesToExclude"/> is used. If an empty list, no attributes are excluded.</param>
4747
/// <param name="apisToExclude">An optional list of APIs to avoid showing in the diff.</param>
4848
/// <param name="addPartialModifier">Indicates whether to add the partial modifier to types.</param>
49-
/// <param name="hideImplicitDefaultConstructors">Indicates whether to hide implicit default constructors.</param>
5049
/// <param name="writeToDisk">If <see langword="true"/>, when calling <see cref="IDiffGenerator.RunAsync"/>, the generated markdown files get written to disk, and no item is added to the <see cref="IDiffGenerator.RunAsync"/> dictionary. If <see langword="false"/>, when calling <see cref="IDiffGenerator.RunAsync"/>, the generated markdown files get added to the <see cref="IDiffGenerator.RunAsync"/> dictionary (with the file path as the dictionary key) and none of them is written to disk. This is meant for testing purposes.</param>
5150
/// <param name="diagnosticOptions">An optional list of diagnostic options to use when generating the diff.</param>
5251
/// <returns>A new instance of <see cref="IDiffGenerator"/> that writes the diff to disk.</returns>
@@ -64,7 +63,6 @@ public static IDiffGenerator Create(ILog log,
6463
string[]? attributesToExclude,
6564
string[]? apisToExclude,
6665
bool addPartialModifier,
67-
bool hideImplicitDefaultConstructors,
6866
bool writeToDisk,
6967
IEnumerable<KeyValuePair<string, ReportDiagnostic>>? diagnosticOptions = null)
7068
{
@@ -81,7 +79,6 @@ public static IDiffGenerator Create(ILog log,
8179
attributesToExclude,
8280
apisToExclude,
8381
addPartialModifier,
84-
hideImplicitDefaultConstructors,
8582
writeToDisk,
8683
diagnosticOptions);
8784
}
@@ -97,7 +94,6 @@ public static IDiffGenerator Create(ILog log,
9794
/// <param name="attributesToExclude">An optional list of attributes to avoid showing in the diff. If <see langword="null"/>, the default list of attributes to exclude <see cref="DiffGeneratorFactory.DefaultAttributesToExclude"/> is used. If an empty list, no attributes are excluded.</param>
9895
/// <param name="apisToExclude">An optional list of APIs to avoid showing in the diff.</param>
9996
/// <param name="addPartialModifier">Indicates whether to add the partial modifier to types.</param>
100-
/// <param name="hideImplicitDefaultConstructors">Indicates whether to hide implicit default constructors.</param>
10197
/// <param name="diagnosticOptions">An optional list of diagnostic options to use when generating the diff.</param>
10298
/// <returns>A new instance of <see cref="IDiffGenerator"/> that writes the diff to memory.</returns>
10399
public static IDiffGenerator Create(ILog log,
@@ -108,7 +104,6 @@ public static IDiffGenerator Create(ILog log,
108104
string[]? attributesToExclude,
109105
string[]? apisToExclude,
110106
bool addPartialModifier,
111-
bool hideImplicitDefaultConstructors,
112107
IEnumerable<KeyValuePair<string, ReportDiagnostic>>? diagnosticOptions = null)
113108
{
114109
return new MemoryOutputDiffGenerator(log,
@@ -119,7 +114,6 @@ public static IDiffGenerator Create(ILog log,
119114
attributesToExclude,
120115
apisToExclude,
121116
addPartialModifier,
122-
hideImplicitDefaultConstructors,
123117
diagnosticOptions);
124118
}
125119
}

src/Compatibility/ApiDiff/Microsoft.DotNet.ApiDiff/FileOutputDiffGenerator.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ internal sealed class FileOutputDiffGenerator : IDiffGenerator
2626
private readonly string[] _attributesToExclude;
2727
private readonly string[] _apisToExclude;
2828
private readonly bool _addPartialModifier;
29-
private readonly bool _hideImplicitDefaultConstructors;
3029
private readonly bool _writeToDisk;
3130
private readonly IEnumerable<KeyValuePair<string, ReportDiagnostic>>? _diagnosticOptions;
3231
private readonly Dictionary<string, string> _results;
@@ -47,7 +46,6 @@ internal sealed class FileOutputDiffGenerator : IDiffGenerator
4746
/// <param name="attributesToExclude">An optional list of attributes to avoid showing in the diff. If <see langword="null"/>, the default list of attributes to exclude <see cref="DiffGeneratorFactory.DefaultAttributesToExclude"/> is used. If an empty list, no attributes are excluded.</param>
4847
/// <param name="apisToExclude">An optional list of APIs to avoid showing in the diff.</param>
4948
/// <param name="addPartialModifier">A value indicating whether to add the partial modifier to types.</param>
50-
/// <param name="hideImplicitDefaultConstructors">A value indicating whether to hide implicit default constructors.</param>
5149
/// <param name="writeToDisk">If <see langword="true"/>, when calling <see cref="RunAsync"/>, the generated markdown files get written to disk, and no item is added to the <see cref="RunAsync"/> dictionary. If <see langword="false"/>, when calling <see cref="RunAsync"/>, the generated markdown files get added to the <see cref="RunAsync"/> dictionary (with the file path as the dictionary key) and none of them is written to disk. This is meant for testing purposes.</param>
5250
/// <param name="diagnosticOptions">An optional set of diagnostic options.</param>
5351
internal FileOutputDiffGenerator(ILog log,
@@ -63,7 +61,6 @@ internal FileOutputDiffGenerator(ILog log,
6361
string[]? attributesToExclude,
6462
string[]? apisToExclude,
6563
bool addPartialModifier,
66-
bool hideImplicitDefaultConstructors,
6764
bool writeToDisk,
6865
IEnumerable<KeyValuePair<string, ReportDiagnostic>>? diagnosticOptions = null)
6966

@@ -81,7 +78,6 @@ internal FileOutputDiffGenerator(ILog log,
8178
_attributesToExclude = attributesToExclude ?? DiffGeneratorFactory.DefaultAttributesToExclude;
8279
_apisToExclude = apisToExclude ?? [];
8380
_addPartialModifier = addPartialModifier;
84-
_hideImplicitDefaultConstructors = hideImplicitDefaultConstructors;
8581
_writeToDisk = writeToDisk;
8682
_diagnosticOptions = diagnosticOptions ?? DiffGeneratorFactory.DefaultDiagnosticOptions;
8783
_results = [];
@@ -120,7 +116,6 @@ public async Task RunAsync()
120116
_attributesToExclude,
121117
_apisToExclude,
122118
_addPartialModifier,
123-
_hideImplicitDefaultConstructors,
124119
_diagnosticOptions);
125120

126121
await generator.RunAsync().ConfigureAwait(false);

src/Compatibility/ApiDiff/Microsoft.DotNet.ApiDiff/MemoryOutputDiffGenerator.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ public class MemoryOutputDiffGenerator : IDiffGenerator
3131
private readonly ConcurrentDictionary<string, IAssemblySymbol> _beforeAssemblySymbols;
3232
private readonly ConcurrentDictionary<string, IAssemblySymbol> _afterAssemblySymbols;
3333
private readonly bool _addPartialModifier;
34-
private readonly bool _hideImplicitDefaultConstructors;
3534
private readonly ISymbolFilter _attributeSymbolFilter;
3635
private readonly ISymbolFilter _symbolFilter;
3736
private readonly SyntaxTriviaList _twoSpacesTrivia;
@@ -53,7 +52,6 @@ public class MemoryOutputDiffGenerator : IDiffGenerator
5352
/// <param name="attributesToExclude">An optional list of attributes to avoid showing in the diff. If <see langword="null"/>, the default list of attributes to exclude <see cref="DiffGeneratorFactory.DefaultAttributesToExclude"/> is used. If an empty list, no attributes are excluded.</param>
5453
/// <param name="apisToExclude">An optional list of APIs to avoid showing in the diff.</param>
5554
/// <param name="addPartialModifier">A boolean indicating whether to add the partial modifier to types.</param>
56-
/// <param name="hideImplicitDefaultConstructors">A boolean indicating whether to hide implicit default constructors.</param>
5755
/// <param name="diagnosticOptions">An optional dictionary of diagnostic options.</param>
5856
internal MemoryOutputDiffGenerator(
5957
ILog log,
@@ -64,7 +62,6 @@ internal MemoryOutputDiffGenerator(
6462
string[]? attributesToExclude,
6563
string[]? apisToExclude,
6664
bool addPartialModifier,
67-
bool hideImplicitDefaultConstructors,
6865
IEnumerable<KeyValuePair<string, ReportDiagnostic>>? diagnosticOptions = null)
6966
{
7067
_log = log;
@@ -73,7 +70,6 @@ internal MemoryOutputDiffGenerator(
7370
_beforeAssemblySymbols = new ConcurrentDictionary<string, IAssemblySymbol>(beforeAssemblySymbols);
7471
_afterAssemblySymbols = new ConcurrentDictionary<string, IAssemblySymbol>(afterAssemblySymbols);
7572
_addPartialModifier = addPartialModifier;
76-
_hideImplicitDefaultConstructors = hideImplicitDefaultConstructors;
7773
_diagnosticOptions = diagnosticOptions ?? DiffGeneratorFactory.DefaultDiagnosticOptions;
7874
_attributeSymbolFilter = SymbolFilterFactory.GetFilterFromList(attributesToExclude ?? DiffGeneratorFactory.DefaultAttributesToExclude, includeExplicitInterfaceImplementationSymbols: true);
7975
_symbolFilter = SymbolFilterFactory.GetFilterFromList(apisToExclude ?? [], includeExplicitInterfaceImplementationSymbols: true);
@@ -174,7 +170,7 @@ private async Task<string> ProcessAfterAssemblyAsync(IAssemblySymbol afterAssemb
174170
{
175171
CSharpAssemblyDocumentGeneratorOptions options = new(loader, _symbolFilter, _attributeSymbolFilter)
176172
{
177-
HideImplicitDefaultConstructors = _hideImplicitDefaultConstructors,
173+
HideImplicitDefaultConstructors = false,
178174
ShouldFormat = true,
179175
ShouldReduce = false,
180176
MetadataReferences = loader.MetadataReferences,

0 commit comments

Comments
 (0)