Skip to content

Commit d2f2ebe

Browse files
Merging main into darc-main-6a483e62-9a15-475d-a31b-7c7d1c96cb9f
2 parents 62b747b + 1dd8c27 commit d2f2ebe

File tree

12 files changed

+106
-47
lines changed

12 files changed

+106
-47
lines changed

.config/dotnet-tools.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"isRoot": true,
44
"tools": {
55
"microsoft.dotnet.darc": {
6-
"version": "1.1.0-beta.25272.3",
6+
"version": "1.1.0-beta.25277.2",
77
"commands": [
88
"darc"
99
]

build/RunTestTemplateTests.ps1

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<#
2+
.SYNOPSIS
3+
Runs Microsoft.TestTemplates.Acceptance.Tests.dll in the dogfood environment.
4+
.DESCRIPTION
5+
This script enters the dogfood environment and runs the RunTestTemplateTests tests.
6+
#>
7+
[CmdletBinding(PositionalBinding=$false)]
8+
Param(
9+
[string] $configuration = "Release"
10+
)
11+
12+
function Run-TestTemplateTests {
13+
$ErrorActionPreference = 'Stop'
14+
$RepoRoot = Resolve-Path (Join-Path $PSScriptRoot '..')
15+
$classNameFilter = "--filter"
16+
$filterValue = "FullyQualifiedName~Microsoft.DotNet.Cli.New.IntegrationTests.DotnetNewTestTemplatesTests"
17+
$TestDll = Join-Path $RepoRoot "artifacts\bin\dotnet-new.IntegrationTests\$configuration\dotnet-new.IntegrationTests.dll"
18+
19+
# Check if the test DLL exists
20+
if (-not (Test-Path $TestDll)) {
21+
Write-Error "Test DLL not found at: $TestDll"
22+
return 1
23+
}
24+
25+
Write-Host "Running tests for test templates in the dogfood environment..." -ForegroundColor Cyan
26+
27+
# Call dogfood.ps1 directly instead of through dogfood.cmd to avoid the -NoExit parameter
28+
$dogfoodPs1 = Join-Path $RepoRoot "eng\dogfood.ps1"
29+
30+
Write-Host "Executing: dotnet test $TestDll via dogfood environment" -ForegroundColor Gray
31+
# Pass the command directly to the dogfood.ps1 script
32+
& $dogfoodPs1 -configuration $configuration -command @("dotnet", "test", $TestDll, $classNameFilter, $filterValue)
33+
34+
$exitCode = $LASTEXITCODE
35+
if ($exitCode -ne 0) {
36+
Write-Error "Tests failed with exit code: $exitCode"
37+
} else {
38+
Write-Host "Tests completed successfully!" -ForegroundColor Green
39+
}
40+
41+
return $exitCode
42+
}
43+
44+
# Execute the function using Invoke-Command
45+
$exitCode = Invoke-Command -ScriptBlock ${function:Run-TestTemplateTests}
46+
exit $exitCode

eng/Version.Details.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -538,21 +538,21 @@
538538
<Uri>https://github.com/dotnet/dotnet</Uri>
539539
<Sha>57b0396ae0d21b9f0dfe0d208c57822fb88f9a8d</Sha>
540540
</Dependency>
541-
<Dependency Name="Microsoft.DotNet.Darc" Version="1.1.0-beta.25272.3">
541+
<Dependency Name="Microsoft.DotNet.Darc" Version="1.1.0-beta.25277.2">
542542
<Uri>https://github.com/dotnet/arcade-services</Uri>
543-
<Sha>b6c1947b3493a1ad3a1a87fa689128e1d73309ba</Sha>
543+
<Sha>55b90ec8fea44527a4ab211cfe3ef50ccd608f74</Sha>
544544
</Dependency>
545-
<Dependency Name="Microsoft.DotNet.DarcLib" Version="1.1.0-beta.25272.3">
545+
<Dependency Name="Microsoft.DotNet.DarcLib" Version="1.1.0-beta.25277.2">
546546
<Uri>https://github.com/dotnet/arcade-services</Uri>
547-
<Sha>b6c1947b3493a1ad3a1a87fa689128e1d73309ba</Sha>
547+
<Sha>55b90ec8fea44527a4ab211cfe3ef50ccd608f74</Sha>
548548
</Dependency>
549-
<Dependency Name="Microsoft.Testing.Platform" Version="1.8.0-preview.25276.8">
549+
<Dependency Name="Microsoft.Testing.Platform" Version="1.8.0-preview.25277.4">
550550
<Uri>https://github.com/microsoft/testfx</Uri>
551-
<Sha>65f8636524b4ffd6f7a6cd842714645f46905136</Sha>
551+
<Sha>77c0915dfca9d2f0e9acdbced9be391d4f7f1dd9</Sha>
552552
</Dependency>
553-
<Dependency Name="MSTest" Version="3.10.0-preview.25276.8">
553+
<Dependency Name="MSTest" Version="3.10.0-preview.25277.4">
554554
<Uri>https://github.com/microsoft/testfx</Uri>
555-
<Sha>65f8636524b4ffd6f7a6cd842714645f46905136</Sha>
555+
<Sha>77c0915dfca9d2f0e9acdbced9be391d4f7f1dd9</Sha>
556556
</Dependency>
557557
<Dependency Name="Microsoft.Extensions.Configuration.Ini" Version="10.0.0-preview.6.25277.102">
558558
<Uri>https://github.com/dotnet/dotnet</Uri>

eng/Versions.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<UsingToolVSSDK>true</UsingToolVSSDK>
3131
<FlagNetStandard1XDependencies Condition="'$(DotNetBuildSourceOnly)' == 'true'">true</FlagNetStandard1XDependencies>
3232
<!-- This property is only used in the dotnet test integration tests. -->
33-
<MicrosoftTestingPlatformVersion>1.8.0-preview.25276.8</MicrosoftTestingPlatformVersion>
33+
<MicrosoftTestingPlatformVersion>1.8.0-preview.25277.4</MicrosoftTestingPlatformVersion>
3434
</PropertyGroup>
3535
<PropertyGroup Label="Servicing version information">
3636
<VersionFeature21>30</VersionFeature21>
@@ -89,7 +89,7 @@
8989
</PropertyGroup>
9090
<PropertyGroup>
9191
<!-- Dependency from https://github.com/dotnet/arcade-services -->
92-
<MicrosoftDotNetDarcLibVersion>1.1.0-beta.25272.3</MicrosoftDotNetDarcLibVersion>
92+
<MicrosoftDotNetDarcLibVersion>1.1.0-beta.25277.2</MicrosoftDotNetDarcLibVersion>
9393
</PropertyGroup>
9494
<PropertyGroup>
9595
<!-- Dependency from https://github.com/dotnet/aspire -->
@@ -322,7 +322,7 @@
322322
<AwesomeAssertionsVersion>8.0.2</AwesomeAssertionsVersion>
323323
<AwesomeAssertionsJsonVersion>8.0.0</AwesomeAssertionsJsonVersion>
324324
<MoqPackageVersion>4.18.4</MoqPackageVersion>
325-
<MSTestVersion>3.10.0-preview.25276.8</MSTestVersion>
325+
<MSTestVersion>3.10.0-preview.25277.4</MSTestVersion>
326326
<XunitCombinatorialVersion>1.3.2</XunitCombinatorialVersion>
327327
<MicrosoftDotNetInstallerWindowsSecurityTestDataPackageVersion>8.0.0-beta.23607.1</MicrosoftDotNetInstallerWindowsSecurityTestDataPackageVersion>
328328
</PropertyGroup>

eng/pipelines/templates/jobs/sdk-build.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ jobs:
104104
env:
105105
BuildConfig: $(buildConfiguration)
106106
TestFullMSBuild: ${{ parameters.testFullMSBuild }}
107+
108+
- powershell: build/RunTestTemplateTests.ps1
109+
displayName: 🟣 Run Test Templates Tests
110+
107111
- ${{ else }}:
108112
- script: |
109113
source $(Build.SourcesDirectory)/eng/common/native/init-os-and-arch.sh

sdk.sln

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ VisualStudioVersion = 17.1.31903.286
44
MinimumVisualStudioVersion = 10.0.40219.1
55
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{50A89C27-BA35-44B2-AC57-E54551791C64}"
66
ProjectSection(SolutionItems) = preProject
7-
eng\cgmanifest.json = eng\cgmanifest.json
87
eng\dogfood.cmd = eng\dogfood.cmd
98
eng\dogfood.sh = eng\dogfood.sh
109
eng\Versions.props = eng\Versions.props
@@ -1208,6 +1207,9 @@ Global
12081207
{D7495CE7-64E5-4715-9304-799A41EC1D71} = {580D1AE7-AA8F-4912-8B76-105594E00B3B}
12091208
{8D6A9984-118D-4415-A8FA-AB1F26CF5C44} = {71C279BD-E850-4A8D-9775-11CA26B8E5BA}
12101209
{0CBA5FB8-71A3-457A-89F3-E52B9602164A} = {71C279BD-E850-4A8D-9775-11CA26B8E5BA}
1210+
{3C688B3B-7919-6C9E-93A3-A3F6B3E684A9} = {22AB674F-ED91-4FBC-BFEE-8A1E82F9F05E}
1211+
{48A69DF9-9233-2548-C614-202D5780014D} = {3C688B3B-7919-6C9E-93A3-A3F6B3E684A9}
1212+
{0D36F844-0A1C-469F-93A1-C0E5AD141B07} = {48A69DF9-9233-2548-C614-202D5780014D}
12111213
{21C21975-84C1-4A24-8E21-F7EC790A4584} = {580D1AE7-AA8F-4912-8B76-105594E00B3B}
12121214
{19014C60-F87C-4CC7-AC0F-C41B6126EBCE} = {71A9F549-0EB6-41F9-BC16-4A6C5007FC91}
12131215
{94C8526E-DCC2-442F-9868-3DD0BA2688BE} = {71A9F549-0EB6-41F9-BC16-4A6C5007FC91}
@@ -1222,9 +1224,6 @@ Global
12221224
{FA3C7F91-42A2-45AD-897C-F646B081016C} = {71A9F549-0EB6-41F9-BC16-4A6C5007FC91}
12231225
{3DF5A9B8-6F90-4CFB-4518-0E97982B6748} = {71A9F549-0EB6-41F9-BC16-4A6C5007FC91}
12241226
{0762B436-F4B0-4008-9097-BB5FF6BD84AF} = {71A9F549-0EB6-41F9-BC16-4A6C5007FC91}
1225-
{3C688B3B-7919-6C9E-93A3-A3F6B3E684A9} = {22AB674F-ED91-4FBC-BFEE-8A1E82F9F05E}
1226-
{48A69DF9-9233-2548-C614-202D5780014D} = {3C688B3B-7919-6C9E-93A3-A3F6B3E684A9}
1227-
{0D36F844-0A1C-469F-93A1-C0E5AD141B07} = {48A69DF9-9233-2548-C614-202D5780014D}
12281227
{8D2921DD-ED7E-68AB-522C-54E23AAAFFCC} = {3C688B3B-7919-6C9E-93A3-A3F6B3E684A9}
12291228
{485FC8E4-6776-43E4-AD87-C583BC6136FE} = {8D2921DD-ED7E-68AB-522C-54E23AAAFFCC}
12301229
{27BBE29B-CE6F-401F-B3CF-B07DC556FAD1} = {22AB674F-ED91-4FBC-BFEE-8A1E82F9F05E}

src/Compatibility/ApiDiff/Microsoft.DotNet.ApiDiff.Tool/Program.cs

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,96 +18,96 @@ public static class Program
1818

1919
public static async Task Main(string[] args)
2020
{
21-
RootCommand rootCommand = new("genapidiff");
21+
RootCommand rootCommand = new("ApiDiff - Tool for generating a markdown diff of two different versions of the same assembly.");
2222

23-
Option<string> optionBeforeAssembliesFolderPath = new(name: "", aliases: ["--before", "-b"])
23+
Option<string> optionBeforeAssembliesFolderPath = new("--before", "-b")
2424
{
2525
Description = "The path to the folder containing the old (before) assemblies to be included in the diff.",
2626
Arity = ArgumentArity.ExactlyOne,
2727
Required = true
2828
};
2929

30-
Option<string> optionBeforeRefAssembliesFolderPath = new(name: "", aliases: ["--refbefore", "-rb"])
30+
Option<string> optionBeforeRefAssembliesFolderPath = new("--refbefore", "-rb")
3131
{
3232
Description = "The path to the folder containing the references required by old (before) assemblies, not to be included in the diff.",
3333
Arity = ArgumentArity.ExactlyOne,
3434
Required = false
3535
};
3636

37-
Option<string> optionAfterAssembliesFolderPath = new(name: "", aliases: ["--after", "-a"])
37+
Option<string> optionAfterAssembliesFolderPath = new("--after", "-a")
3838
{
3939
Description = "The path to the folder containing the new (after) assemblies to be included in the diff.",
4040
Arity = ArgumentArity.ExactlyOne,
4141
Required = true
4242
};
4343

44-
Option<string> optionAfterRefAssembliesFolderPath = new(name: "", aliases: ["--refafter", "-ra"])
44+
Option<string> optionAfterRefAssembliesFolderPath = new("--refafter", "-ra")
4545
{
4646
Description = "The path to the folder containing references required by the new (after) reference assemblies, not to be included in the diff.",
4747
Arity = ArgumentArity.ExactlyOne,
4848
Required = false
4949
};
5050

51-
Option<string> optionOutputFolderPath = new(name: "", aliases: ["--output", "-o"])
51+
Option<string> optionOutputFolderPath = new("--output", "-o")
5252
{
5353
Description = "The path to the output folder.",
5454
Arity = ArgumentArity.ExactlyOne,
5555
Required = true
5656
};
5757

58-
Option<string> optionBeforeFriendlyName = new(name: "", aliases: ["--beforeFriendlyName", "-bfn"])
58+
Option<string> optionBeforeFriendlyName = new("--beforeFriendlyName", "-bfn")
5959
{
6060
Description = "The friendly name to describe the 'before' assembly.",
6161
Arity = ArgumentArity.ExactlyOne,
6262
Required = true
6363
};
6464

65-
Option<string> optionAfterFriendlyName = new(name: "", aliases: ["--afterFriendlyName", "-afn"])
65+
Option<string> optionAfterFriendlyName = new("--afterFriendlyName", "-afn")
6666
{
6767
Description = "The friendly name to describe the 'after' assembly.",
6868
Arity = ArgumentArity.ExactlyOne,
6969
Required = true
7070
};
7171

72-
Option<string> optionTableOfContentsTitle = new(name: "", aliases: ["--tableOfContentsTitle", "-tc"])
72+
Option<string> optionTableOfContentsTitle = new("--tableOfContentsTitle", "-tc")
7373
{
7474
Description = $"The optional title of the markdown table of contents file that is placed in the output folder.",
75-
Arity = ArgumentArity.ZeroOrMore,
75+
Arity = ArgumentArity.ExactlyOne,
7676
Required = false,
7777
DefaultValueFactory = _ => "api_diff"
7878
};
7979

80-
Option<FileInfo[]?> optionFilesWithAssembliesToExclude = new(name: "", aliases: ["--assembliesToExclude", "-eas"])
80+
Option<FileInfo[]?> optionFilesWithAssembliesToExclude = new("--assembliesToExclude", "-eas")
8181
{
8282
Description = "An optional array of filepaths, each containing a list of assemblies that should be excluded from the diff. Each file should contain one assembly name per line, with no extensions.",
8383
Arity = ArgumentArity.ZeroOrMore,
8484
Required = false,
8585
DefaultValueFactory = _ => null
8686
};
8787

88-
Option<FileInfo[]?> optionFilesWithAttributesToExclude = new(name: "", aliases: ["--attributesToExclude", "-eattrs"])
88+
Option<FileInfo[]?> optionFilesWithAttributesToExclude = new("--attributesToExclude", "-eattrs")
8989
{
9090
Description = $"An optional array of filepaths, each containing a list of attributes to exclude from the diff. Each file should contain one API full name per line. You can either modify the default file '{AttributesToExcludeDefaultFileName}' to add your own attributes, or include additional files using this command line option.",
9191
Arity = ArgumentArity.ZeroOrMore,
9292
Required = false,
9393
DefaultValueFactory = _ => [new FileInfo(AttributesToExcludeDefaultFileName)]
9494
};
9595

96-
Option<FileInfo[]?> optionFilesWithApisToExclude = new(name: "", aliases: ["--apisToExclude", "-eapis"])
96+
Option<FileInfo[]?> optionFilesWithApisToExclude = new("--apisToExclude", "-eapis")
9797
{
9898
Description = "An optional array of filepaths, each containing a list of APIs to exclude from the diff. Each file should contain one API full name per line.",
9999
Arity = ArgumentArity.ZeroOrMore,
100100
Required = false,
101101
DefaultValueFactory = _ => null
102102
};
103103

104-
Option<bool> optionAddPartialModifier = new(name: "", aliases: ["--addPartialModifier", "-apm"])
104+
Option<bool> optionAddPartialModifier = new("--addPartialModifier", "-apm")
105105
{
106106
Description = "Add the 'partial' modifier to types.",
107107
DefaultValueFactory = _ => false
108108
};
109109

110-
Option<bool> optionAttachDebugger = new(name: "", aliases: ["--attachDebugger", "-d"])
110+
Option<bool> optionAttachDebugger = new("--attachDebugger", "-d")
111111
{
112112
Description = "Stops the tool at startup, prints the process ID and waits for a debugger to attach.",
113113
DefaultValueFactory = _ => false
@@ -128,9 +128,9 @@ public static async Task Main(string[] args)
128128
rootCommand.Options.Add(optionAddPartialModifier);
129129
rootCommand.Options.Add(optionAttachDebugger);
130130

131-
rootCommand.SetAction(async (ParseResult result) =>
131+
rootCommand.SetAction(async (ParseResult result, CancellationToken cancellationToken) =>
132132
{
133-
DiffConfiguration c = new(
133+
DiffConfiguration diffConfig = new(
134134
BeforeAssembliesFolderPath: result.GetValue(optionBeforeAssembliesFolderPath) ?? throw new NullReferenceException("Null before assemblies directory"),
135135
BeforeAssemblyReferencesFolderPath: result.GetValue(optionBeforeRefAssembliesFolderPath),
136136
AfterAssembliesFolderPath: result.GetValue(optionAfterAssembliesFolderPath) ?? throw new NullReferenceException("Null after assemblies directory"),
@@ -145,13 +145,15 @@ public static async Task Main(string[] args)
145145
AddPartialModifier: result.GetValue(optionAddPartialModifier),
146146
AttachDebugger: result.GetValue(optionAttachDebugger)
147147
);
148-
await HandleCommandAsync(c).ConfigureAwait(false);
148+
await HandleCommandAsync(diffConfig, cancellationToken).ConfigureAwait(false);
149149
});
150150
await rootCommand.Parse(args).InvokeAsync();
151151
}
152152

153-
private static Task HandleCommandAsync(DiffConfiguration diffConfig)
153+
private static Task HandleCommandAsync(DiffConfiguration diffConfig, CancellationToken cancellationToken = default)
154154
{
155+
cancellationToken.ThrowIfCancellationRequested();
156+
155157
var log = new ConsoleLog(MessageImportance.Normal);
156158

157159
string assembliesToExclude = string.Join(", ", diffConfig.FilesWithAssembliesToExclude?.Select(a => a.FullName) ?? []);
@@ -197,7 +199,7 @@ private static Task HandleCommandAsync(DiffConfiguration diffConfig)
197199
diagnosticOptions: null // TODO: If needed, add CLI option to pass specific diagnostic options
198200
);
199201

200-
return diffGenerator.RunAsync();
202+
return diffGenerator.RunAsync(cancellationToken);
201203
}
202204

203205
private static void WaitForDebugger()

src/Compatibility/ApiDiff/Microsoft.DotNet.ApiDiff/FileOutputDiffGenerator.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,13 @@ internal FileOutputDiffGenerator(ILog log,
8787
public IReadOnlyDictionary<string, string> Results => _results.AsReadOnly();
8888

8989
/// <inheritdoc/>
90-
public async Task RunAsync()
90+
public async Task RunAsync(CancellationToken cancellationToken)
9191
{
9292
Debug.Assert(_beforeAssembliesFolderPaths.Length == 1);
9393
Debug.Assert(_afterAssembliesFolderPaths.Length == 1);
9494

95+
cancellationToken.ThrowIfCancellationRequested();
96+
9597
(IAssemblySymbolLoader beforeLoader, Dictionary<string, IAssemblySymbol> beforeAssemblySymbols) =
9698
AssemblySymbolLoader.CreateFromFiles(
9799
_log,
@@ -118,7 +120,7 @@ public async Task RunAsync()
118120
_addPartialModifier,
119121
_diagnosticOptions);
120122

121-
await generator.RunAsync().ConfigureAwait(false);
123+
await generator.RunAsync(cancellationToken).ConfigureAwait(false);
122124

123125
// If true, output is disk. Otherwise, it's the Results dictionary.
124126
if (_writeToDisk)
@@ -135,6 +137,8 @@ public async Task RunAsync()
135137

136138
foreach ((string assemblyName, string text) in generator.Results.OrderBy(r => r.Key))
137139
{
140+
cancellationToken.ThrowIfCancellationRequested();
141+
138142
string fileName = $"{_tableOfContentsTitle}_{assemblyName}.md";
139143
tableOfContents.AppendLine($"* [{assemblyName}]({fileName})");
140144

src/Compatibility/ApiDiff/Microsoft.DotNet.ApiDiff/IDiffGenerator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@ public interface IDiffGenerator
1313
/// <summary>
1414
/// Asynchronously runs the diff generator and may populate the <see cref="Results"/> dictionary depending on the use case.
1515
/// </summary>
16-
Task RunAsync();
16+
Task RunAsync(CancellationToken cancellationToken);
1717
}

src/Compatibility/ApiDiff/Microsoft.DotNet.ApiDiff/MemoryOutputDiffGenerator.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,23 @@ internal MemoryOutputDiffGenerator(
8585
public IReadOnlyDictionary<string, string> Results => _results.AsReadOnly();
8686

8787
/// <inheritdoc/>
88-
public async Task RunAsync()
88+
public async Task RunAsync(CancellationToken cancellationToken)
8989
{
9090
Stopwatch swRun = Stopwatch.StartNew();
9191

9292
foreach ((string beforeAssemblyName, IAssemblySymbol beforeAssemblySymbol) in _beforeAssemblySymbols)
9393
{
94+
cancellationToken.ThrowIfCancellationRequested();
95+
9496
// Needs to block so the _afterAssemblySymbols dictionary gets updated.
9597
await ProcessBeforeAndAfterAssemblyAsync(beforeAssemblyName, beforeAssemblySymbol).ConfigureAwait(false);
9698
}
9799

98100
// Needs to happen after processing the before and after assemblies and filtering out the existing ones.
99101
foreach ((string afterAssemblyName, IAssemblySymbol afterAssemblySymbol) in _afterAssemblySymbols)
100102
{
103+
cancellationToken.ThrowIfCancellationRequested();
104+
101105
await ProcessNewAssemblyAsync(afterAssemblyName, afterAssemblySymbol).ConfigureAwait(false);
102106
}
103107

0 commit comments

Comments
 (0)