Skip to content

Commit 74141ae

Browse files
devlooped-botkzu
authored andcommitted
⬆️ Bump files with dotnet-file sync
# devlooped/oss - Update includes.yml to include top-level .md devlooped/oss@d152e74 - Add trx logger by default to CLI builds devlooped/oss@a75b141 - Remove -l:trx since it's just for dotnet test, not build devlooped/oss@0f7f7f7 # devlooped/SponsorLink - Bring humanizer to test project analyzers too devlooped/SponsorLink@e2d7e6f - Fix broken tests from new direct dep feature devlooped/SponsorLink@2a5e198
1 parent c559e23 commit 74141ae

File tree

5 files changed

+61
-27
lines changed

5 files changed

+61
-27
lines changed

.github/workflows/includes.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
- name: ✍ pull request
3232
uses: peter-evans/create-pull-request@v6
3333
with:
34-
add-paths: '**/*.md'
34+
add-paths: '**.md'
3535
base: main
3636
branch: markdown-includes
3737
delete-branch: true

.netconfig

+11-11
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@
6363
sha = e732f6a2c44a2f7940a1868a92cd66523f74ed24
6464
[file "Directory.Build.rsp"]
6565
url = https://github.com/devlooped/oss/blob/main/Directory.Build.rsp
66-
etag = 6a6c6e1d3895df953abf14c82b0899e3eea75cdcd679f6212dcfea15183d73d6
66+
etag = 0ccae83fc51f400bfd7058170bfec7aba11455e24a46a0d7e6a358da6486e255
6767
weak
68-
sha = ae25fae9d7daf0cb47d537ba870914aa3052f0c9
68+
sha = 0f7f7f7e8a29de9b535676f75fe7c67e629a5e8c
6969
[file "_config.yml"]
7070
url = https://github.com/devlooped/oss/blob/main/_config.yml
7171
etag = 9139148f845adf503fd3c3c140eb64421fc476a1f9c027fc50825c0efb05f557
@@ -114,8 +114,8 @@
114114
weak
115115
[file ".github/workflows/includes.yml"]
116116
url = https://github.com/devlooped/oss/blob/main/.github/workflows/includes.yml
117-
sha = 5fb172362c767bef7c36478f1a6bdc264723f8f9
118-
etag = e5ee22e115c925fb85ec931cda3ac811fcc453c03904554fa3f573935b221d34
117+
sha = d152e7437fd0d6f6d9363d23cb3b78c07335ea49
118+
etag = ec40db34f379d0c6d83b2ec15624f330318a172cc4f85b5417c63e86eaf601df
119119
weak
120120
[file ".github/workflows/combine-prs.yml"]
121121
url = https://github.com/devlooped/oss/blob/main/.github/workflows/combine-prs.yml
@@ -189,11 +189,6 @@
189189
sha = f47528874a6d9192b5546f84b455f5ccc474a707
190190
etag = 5002ac8c5bbeee60c13937a32c1b6c1a5dbf0065617c8f2550e6eca6fded256d
191191
weak
192-
[file "src/SponsorLink/SponsorLink.Tests.targets"]
193-
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/SponsorLink.Tests.targets
194-
sha = f47528874a6d9192b5546f84b455f5ccc474a707
195-
etag = 5be3b99c0049cbe98c305f5af2fd482a3a995960c3a1fc6dd2bffcbf3b7e4d52
196-
weak
197192
[file "src/SponsorLink/SponsorLink/AppDomainDictionary.cs"]
198193
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/SponsorLink/AppDomainDictionary.cs
199194
sha = f47528874a6d9192b5546f84b455f5ccc474a707
@@ -271,8 +266,8 @@
271266
weak
272267
[file "src/SponsorLink/Tests/AnalyzerTests.cs"]
273268
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/Tests/AnalyzerTests.cs
274-
sha = f47528874a6d9192b5546f84b455f5ccc474a707
275-
etag = 39227dc53df109e4d450cfe075ded530a8d23f9ea7b293dca58a6fdd3746875b
269+
sha = 2a5e198c982593da18b016161741c75846f67a71
270+
etag = 9a86f7482a4401a8dd30148976f47e2a98cb9cfe9c64153d336989146ce7b4b7
276271
weak
277272
[file "src/SponsorLink/Tests/Attributes.cs"]
278273
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/Tests/Attributes.cs
@@ -364,3 +359,8 @@
364359
sha = 06ad2df230e2de316655ae6073d493bf04805d46
365360
etag = 4d2939c5005cd6136065bf2b1cd62f96351a8d94d904d141bcb11186e8c16b3b
366361
weak
362+
[file "src/SponsorLink/SponsorLink.Analyzer.Tests.targets"]
363+
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/SponsorLink.Analyzer.Tests.targets
364+
sha = e2d7e6f3b23ef5d5ead947f48c63efc77f3d4741
365+
etag = 6959847d7e6425906530095e564f46bdfddf26995e6663142cfd2b065c0bb3c4
366+
weak

Directory.Build.rsp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22
-nr:false
33
-m:1
44
-v:m
5-
-clp:Summary;ForceNoAlign
5+
-clp:Summary;ForceNoAlign

src/SponsorLink/SponsorLink.Tests.targets src/SponsorLink/SponsorLink.Analyzer.Tests.targets

+3-2
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,12 @@
2626
!$([MSBuild]::ValueOrDefault('%(FileName)', '').StartsWith('Microsoft.CSharp', StringComparison.OrdinalIgnoreCase)) And
2727
!$([MSBuild]::ValueOrDefault('%(FileName)', '').StartsWith('System.', StringComparison.OrdinalIgnoreCase))"
2828
/>
29-
<!-- Brings in System/Microsoft.IdentityModel, System.Text.Encodings.Web, System.Text.Json -->
29+
<!-- Brings in System/Microsoft.IdentityModel, System.Text.Encodings.Web, System.Text.Json, Humanizer -->
3030
<Analyzer Include="@(ReferenceCopyLocalAssemblies)" Condition="
3131
$([MSBuild]::ValueOrDefault('%(FileName)', '').StartsWith('System.IdentityModel', StringComparison.OrdinalIgnoreCase)) Or
3232
$([MSBuild]::ValueOrDefault('%(FileName)', '').StartsWith('Microsoft.IdentityModel', StringComparison.OrdinalIgnoreCase)) Or
33-
$([MSBuild]::ValueOrDefault('%(FileName)', '').StartsWith('System.Text', StringComparison.OrdinalIgnoreCase))"
33+
$([MSBuild]::ValueOrDefault('%(FileName)', '').StartsWith('System.Text', StringComparison.OrdinalIgnoreCase)) Or
34+
$([MSBuild]::ValueOrDefault('%(FileName)', '').StartsWith('Humanizer', StringComparison.OrdinalIgnoreCase))"
3435
/>
3536
</ItemGroup>
3637
</Target>

src/SponsorLink/Tests/AnalyzerTests.cs

+45-12
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,14 @@ void IDisposable.Dispose()
4444
public async Task WhenNoAdditionalFiles_ThenReportsUnknown()
4545
{
4646
var compilation = CSharpCompilation.Create("test", [CSharpSyntaxTree.ParseText("//")])
47-
.WithAnalyzers([new SponsorLinkAnalyzer()]);
47+
.WithAnalyzers([new SponsorLinkAnalyzer()],
48+
new AnalyzerOptions([], new TestAnalyzerConfigOptionsProvider(new())
49+
{
50+
// Force reporting without wait period
51+
{ "build_property.SponsorLinkNoInstallGrace", "true" },
52+
// Simulate directly referenced package
53+
{ "build_property.SponsorableLib", "1.0.0" },
54+
}));
4855

4956
var diagnostics = await compilation.GetAnalyzerDiagnosticsAsync();
5057

@@ -91,7 +98,9 @@ public async Task WhenUnknownAndNoGraceOption_ThenReportsUnknown()
9198
{
9299
{ "build_property.SponsorLinkNoInstallGrace", "true" },
93100
{ "build_metadata.Analyzer.ItemType", "Analyzer" },
94-
{ "build_metadata.Analyzer.NuGetPackageId", "SponsorableLib" }
101+
{ "build_metadata.Analyzer.NuGetPackageId", "SponsorableLib" },
102+
// Simulate directly referenced package
103+
{ "build_property.SponsorableLib", "1.0.0" },
95104
}));
96105

97106
var diagnostics = await compilation.GetAnalyzerDiagnosticsAsync();
@@ -119,7 +128,9 @@ public async Task WhenUnknownAndGraceExpired_ThenReportsUnknown()
119128
.WithAnalyzers([new SponsorLinkAnalyzer()], new AnalyzerOptions([new AdditionalTextFile(dll)], new TestAnalyzerConfigOptionsProvider(new())
120129
{
121130
{ "build_metadata.Analyzer.ItemType", "Analyzer" },
122-
{ "build_metadata.Analyzer.NuGetPackageId", "SponsorableLib" }
131+
{ "build_metadata.Analyzer.NuGetPackageId", "SponsorableLib" },
132+
// Simulate directly referenced package
133+
{ "build_property.SponsorableLib", "1.0.0" },
123134
}));
124135

125136
var diagnostics = await compilation.GetAnalyzerDiagnosticsAsync();
@@ -144,7 +155,9 @@ public async Task WhenSponsoring_ThenReportsSponsor()
144155
var compilation = CSharpCompilation.Create("test", [CSharpSyntaxTree.ParseText("//")])
145156
.WithAnalyzers([new SponsorLinkAnalyzer()], new AnalyzerOptions([new AdditionalTextFile(jwt)], new TestAnalyzerConfigOptionsProvider(new())
146157
{
147-
{ "build_metadata.SponsorManifest.ItemType", "SponsorManifest" }
158+
{ "build_metadata.SponsorManifest.ItemType", "SponsorManifest" },
159+
// Simulate directly referenced package
160+
{ "build_property.SponsorableLib", "1.0.0" },
148161
}));
149162

150163
var diagnostics = await compilation.GetAnalyzerDiagnosticsAsync();
@@ -163,21 +176,41 @@ public async Task WhenSponsoring_ThenReportsSponsor()
163176
public async Task WhenMultipleAnalyzers_ThenReportsOnce()
164177
{
165178
var compilation = CSharpCompilation.Create("test", [CSharpSyntaxTree.ParseText("//")])
166-
.WithAnalyzers([new SponsorLinkAnalyzer(), new SponsorLinkAnalyzer()]);
167-
168-
var diagnostics = await compilation.GetAnalyzerDiagnosticsAsync();
179+
.WithAnalyzers([new SponsorLinkAnalyzer(), new SponsorLinkAnalyzer()],
180+
new AnalyzerOptions([], new TestAnalyzerConfigOptionsProvider(new())
181+
{
182+
// Force reporting without wait period
183+
{ "build_property.SponsorLinkNoInstallGrace", "true" },
184+
// Simulate directly referenced package
185+
{ "build_property.SponsorableLib", "1.0.0" },
186+
{ "build_property.SponsorLink", "1.0.0" },
187+
}));
188+
189+
var diagnostics = (await compilation.GetAnalyzerDiagnosticsAsync())
190+
.Where(x => x.Properties.TryGetValue(nameof(SponsorStatus), out var _));
169191

170192
Assert.NotEmpty(diagnostics);
193+
Assert.Single(diagnostics.Where(x => x.Properties.TryGetValue(nameof(SponsorStatus), out var value)));
194+
}
171195

172-
var diagnostic = diagnostics.Single(x => x.Properties.TryGetValue(nameof(SponsorStatus), out var value));
196+
[Fact]
197+
public async Task WhenAnalyzerNotDirectlyReferenced_ThenDoesNotReport()
198+
{
199+
var compilation = CSharpCompilation.Create("test", [CSharpSyntaxTree.ParseText("//")])
200+
.WithAnalyzers([new SponsorLinkAnalyzer()],
201+
new AnalyzerOptions([], new TestAnalyzerConfigOptionsProvider(new())
202+
{
203+
// Force reporting if necessary without wait period
204+
{ "build_property.SponsorLinkNoInstallGrace", "true" },
205+
// Directly referenced package would result in a compiler visible property like:
206+
//{ "build_property.SponsorableLib", "1.0.0" },
207+
}));
173208

174-
Assert.True(diagnostic.Properties.TryGetValue(nameof(SponsorStatus), out var value));
175-
var status = Enum.Parse<SponsorStatus>(value);
209+
var diagnostics = await compilation.GetAnalyzerDiagnosticsAsync();
176210

177-
Assert.Equal(SponsorStatus.Unknown, status);
211+
Assert.Empty(diagnostics);
178212
}
179213

180-
181214
string GetTempPath([CallerMemberName] string? test = default)
182215
{
183216
var path = Path.Combine(Path.GetTempPath(), test ?? nameof(AnalyzerTests));

0 commit comments

Comments
 (0)