Skip to content

Commit

Permalink
⬆️ Bump files with dotnet-file sync
Browse files Browse the repository at this point in the history
# 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
  • Loading branch information
devlooped-bot authored and kzu committed Jul 21, 2024
1 parent c559e23 commit 74141ae
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/includes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- name: ✍ pull request
uses: peter-evans/create-pull-request@v6
with:
add-paths: '**/*.md'
add-paths: '**.md'
base: main
branch: markdown-includes
delete-branch: true
Expand Down
22 changes: 11 additions & 11 deletions .netconfig
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@
sha = e732f6a2c44a2f7940a1868a92cd66523f74ed24
[file "Directory.Build.rsp"]
url = https://github.com/devlooped/oss/blob/main/Directory.Build.rsp
etag = 6a6c6e1d3895df953abf14c82b0899e3eea75cdcd679f6212dcfea15183d73d6
etag = 0ccae83fc51f400bfd7058170bfec7aba11455e24a46a0d7e6a358da6486e255
weak
sha = ae25fae9d7daf0cb47d537ba870914aa3052f0c9
sha = 0f7f7f7e8a29de9b535676f75fe7c67e629a5e8c
[file "_config.yml"]
url = https://github.com/devlooped/oss/blob/main/_config.yml
etag = 9139148f845adf503fd3c3c140eb64421fc476a1f9c027fc50825c0efb05f557
Expand Down Expand Up @@ -114,8 +114,8 @@
weak
[file ".github/workflows/includes.yml"]
url = https://github.com/devlooped/oss/blob/main/.github/workflows/includes.yml
sha = 5fb172362c767bef7c36478f1a6bdc264723f8f9
etag = e5ee22e115c925fb85ec931cda3ac811fcc453c03904554fa3f573935b221d34
sha = d152e7437fd0d6f6d9363d23cb3b78c07335ea49
etag = ec40db34f379d0c6d83b2ec15624f330318a172cc4f85b5417c63e86eaf601df
weak
[file ".github/workflows/combine-prs.yml"]
url = https://github.com/devlooped/oss/blob/main/.github/workflows/combine-prs.yml
Expand Down Expand Up @@ -189,11 +189,6 @@
sha = f47528874a6d9192b5546f84b455f5ccc474a707
etag = 5002ac8c5bbeee60c13937a32c1b6c1a5dbf0065617c8f2550e6eca6fded256d
weak
[file "src/SponsorLink/SponsorLink.Tests.targets"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/SponsorLink.Tests.targets
sha = f47528874a6d9192b5546f84b455f5ccc474a707
etag = 5be3b99c0049cbe98c305f5af2fd482a3a995960c3a1fc6dd2bffcbf3b7e4d52
weak
[file "src/SponsorLink/SponsorLink/AppDomainDictionary.cs"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/SponsorLink/AppDomainDictionary.cs
sha = f47528874a6d9192b5546f84b455f5ccc474a707
Expand Down Expand Up @@ -271,8 +266,8 @@
weak
[file "src/SponsorLink/Tests/AnalyzerTests.cs"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/Tests/AnalyzerTests.cs
sha = f47528874a6d9192b5546f84b455f5ccc474a707
etag = 39227dc53df109e4d450cfe075ded530a8d23f9ea7b293dca58a6fdd3746875b
sha = 2a5e198c982593da18b016161741c75846f67a71
etag = 9a86f7482a4401a8dd30148976f47e2a98cb9cfe9c64153d336989146ce7b4b7
weak
[file "src/SponsorLink/Tests/Attributes.cs"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/Tests/Attributes.cs
Expand Down Expand Up @@ -364,3 +359,8 @@
sha = 06ad2df230e2de316655ae6073d493bf04805d46
etag = 4d2939c5005cd6136065bf2b1cd62f96351a8d94d904d141bcb11186e8c16b3b
weak
[file "src/SponsorLink/SponsorLink.Analyzer.Tests.targets"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/SponsorLink.Analyzer.Tests.targets
sha = e2d7e6f3b23ef5d5ead947f48c63efc77f3d4741
etag = 6959847d7e6425906530095e564f46bdfddf26995e6663142cfd2b065c0bb3c4
weak
2 changes: 1 addition & 1 deletion Directory.Build.rsp
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
-nr:false
-m:1
-v:m
-clp:Summary;ForceNoAlign
-clp:Summary;ForceNoAlign
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@
!$([MSBuild]::ValueOrDefault('%(FileName)', '').StartsWith('Microsoft.CSharp', StringComparison.OrdinalIgnoreCase)) And
!$([MSBuild]::ValueOrDefault('%(FileName)', '').StartsWith('System.', StringComparison.OrdinalIgnoreCase))"
/>
<!-- Brings in System/Microsoft.IdentityModel, System.Text.Encodings.Web, System.Text.Json -->
<!-- Brings in System/Microsoft.IdentityModel, System.Text.Encodings.Web, System.Text.Json, Humanizer -->
<Analyzer Include="@(ReferenceCopyLocalAssemblies)" Condition="
$([MSBuild]::ValueOrDefault('%(FileName)', '').StartsWith('System.IdentityModel', StringComparison.OrdinalIgnoreCase)) Or
$([MSBuild]::ValueOrDefault('%(FileName)', '').StartsWith('Microsoft.IdentityModel', StringComparison.OrdinalIgnoreCase)) Or
$([MSBuild]::ValueOrDefault('%(FileName)', '').StartsWith('System.Text', StringComparison.OrdinalIgnoreCase))"
$([MSBuild]::ValueOrDefault('%(FileName)', '').StartsWith('System.Text', StringComparison.OrdinalIgnoreCase)) Or
$([MSBuild]::ValueOrDefault('%(FileName)', '').StartsWith('Humanizer', StringComparison.OrdinalIgnoreCase))"
/>
</ItemGroup>
</Target>
Expand Down
57 changes: 45 additions & 12 deletions src/SponsorLink/Tests/AnalyzerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,14 @@ void IDisposable.Dispose()
public async Task WhenNoAdditionalFiles_ThenReportsUnknown()
{
var compilation = CSharpCompilation.Create("test", [CSharpSyntaxTree.ParseText("//")])
.WithAnalyzers([new SponsorLinkAnalyzer()]);
.WithAnalyzers([new SponsorLinkAnalyzer()],
new AnalyzerOptions([], new TestAnalyzerConfigOptionsProvider(new())
{
// Force reporting without wait period
{ "build_property.SponsorLinkNoInstallGrace", "true" },
// Simulate directly referenced package
{ "build_property.SponsorableLib", "1.0.0" },
}));

var diagnostics = await compilation.GetAnalyzerDiagnosticsAsync();

Expand Down Expand Up @@ -91,7 +98,9 @@ public async Task WhenUnknownAndNoGraceOption_ThenReportsUnknown()
{
{ "build_property.SponsorLinkNoInstallGrace", "true" },
{ "build_metadata.Analyzer.ItemType", "Analyzer" },
{ "build_metadata.Analyzer.NuGetPackageId", "SponsorableLib" }
{ "build_metadata.Analyzer.NuGetPackageId", "SponsorableLib" },
// Simulate directly referenced package
{ "build_property.SponsorableLib", "1.0.0" },
}));

var diagnostics = await compilation.GetAnalyzerDiagnosticsAsync();
Expand Down Expand Up @@ -119,7 +128,9 @@ public async Task WhenUnknownAndGraceExpired_ThenReportsUnknown()
.WithAnalyzers([new SponsorLinkAnalyzer()], new AnalyzerOptions([new AdditionalTextFile(dll)], new TestAnalyzerConfigOptionsProvider(new())
{
{ "build_metadata.Analyzer.ItemType", "Analyzer" },
{ "build_metadata.Analyzer.NuGetPackageId", "SponsorableLib" }
{ "build_metadata.Analyzer.NuGetPackageId", "SponsorableLib" },
// Simulate directly referenced package
{ "build_property.SponsorableLib", "1.0.0" },
}));

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

var diagnostics = await compilation.GetAnalyzerDiagnosticsAsync();
Expand All @@ -163,21 +176,41 @@ public async Task WhenSponsoring_ThenReportsSponsor()
public async Task WhenMultipleAnalyzers_ThenReportsOnce()
{
var compilation = CSharpCompilation.Create("test", [CSharpSyntaxTree.ParseText("//")])
.WithAnalyzers([new SponsorLinkAnalyzer(), new SponsorLinkAnalyzer()]);

var diagnostics = await compilation.GetAnalyzerDiagnosticsAsync();
.WithAnalyzers([new SponsorLinkAnalyzer(), new SponsorLinkAnalyzer()],
new AnalyzerOptions([], new TestAnalyzerConfigOptionsProvider(new())
{
// Force reporting without wait period
{ "build_property.SponsorLinkNoInstallGrace", "true" },
// Simulate directly referenced package
{ "build_property.SponsorableLib", "1.0.0" },
{ "build_property.SponsorLink", "1.0.0" },
}));

var diagnostics = (await compilation.GetAnalyzerDiagnosticsAsync())
.Where(x => x.Properties.TryGetValue(nameof(SponsorStatus), out var _));

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

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

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

Assert.Equal(SponsorStatus.Unknown, status);
Assert.Empty(diagnostics);
}


string GetTempPath([CallerMemberName] string? test = default)
{
var path = Path.Combine(Path.GetTempPath(), test ?? nameof(AnalyzerTests));
Expand Down

0 comments on commit 74141ae

Please sign in to comment.