1
1
2
- using System ;
3
- using System . Collections . Generic ;
4
- using System . Collections . Immutable ;
5
2
using System . ComponentModel . DataAnnotations ;
6
- using System . Linq ;
7
- using System . Text ;
8
- using System . Threading . Tasks ;
9
3
10
4
namespace ProgrammerAL . Tools . CodeUpdater ;
11
5
@@ -28,51 +22,72 @@ public class UpdateOptions
28
22
public required IEnumerable < string > IgnorePatterns { get ; set ; }
29
23
30
24
/// <summary>
31
- /// Npm command to run to \"compile\" the npm directory. Format run is: npm run <NpmBuildCommand>.
25
+ /// Options for updating C# projects and code
26
+ /// </summary>
27
+ public CSharpOptions ? CSharpOptions { get ; set ; }
28
+
29
+ /// <summary>
30
+ /// Options for updating Npm packages
31
+ /// </summary>
32
+ public NpmOptions ? NpmOptions { get ; set ; }
33
+
34
+ /// <summary>
35
+ /// Options for output logging of the operation
36
+ /// </summary>
37
+ public LoggingOptions ? LoggingOptions { get ; set ; }
38
+ }
39
+
40
+ public class NpmOptions
41
+ {
42
+ /// <summary>
43
+ /// Npm command to \"compile\" the npm directory. Format run is: npm run <NpmBuildCommand>.
32
44
/// </summary>
33
45
[ Required ( AllowEmptyStrings = false ) ]
34
46
public required string NpmBuildCommand { get ; set ; }
47
+ }
35
48
36
- public DotNetVersioningOptions ? DotNetVersioningOptions { get ; set ; }
37
-
38
- public DotNetAnalyzerOptions ? DotNetAnalyzerOptions { get ; set ; }
49
+ public class CSharpOptions
50
+ {
51
+ /// <summary>
52
+ /// Versioning options for csproj files
53
+ /// </summary>
54
+ public CsProjVersioningOptions ? CsProjVersioningOptions { get ; set ; }
39
55
40
56
/// <summary>
41
- /// Settings to use for configuring Nuget Audit settings in csproj files.
42
- /// You can read more at https://learn.microsoft.com/en-us/nuget/concepts/auditing-packages#configuring-nuget-audit
57
+ /// Analyzers that are set in the csproj files
43
58
/// </summary>
44
- public NugetAuditOptions ? NugetAudit { get ; set ; }
59
+ public CsProjDotNetAnalyzerOptions ? CsProjDotNetAnalyzerOptions { get ; set ; }
45
60
46
61
/// <summary>
47
- /// True to run the `dotnet format` command
62
+ /// Options for any code styling updates that will be performed over C# code
48
63
/// </summary>
49
- [ Required ]
50
- public required bool RunDotnetFormat { get ; set ; }
64
+ public CSharpStyleOptions ? CSharpStyleOptions { get ; set ; }
51
65
52
66
/// <summary>
53
- /// If this is set, it will be the file to write logs to, in addition to the console
67
+ /// Settings to use for configuring Nuget Audit settings in csproj files.
68
+ /// You can read more at https://learn.microsoft.com/en-us/nuget/concepts/auditing-packages#configuring-nuget-audit
54
69
/// </summary>
55
- public string ? OutputFile { get ; set ; }
70
+ public NugetAuditOptions ? NugetAudit { get ; set ; }
56
71
57
72
/// <summary>
58
- /// Verbosity level to log. Valid values are: Verbose, Info, Warn, Error. Default value: verbose.
73
+ /// Settings to use for updating NuGet packages in csproj files
59
74
/// </summary>
60
- public string ? LogLevel { get ; set ; } = "verbose" ;
75
+ public NuGetUpdateOptions ? NuGetUpdates { get ; set ; }
61
76
}
62
77
63
- public class DotNetVersioningOptions
78
+ public class CsProjVersioningOptions
64
79
{
65
80
/// <summary>
66
81
/// Target Framework to set in all *.csproj files
67
82
/// </summary>
68
83
[ Required ( AllowEmptyStrings = false ) ]
69
- public required string DotNetTargetFramework { get ; set ; }
84
+ public required string TargetFramework { get ; set ; }
70
85
71
86
/// <summary>
72
87
/// C# language version to set in all *.csproj files
73
88
/// </summary>
74
89
[ Required ( AllowEmptyStrings = false ) ]
75
- public required string DotNetLangVersion { get ; set ; }
90
+ public required string LangVersion { get ; set ; }
76
91
77
92
/// <summary>
78
93
/// The value to set for the TreatWarningsAsErrors flag in all *.csproj files
@@ -81,7 +96,7 @@ public class DotNetVersioningOptions
81
96
public required bool TreatWarningsAsErrors { get ; set ; }
82
97
}
83
98
84
- public class DotNetAnalyzerOptions
99
+ public class CsProjDotNetAnalyzerOptions
85
100
{
86
101
/// <summary>
87
102
/// True to set the `EnableNetAnalyzers` csproj value to true, false to set it to false
@@ -96,6 +111,15 @@ public class DotNetAnalyzerOptions
96
111
public required bool EnforceCodeStyleInBuild { get ; set ; }
97
112
}
98
113
114
+ public class CSharpStyleOptions
115
+ {
116
+ /// <summary>
117
+ /// True to run the `dotnet format` command
118
+ /// </summary>
119
+ [ Required ]
120
+ public required bool RunDotnetFormat { get ; set ; }
121
+ }
122
+
99
123
public class NugetAuditOptions
100
124
{
101
125
/// <summary>
@@ -107,12 +131,42 @@ public class NugetAuditOptions
107
131
/// <summary>
108
132
/// What value to set for the `NuGetAuditMode` property in the csproj file. Valid values are `direct` and `all`.
109
133
/// </summary>
110
- [ Required ]
134
+ [ Required ( AllowEmptyStrings = false ) ]
111
135
public required string AuditMode { get ; set ; }
112
136
113
137
/// <summary>
114
138
/// What value to set for the `NuGetAuditLevel` property in the csproj file. Valid values are: `low`, `moderate`, `high`, and `critical`
115
139
/// </summary>
116
- [ Required ]
140
+ [ Required ( AllowEmptyStrings = false ) ]
117
141
public required string AuditLevel { get ; set ; }
118
142
}
143
+
144
+ public class NuGetUpdateOptions
145
+ {
146
+ /// <summary>
147
+ /// True to updates all referenced nugets to the latest version. These are the references in the csproj files.
148
+ /// </summary>
149
+ [ Required ]
150
+ public bool UpdateTopLevelNugetsInCsProj { get ; set ; }
151
+
152
+ /// <summary>
153
+ /// True to updates all indirect nugets to the latest version. These are the nugets that are referenced automatically based on SDK chosen or something like that.
154
+ /// </summary>
155
+ [ Required ]
156
+ public bool UpdateTopLevelNugetsNotInCsProj { get ; set ; }
157
+ }
158
+
159
+ public class LoggingOptions
160
+ {
161
+ /// <summary>
162
+ /// If this is set, it will be the file to write logs to, in addition to the console
163
+ /// </summary>
164
+ [ Required ( AllowEmptyStrings = false ) ]
165
+ public required string OutputFile { get ; set ; }
166
+
167
+ /// <summary>
168
+ /// Verbosity level to log. Valid values are: Verbose, Info, Warn, Error. Default value: verbose.
169
+ /// </summary>
170
+ [ Required ( AllowEmptyStrings = false ) ]
171
+ public required string LogLevel { get ; set ; } = "verbose" ;
172
+ }
0 commit comments