@@ -75,7 +75,6 @@ public override bool Execute( )
7575
7676 if ( ! ValidateInput ( ) )
7777 {
78- Log . LogError ( "Input validation failed" ) ;
7978 return false ;
8079 }
8180
@@ -196,19 +195,19 @@ private bool ValidateInput( )
196195 bool hasInputError = false ;
197196 if ( BuildMajor < 0 || BuildMajor > 99999 )
198197 {
199- Log . LogError ( "BuildMajor value must be in range [0-99999]" ) ;
198+ LogError ( "CSM100" , "BuildMajor value must be in range [0-99999]" ) ;
200199 hasInputError = true ;
201200 }
202201
203202 if ( BuildMinor < 0 || BuildMinor > 49999 )
204203 {
205- Log . LogError ( "BuildMinor value must be in range [0-49999]" ) ;
204+ LogError ( "CSM101" , "BuildMinor value must be in range [0-49999]" ) ;
206205 hasInputError = true ;
207206 }
208207
209208 if ( BuildPatch < 0 || BuildPatch > 9999 )
210209 {
211- Log . LogError ( "BuildPatch value must be in range [0-99999 ]" ) ;
210+ LogError ( "CSM102" , "BuildPatch value must be in range [0-9999 ]" ) ;
212211 hasInputError = true ;
213212 }
214213
@@ -218,59 +217,53 @@ private bool ValidateInput( )
218217 {
219218 if ( ! PreReleaseShortNames . Contains ( PreReleaseName , StringComparer . InvariantCultureIgnoreCase ) )
220219 {
221- Log . LogError ( "PreRelease Name is unknown" ) ;
220+ LogError ( "CSM103" , "PreRelease Name is unknown" ) ;
222221 hasInputError = true ;
223222 }
224223 }
225224 }
226225
227226 if ( PreReleaseNumber < 0 || PreReleaseNumber > 99 )
228227 {
229- Log . LogError ( "PreReleaseNumber value must be in range [0-99]" ) ;
228+ LogError ( "CSM104" , "PreReleaseNumber value must be in range [0-99]" ) ;
230229 hasInputError = true ;
231230 }
232231
233232 if ( PreReleaseFix < 0 || PreReleaseFix > 99 )
234233 {
235- Log . LogError ( "PreReleaseFix value must be in range [0-99]" ) ;
234+ LogError ( "CSM104" , "PreReleaseFix value must be in range [0-99]" ) ;
236235 hasInputError = true ;
237236 }
238237
239238 if ( string . IsNullOrWhiteSpace ( CiBuildIndex ) != string . IsNullOrWhiteSpace ( CiBuildName ) )
240239 {
241- Log . LogError ( "If CiBuildIndex is set then CiBuildName must also be set; If CiBuildIndex is NOT set then CiBuildName must not be set." ) ;
240+ LogError ( "CSM105" , "If CiBuildIndex is set then CiBuildName must also be set; If CiBuildIndex is NOT set then CiBuildName must not be set." ) ;
242241 hasInputError = true ;
243242 }
244243
245244 if ( CiBuildIndex != null && ! CiBuildIdRegEx . IsMatch ( CiBuildIndex ) )
246245 {
247- Log . LogError ( "CiBuildIndex does not match syntax defined by CSemVer" ) ;
246+ LogError ( "CSM106" , "CiBuildIndex does not match syntax defined by CSemVer" ) ;
248247 hasInputError = true ;
249248 }
250249
251250 if ( CiBuildName != null && ! CiBuildIdRegEx . IsMatch ( CiBuildName ) )
252251 {
253- Log . LogError ( "CiBuildName does not match syntax defined by CSemVer" ) ;
254- hasInputError = true ;
255- }
256-
257- if ( ! string . IsNullOrEmpty ( BuildMeta ) && BuildMeta ! . Length > 20 )
258- {
259- Log . LogError ( "Build metadata, if provided, must not exceed 20 characters" ) ;
252+ LogError ( "CSM107" , "CiBuildName does not match syntax defined by CSemVer" ) ;
260253 hasInputError = true ;
261254 }
262255
263256 return ! hasInputError ;
264257 }
265258
266- // private void LogError(
267- // string code,
268- // /*[StringSyntax(StringSyntaxAttribute.CompositeFormat)]*/ string message,
269- // params object[] messageArgs
270- // )
271- // {
272- // Log.LogError(" Task", code, null, null, 0, 0, 0, 0, message, messageArgs);
273- // }
259+ private void LogError (
260+ string code ,
261+ /*[StringSyntax(StringSyntaxAttribute.CompositeFormat)]*/ string message ,
262+ params object [ ] messageArgs
263+ )
264+ {
265+ Log . LogError ( $ " { nameof ( CreateVersionInfo ) } Task", code , null , null , 0 , 0 , 0 , 0 , message , messageArgs ) ;
266+ }
274267
275268 private static int ComputePreReleaseIndex ( string preRelName )
276269 {
0 commit comments