Skip to content

Commit 3f890fd

Browse files
[build] Rename tasks
1 parent 7de12a1 commit 3f890fd

File tree

6 files changed

+45
-121
lines changed

6 files changed

+45
-121
lines changed

.github/workflows/generate-changelog.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
ref: master
2121

2222
- name: Download changelog
23-
run: ./build.cmd DocsUpdate --depth 1 --preview
23+
run: ./build.cmd docs-update --depth 1 --preview
2424
env:
2525
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2626

.github/workflows/generate-gh-pages.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ jobs:
2020
ref: docs-stable
2121

2222
- name: Build BenchmarkDotNet
23-
run: ./build.cmd Build
23+
run: ./build.cmd build
2424

2525
- name: Download changelog
26-
run: ./build.cmd DocsUpdate --depth 1 --preview
26+
run: ./build.cmd docs-update --depth 1 --preview
2727
env:
2828
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2929

3030
- name: Build documentation
31-
run: ./build.cmd DocsBuild
31+
run: ./build.cmd docs-build
3232

3333
- name: Upload Artifacts
3434
uses: actions/upload-artifact@v1

.github/workflows/run-tests.yaml

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ jobs:
1818
run: Set-MpPreference -DisableRealtimeMonitoring $true
1919
shell: powershell
2020
- uses: actions/checkout@v3
21-
- name: Run task 'Build'
21+
- name: Run task 'build'
2222
shell: cmd
2323
run: |
2424
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
25-
./build.cmd Build
26-
- name: Run task 'InTestsCore'
25+
./build.cmd build
26+
- name: Run task 'in-tests-core'
2727
shell: cmd
2828
run: |
2929
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
30-
./build.cmd InTestsCore -e
30+
./build.cmd in-tests-core -e
3131
- name: Upload test results
3232
uses: actions/upload-artifact@v3
3333
if: always()
@@ -42,16 +42,16 @@ jobs:
4242
run: Set-MpPreference -DisableRealtimeMonitoring $true
4343
shell: powershell
4444
- uses: actions/checkout@v3
45-
- name: Run task 'Build'
45+
- name: Run task 'build'
4646
shell: cmd
4747
run: |
4848
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
49-
./build.cmd Build
50-
- name: Run task 'InTestsFull'
49+
./build.cmd build
50+
- name: Run task 'in-tests-full'
5151
shell: cmd
5252
run: |
5353
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
54-
./build.cmd InTestsFull -e
54+
./build.cmd in-tests-full -e
5555
- name: Upload test results
5656
uses: actions/upload-artifact@v3
5757
if: always()
@@ -70,12 +70,12 @@ jobs:
7070
platform: x64
7171
- name: Set up zlib-static
7272
run: sudo apt-get install -y libkrb5-dev
73-
- name: Run task 'Build'
74-
run: ./build.cmd Build
75-
- name: Run task 'UnitTests'
76-
run: ./build.cmd UnitTests -e
77-
- name: Run task 'InTestsCore'
78-
run: ./build.cmd InTestsCore -e
73+
- name: Run task 'build'
74+
run: ./build.cmd build
75+
- name: Run task 'unit-tests'
76+
run: ./build.cmd unit-tests -e
77+
- name: Run task 'in-tests-core'
78+
run: ./build.cmd in-tests-core -e
7979
- name: Upload test results
8080
uses: actions/upload-artifact@v3
8181
if: always()
@@ -87,12 +87,12 @@ jobs:
8787
runs-on: macos-13
8888
steps:
8989
- uses: actions/checkout@v3
90-
- name: Run task 'Build'
91-
run: ./build.cmd Build
92-
- name: Run task 'UnitTests'
93-
run: ./build.cmd UnitTests -e
94-
- name: Run task 'InTestsCore'
95-
run: ./build.cmd InTestsCore -e
90+
- name: Run task 'build'
91+
run: ./build.cmd build
92+
- name: Run task 'unit-tests'
93+
run: ./build.cmd unit-tests -e
94+
- name: Run task 'in-tests-core'
95+
run: ./build.cmd in-tests-core -e
9696
- name: Upload test results
9797
uses: actions/upload-artifact@v3
9898
if: always()

build/BenchmarkDotNet.Build/CommandLineParser.cs

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,18 @@ public class CommandLineParser
3434
if (Is(taskName, "-t", "--target") && argsToProcess.Any())
3535
taskName = argsToProcess.Dequeue();
3636

37-
taskName = taskName.Replace("-", "");
38-
3937
var taskNames = GetTaskNames();
40-
if (!taskNames.Contains(taskName))
38+
var matchedTaskName = taskNames
39+
.FirstOrDefault(name => string.Equals(name.Replace("-", ""), taskName.Replace("-", ""),
40+
StringComparison.OrdinalIgnoreCase));
41+
if (matchedTaskName == null)
4142
{
4243
PrintError($"'{taskName}' is not a task");
4344
return null;
4445
}
4546

47+
taskName = matchedTaskName;
48+
4649
if (argsToProcess.Count == 1 && Is(argsToProcess.Peek(), "-h", "--help"))
4750
{
4851
PrintTaskHelp(taskName);
@@ -93,9 +96,6 @@ private void PrintHelp()
9396
WritePrefix();
9497
WriteLine("BenchmarkDotNet build script");
9598

96-
WritePrefix();
97-
WriteLine("Task names are case-insensitive, dashes are ignored");
98-
9999
WriteLine();
100100

101101
WriteHeader("Usage:");
@@ -139,7 +139,7 @@ private void PrintHelp()
139139

140140
WritePrefix();
141141
Write(CallScriptName + " ");
142-
WriteTask("unittests ");
142+
WriteTask("unit-tests ");
143143
WriteOption("--exclusive --verbosity ");
144144
WriteArg("Diagnostic");
145145
WriteLine();
@@ -289,21 +289,6 @@ private void PrintTaskHelp(string taskName)
289289
WriteTask(taskName);
290290
WriteLine();
291291

292-
if (taskName.StartsWith("docs", StringComparison.OrdinalIgnoreCase))
293-
{
294-
WritePrefix();
295-
Write(ScriptName + " ");
296-
WriteTask("docs-" + taskName[4..].ToLowerInvariant());
297-
WriteLine();
298-
}
299-
else
300-
{
301-
WritePrefix();
302-
Write(ScriptName + " ");
303-
WriteTask(taskName.ToLowerInvariant());
304-
WriteLine();
305-
}
306-
307292
WriteLine();
308293

309294
PrintOptions(helpInfo.Options.Concat(baseOptions).ToArray());

build/BenchmarkDotNet.Build/Program.cs

Lines changed: 12 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,30 @@ public static int Main(string[] args)
1616
}
1717
}
1818

19-
[TaskName("Restore")]
19+
[TaskName("restore")]
2020
[TaskDescription("Restore NuGet packages")]
2121
public class RestoreTask : FrostingTask<BuildContext>
2222
{
2323
public override void Run(BuildContext context) => context.BuildRunner.Restore();
2424
}
2525

26-
[TaskName("Build")]
26+
[TaskName("build")]
2727
[TaskDescription("Build BenchmarkDotNet.sln solution")]
2828
[IsDependentOn(typeof(RestoreTask))]
2929
public class BuildTask : FrostingTask<BuildContext>
3030
{
3131
public override void Run(BuildContext context) => context.BuildRunner.Build();
3232
}
3333

34-
[TaskName("UnitTests")]
34+
[TaskName("unit-tests")]
3535
[TaskDescription("Run unit tests (fast)")]
3636
[IsDependentOn(typeof(BuildTask))]
3737
public class UnitTestsTask : FrostingTask<BuildContext>
3838
{
3939
public override void Run(BuildContext context) => context.UnitTestRunner.RunUnitTests();
4040
}
4141

42-
[TaskName("InTestsFull")]
42+
[TaskName("in-tests-full")]
4343
[TaskDescription("Run integration tests using .NET Framework 4.6.2+ (slow)")]
4444
[IsDependentOn(typeof(BuildTask))]
4545
public class InTestsFullTask : FrostingTask<BuildContext>
@@ -49,15 +49,15 @@ public class InTestsFullTask : FrostingTask<BuildContext>
4949
public override void Run(BuildContext context) => context.UnitTestRunner.RunInTests("net462");
5050
}
5151

52-
[TaskName("InTestsCore")]
52+
[TaskName("in-tests-core")]
5353
[TaskDescription("Run integration tests using .NET 7 (slow)")]
5454
[IsDependentOn(typeof(BuildTask))]
5555
public class InTestsCoreTask : FrostingTask<BuildContext>
5656
{
5757
public override void Run(BuildContext context) => context.UnitTestRunner.RunInTests("net7.0");
5858
}
5959

60-
[TaskName("AllTests")]
60+
[TaskName("all-tests")]
6161
[TaskDescription("Run all unit and integration tests (slow)")]
6262
[IsDependentOn(typeof(UnitTestsTask))]
6363
[IsDependentOn(typeof(InTestsFullTask))]
@@ -66,24 +66,15 @@ public class AllTestsTask : FrostingTask<BuildContext>
6666
{
6767
}
6868

69-
[TaskName("Pack")]
69+
[TaskName("pack")]
7070
[TaskDescription("Pack Nupkg packages")]
7171
[IsDependentOn(typeof(BuildTask))]
7272
public class PackTask : FrostingTask<BuildContext>
7373
{
7474
public override void Run(BuildContext context) => context.BuildRunner.Pack();
7575
}
7676

77-
[TaskName("CI")]
78-
[TaskDescription("Perform all CI-related tasks: Restore, Build, AllTests, Pack")]
79-
[IsDependentOn(typeof(BuildTask))]
80-
[IsDependentOn(typeof(AllTestsTask))]
81-
[IsDependentOn(typeof(PackTask))]
82-
public class CiTask : FrostingTask<BuildContext>
83-
{
84-
}
85-
86-
[TaskName("DocsUpdate")]
77+
[TaskName("docs-update")]
8778
[TaskDescription("Update generated documentation files")]
8879
public class DocsUpdateTask : FrostingTask<BuildContext>, IHelpProvider
8980
{
@@ -99,7 +90,7 @@ public HelpInfo GetHelp()
9990
}
10091
}
10192

102-
[TaskName("DocsPrepare")]
93+
[TaskName("docs-prepare")]
10394
[TaskDescription("Prepare auxiliary documentation files")]
10495
public class DocsPrepareTask : FrostingTask<BuildContext>, IHelpProvider
10596
{
@@ -114,11 +105,7 @@ public HelpInfo GetHelp()
114105
}
115106
}
116107

117-
// In order to work around xref issues in DocFx, BenchmarkDotNet and BenchmarkDotNet.Annotations must be build
118-
// before running the DocFX_Build target. However, including a dependency on BuildTask here may have unwanted
119-
// side effects (CleanTask).
120-
// TODO: Define dependencies when a CI workflow scenario for using the "DocFX_Build" target exists.
121-
[TaskName("DocsBuild")]
108+
[TaskName("docs-build")]
122109
[TaskDescription("Build final documentation")]
123110
[IsDependentOn(typeof(DocsPrepareTask))]
124111
public class DocsBuildTask : FrostingTask<BuildContext>, IHelpProvider
@@ -127,11 +114,12 @@ public class DocsBuildTask : FrostingTask<BuildContext>, IHelpProvider
127114

128115
public HelpInfo GetHelp() => new()
129116
{
117+
Description = "The 'build' task should be run manually to build api docs",
130118
Options = new IOption[] { KnownOptions.DocsPreview }
131119
};
132120
}
133121

134-
[TaskName("Release")]
122+
[TaskName("release")]
135123
[TaskDescription("Release new version")]
136124
[IsDependentOn(typeof(BuildTask))]
137125
[IsDependentOn(typeof(PackTask))]
@@ -140,53 +128,4 @@ public class DocsBuildTask : FrostingTask<BuildContext>, IHelpProvider
140128
public class ReleaseTask : FrostingTask<BuildContext>
141129
{
142130
public override void Run(BuildContext context) => context.ReleaseRunner.Run();
143-
}
144-
145-
[TaskName("FastTests")]
146-
[TaskDescription("OBSOLETE: use 'UnitTests'")]
147-
[IsDependentOn(typeof(UnitTestsTask))]
148-
public class FastTestsTask : FrostingTask<BuildContext>
149-
{
150-
}
151-
152-
[TaskName("SlowFullFrameworkTests")]
153-
[TaskDescription("OBSOLETE: use 'InTestsFull'")]
154-
[IsDependentOn(typeof(InTestsFullTask))]
155-
public class SlowFullFrameworkTestsTask : FrostingTask<BuildContext>
156-
{
157-
}
158-
159-
[TaskName("SlowTestsNetCore")]
160-
[TaskDescription("OBSOLETE: use 'InTestsCore'")]
161-
[IsDependentOn(typeof(InTestsCoreTask))]
162-
public class SlowTestsNetCoreTask : FrostingTask<BuildContext>
163-
{
164-
}
165-
166-
[TaskName("DocFX_Changelog_Download")]
167-
[TaskDescription("OBSOLETE: use 'DocsUpdate'")]
168-
[IsDependentOn(typeof(DocsUpdateTask))]
169-
public class DocFxChangelogDownloadTask : FrostingTask<BuildContext>
170-
{
171-
}
172-
173-
[TaskName("DocFX_Changelog_Generate")]
174-
[TaskDescription("OBSOLETE: use 'DocsPrepare'")]
175-
[IsDependentOn(typeof(DocsPrepareTask))]
176-
public class DocfxChangelogGenerateTask : FrostingTask<BuildContext>
177-
{
178-
}
179-
180-
[TaskName("DocFX_Generate_Redirects")]
181-
[TaskDescription("OBSOLETE: use 'DocsBuild'")]
182-
[IsDependentOn(typeof(DocsBuildTask))]
183-
public class DocfxGenerateRedirectsTask : FrostingTask<BuildContext>
184-
{
185-
}
186-
187-
[TaskName("DocFX_Build")]
188-
[TaskDescription("OBSOLETE: use 'DocsBuild'")]
189-
[IsDependentOn(typeof(DocsBuildTask))]
190-
public class DocfxBuildTask : FrostingTask<BuildContext>
191-
{
192131
}

docs/articles/contributing/documentation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,10 @@ It will be transformed to:
4949
5050
## Building documentation locally
5151

52-
You can build documentation locally with the help of the `DocsBuild` build task:
52+
You can build documentation locally with the help of the `docs-build` build task:
5353

5454
```
55-
build.cmd DocsBuild
55+
build.cmd docs-build
5656
```
5757

5858
## See also

0 commit comments

Comments
 (0)