Skip to content

Commit 51cc5a1

Browse files
committed
(new-cli) - change target for generator to .net 7.0
1 parent 906b7c0 commit 51cc5a1

File tree

3 files changed

+9
-65
lines changed

3 files changed

+9
-65
lines changed

new-cli/GitVersion.Cli.Generator/CommandImplGenerator.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System.Collections.Immutable;
22
using Microsoft.CodeAnalysis;
33
using Scriban;
4-
4+
// ReSharper disable InconsistentNaming
55
namespace GitVersion;
66

77
[Generator(LanguageNames.CSharp)]
@@ -83,11 +83,14 @@ private static void GenerateSourceCode(SourceProductionContext context, Immutabl
8383
var commandAttribute = classSymbol.GetAttributeData(CommandAttributeFullName) ?? classSymbol.GetAttributeData(CommandAttributeGenericFullName);
8484
if (commandAttribute is null) return null;
8585

86-
var ctorArguments = commandAttribute.ConstructorArguments.ToImmutableArray();
86+
var ctorArguments = commandAttribute.ConstructorArguments;
8787

8888
var name = Convert.ToString(ctorArguments[0].Value);
8989
var description = Convert.ToString(ctorArguments[1].Value);
9090

91+
ArgumentNullException.ThrowIfNull(name);
92+
ArgumentNullException.ThrowIfNull(description);
93+
9194
ITypeSymbol? parentCommandType = null;
9295
if (commandAttribute.AttributeClass != null && commandAttribute.AttributeClass.TypeArguments.Any())
9396
{
@@ -122,14 +125,16 @@ where optionAttribute is not null
122125
}
123126
private static SettingsPropertyInfo MapToPropertyInfo(IPropertySymbol propertySymbol, AttributeData attribute)
124127
{
125-
var ctorArguments = attribute.ConstructorArguments.ToImmutableArray();
128+
var ctorArguments = attribute.ConstructorArguments;
126129

127130
var aliases = (ctorArguments[0].Kind == TypedConstantKind.Array
128131
? ctorArguments[0].Values.Select(x => Convert.ToString(x.Value)).ToArray()
129-
: new[] { Convert.ToString(ctorArguments[0].Value) }).Select(x => $@"""{x.Trim()}""");
132+
: new[] { Convert.ToString(ctorArguments[0].Value) }).Select(x => $@"""{x?.Trim()}""");
130133
131134
var alias = string.Join(", ", aliases);
132135
var description = Convert.ToString(ctorArguments[1].Value);
136+
ArgumentNullException.ThrowIfNull(description);
137+
133138
var isRequired = propertySymbol.Type.NullableAnnotation == NullableAnnotation.NotAnnotated;
134139
return new SettingsPropertyInfo
135140
{

new-cli/GitVersion.Cli.Generator/GitVersion.Cli.Generator.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>netstandard2.0</TargetFramework>
54
<IsRoslynComponent>true</IsRoslynComponent>
65
<PackageScribanIncludeSource>true</PackageScribanIncludeSource>
76
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>

new-cli/GitVersion.Cli.Generator/Missing.cs

Lines changed: 0 additions & 60 deletions
This file was deleted.

0 commit comments

Comments
 (0)