@@ -44,7 +44,7 @@ public class BuildContext : FrostingContext
44
44
45
45
public DirectoryPath ChangeLogDirectory { get ; }
46
46
public DirectoryPath ChangeLogGenDirectory { get ; }
47
-
47
+
48
48
public DirectoryPath RedirectRootDirectory { get ; }
49
49
public DirectoryPath RedirectTargetDirectory { get ; }
50
50
@@ -53,13 +53,17 @@ public class BuildContext : FrostingContext
53
53
public FilePath IntegrationTestsProjectFile { get ; }
54
54
public FilePath TemplatesTestsProjectFile { get ; }
55
55
public FilePathCollection AllPackableSrcProjects { get ; }
56
-
56
+
57
57
public DotNetMSBuildSettings MsBuildSettings { get ; }
58
58
59
59
private IAppVeyorProvider AppVeyor => this . BuildSystem ( ) . AppVeyor ;
60
60
public bool IsRunningOnAppVeyor => AppVeyor . IsRunningOnAppVeyor ;
61
61
public bool IsOnAppVeyorAndNotPr => IsRunningOnAppVeyor && ! AppVeyor . Environment . PullRequest . IsPullRequest ;
62
- public bool IsOnAppVeyorAndBdnNightlyCiCd => IsOnAppVeyorAndNotPr && AppVeyor . Environment . Repository . Branch == "master" && this . IsRunningOnWindows ( ) ;
62
+
63
+ public bool IsOnAppVeyorAndBdnNightlyCiCd => IsOnAppVeyorAndNotPr &&
64
+ AppVeyor . Environment . Repository . Branch == "master" &&
65
+ this . IsRunningOnWindows ( ) ;
66
+
63
67
public bool IsLocalBuild => this . BuildSystem ( ) . IsLocalBuild ;
64
68
public bool IsCiBuild => ! this . BuildSystem ( ) . IsLocalBuild ;
65
69
@@ -80,9 +84,9 @@ public BuildContext(ICakeContext context)
80
84
81
85
ChangeLogDirectory = RootDirectory . Combine ( "docs" ) . Combine ( "changelog" ) ;
82
86
ChangeLogGenDirectory = RootDirectory . Combine ( "docs" ) . Combine ( "_changelog" ) ;
83
-
87
+
84
88
RedirectRootDirectory = RootDirectory . Combine ( "docs" ) . Combine ( "_redirects" ) ;
85
- RedirectTargetDirectory = RootDirectory . Combine ( "docs" ) . Combine ( "_site" ) ;
89
+ RedirectTargetDirectory = RootDirectory . Combine ( "docs" ) . Combine ( "_site" ) ;
86
90
87
91
SolutionFile = RootDirectory . CombineWithFilePath ( "BenchmarkDotNet.sln" ) ;
88
92
UnitTestsProjectFile = RootDirectory . Combine ( "tests" ) . Combine ( "BenchmarkDotNet.Tests" )
@@ -189,7 +193,7 @@ public void DocfxChangelogGenerate(string version)
189
193
public void RunDocfx ( FilePath docfxJson )
190
194
{
191
195
this . Information ( $ "Running docfx for '{ docfxJson } '") ;
192
-
196
+
193
197
var currentDirectory = Directory . GetCurrentDirectory ( ) ;
194
198
Directory . SetCurrentDirectory ( docfxJson . GetDirectory ( ) . FullPath ) ;
195
199
Microsoft . DocAsCode . Dotnet . DotnetApiCatalog . GenerateManagedReferenceYamlFiles ( docfxJson . FullPath ) . Wait ( ) ;
@@ -350,7 +354,7 @@ public override void Run(BuildContext context)
350
354
? new [ ] { "net462" , "net7.0" }
351
355
: new [ ] { "net7.0" } ;
352
356
353
- foreach ( var targetFramework in targetFrameworks )
357
+ foreach ( var targetFramework in targetFrameworks )
354
358
context . RunTests ( context . UnitTestsProjectFile , "UnitTests" , targetFramework ) ;
355
359
}
356
360
}
@@ -361,7 +365,8 @@ public class SlowFullFrameworkTestsTask : FrostingTask<BuildContext>
361
365
{
362
366
public override bool ShouldRun ( BuildContext context )
363
367
{
364
- return ! context . SkipTests && ! context . SkipSlowTests && context . IsRunningOnWindows ( ) && ! context . IsRunningOnAppVeyor ;
368
+ return ! context . SkipTests && ! context . SkipSlowTests && context . IsRunningOnWindows ( ) &&
369
+ ! context . IsRunningOnAppVeyor ;
365
370
}
366
371
367
372
public override void Run ( BuildContext context )
@@ -416,7 +421,7 @@ public override void Run(BuildContext context)
416
421
417
422
foreach ( var project in context . AllPackableSrcProjects )
418
423
context . DotNetPack ( project . FullPath , settingsSrc ) ;
419
-
424
+
420
425
var settingsTemplate = new DotNetPackSettings
421
426
{
422
427
Configuration = context . BuildConfiguration ,
@@ -445,15 +450,17 @@ public override void Run(BuildContext context)
445
450
context . DocfxChangelogDownload (
446
451
DocumentationHelper . BdnAllVersions . First ( ) ,
447
452
DocumentationHelper . BdnFirstCommit ) ;
448
-
453
+
449
454
for ( int i = 1 ; i < DocumentationHelper . BdnAllVersions . Length ; i ++ )
450
455
context . DocfxChangelogDownload (
451
456
DocumentationHelper . BdnAllVersions [ i ] ,
452
457
DocumentationHelper . BdnAllVersions [ i - 1 ] ) ;
453
458
}
454
459
else if ( context . Argument ( "LatestVersions" , false ) )
455
460
{
456
- for ( int i = DocumentationHelper . BdnAllVersions . Length - 3 ; i < DocumentationHelper . BdnAllVersions . Length ; i ++ )
461
+ for ( int i = DocumentationHelper . BdnAllVersions . Length - 3 ;
462
+ i < DocumentationHelper . BdnAllVersions . Length ;
463
+ i ++ )
457
464
context . DocfxChangelogDownload (
458
465
DocumentationHelper . BdnAllVersions [ i ] ,
459
466
DocumentationHelper . BdnAllVersions [ i - 1 ] ) ;
@@ -475,10 +482,42 @@ public override void Run(BuildContext context)
475
482
context . DocfxChangelogGenerate ( version ) ;
476
483
context . DocfxChangelogGenerate ( DocumentationHelper . BdnNextVersion ) ;
477
484
478
- context . CopyFile ( context . ChangeLogGenDirectory . CombineWithFilePath ( "index.md" ) ,
479
- context . ChangeLogDirectory . CombineWithFilePath ( "index.md" ) ) ;
480
- context . CopyFile ( context . ChangeLogGenDirectory . CombineWithFilePath ( "full.md" ) ,
481
- context . ChangeLogDirectory . CombineWithFilePath ( "full.md" ) ) ;
485
+ context . Information ( "DocfxChangelogGenerate: index.md" ) ;
486
+ var indexContent = new StringBuilder ( ) ;
487
+ indexContent . AppendLine ( "---" ) ;
488
+ indexContent . AppendLine ( "uid: changelog" ) ;
489
+ indexContent . AppendLine ( "---" ) ;
490
+ indexContent . AppendLine ( "" ) ;
491
+ indexContent . AppendLine ( "# ChangeLog" ) ;
492
+ indexContent . AppendLine ( "" ) ;
493
+ foreach ( var version in DocumentationHelper . BdnAllVersions . Reverse ( ) )
494
+ indexContent . AppendLine ( $ "* @changelog.{ version } ") ;
495
+ indexContent . AppendLine ( "* @changelog.full" ) ;
496
+ context . FileWriteText ( context . ChangeLogDirectory . CombineWithFilePath ( "index.md" ) , indexContent . ToString ( ) ) ;
497
+
498
+ context . Information ( "DocfxChangelogGenerate: full.md" ) ;
499
+ var fullContent = new StringBuilder ( ) ;
500
+ fullContent . AppendLine ( "---" ) ;
501
+ fullContent . AppendLine ( "uid: changelog" ) ;
502
+ fullContent . AppendLine ( "---" ) ;
503
+ fullContent . AppendLine ( "" ) ;
504
+ fullContent . AppendLine ( "# Full ChangeLog" ) ;
505
+ fullContent . AppendLine ( "" ) ;
506
+ foreach ( var version in DocumentationHelper . BdnAllVersions . Reverse ( ) )
507
+ indexContent . AppendLine ( $ "[!include[{ version } ]({ version } .md)]") ;
508
+ context . FileWriteText ( context . ChangeLogDirectory . CombineWithFilePath ( "full.md" ) , fullContent . ToString ( ) ) ;
509
+
510
+ context . Information ( "DocfxChangelogGenerate: toc.yml" ) ;
511
+ var tocContent = new StringBuilder ( ) ;
512
+ foreach ( var version in DocumentationHelper . BdnAllVersions . Reverse ( ) )
513
+ {
514
+ tocContent . AppendLine ( $ "- name: { version } ") ;
515
+ tocContent . AppendLine ( $ " href: { version } .md") ;
516
+ }
517
+
518
+ tocContent . AppendLine ( "- name: Full ChangeLog" ) ;
519
+ tocContent . AppendLine ( " href: full.md" ) ;
520
+ context . FileWriteText ( context . ChangeLogDirectory . CombineWithFilePath ( "toc.yml" ) , tocContent . ToString ( ) ) ;
482
521
}
483
522
}
484
523
0 commit comments