Skip to content

Commit

Permalink
⬆️ Bump files with dotnet-file sync
Browse files Browse the repository at this point in the history
# devlooped/SponsorLink

- Add specific diagnostic/status for oss authors devlooped/SponsorLink@2992156
  • Loading branch information
devlooped-bot authored and kzu committed Sep 30, 2024
1 parent 7b525af commit 7363c92
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 13 deletions.
20 changes: 10 additions & 10 deletions .netconfig
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@
weak
[file "src/SponsorLink/SponsorLink/DiagnosticsManager.cs"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/SponsorLink/DiagnosticsManager.cs
sha = 040db4d1600367813d37d5e802e7efbb2de839f7
etag = 16abe935147080f29e81331fbe7ea384ddcf931b3e81eb07ac8983ecd574850e
sha = 29921560c73bb91c2a21a21800daf0b250773598
etag = a5d79dbc0ed9fac4fb1879fb3790b9ebab18e47c14c454554ce9f53f21487bb5
weak
[file "src/SponsorLink/SponsorLink/ManifestStatus.cs"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/SponsorLink/ManifestStatus.cs
Expand All @@ -201,13 +201,13 @@
weak
[file "src/SponsorLink/SponsorLink/Resources.es.resx"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/SponsorLink/Resources.es.resx
sha = 586398c3e650495f36601ecc8983a14ed745e058
etag = afa80a038b6752b4e5221273fe3609a8ae2f96d96eee928632f50029dad0d2ed
sha = 29921560c73bb91c2a21a21800daf0b250773598
etag = feb9dc86e4d9c0c4a294cd6e03c5b914943e8d206b88a125abd1b0f882ddb247
weak
[file "src/SponsorLink/SponsorLink/Resources.resx"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/SponsorLink/Resources.resx
sha = d868eee9cc6231fd9b66122f908a3d16b40d9174
etag = a10bf29ed591bb9b21bf937e9c1d07ce5d1e5bcf4c3e0c7088292725c0e952ab
sha = 29921560c73bb91c2a21a21800daf0b250773598
etag = 7665a3be17cd224b1c413ade6a9c1c5a822dace1e7f9daae33a2e52d8bca15bb
weak
[file "src/SponsorLink/SponsorLink/SponsorLink.cs"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/SponsorLink/SponsorLink.cs
Expand All @@ -226,8 +226,8 @@
weak
[file "src/SponsorLink/SponsorLink/SponsorStatus.cs"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/SponsorLink/SponsorStatus.cs
sha = ca82a9d6298a933192c5dfd2c5881ebadb85d0fe
etag = cd51bb4f18ee3770aefc97312721f4787aa9161561a0125be71db4f3d8325f56
sha = 29921560c73bb91c2a21a21800daf0b250773598
etag = 419a823edb42d9175ae96d66a8b0191d8fc91921268c2a5340cf8d34519d4535
weak
[file "src/SponsorLink/SponsorLink/SponsorableLib.targets"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/SponsorLink/SponsorableLib.targets
Expand Down Expand Up @@ -261,8 +261,8 @@
weak
[file "src/SponsorLink/Tests/AnalyzerTests.cs"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/Tests/AnalyzerTests.cs
sha = ca82a9d6298a933192c5dfd2c5881ebadb85d0fe
etag = f6a457be2066ea997e23380628b9dd75a207c8992604ad997521c6bbe99fe07a
sha = 29921560c73bb91c2a21a21800daf0b250773598
etag = 219df696a47a58d9de377166c87fbb199c84c33d3b7a0f7ae349543df050a583
weak
[file "src/SponsorLink/Tests/Attributes.cs"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/Tests/Attributes.cs
Expand Down
1 change: 0 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,6 @@ The versioning scheme for packages is:
[![ChilliCream](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/ChilliCream.png "ChilliCream")](https://github.com/ChilliCream)
[![4OTC](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/4OTC.png "4OTC")](https://github.com/4OTC)
[![Vincent Limo](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/v-limo.png "Vincent Limo")](https://github.com/v-limo)
[![Brooke Hamilton](https://raw.githubusercontent.com/devlooped/sponsors/main/.github/avatars/brooke-hamilton.png "Brooke Hamilton")](https://github.com/brooke-hamilton)


<!-- sponsors.md -->
Expand Down
17 changes: 16 additions & 1 deletion src/SponsorLink/SponsorLink/DiagnosticsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ class DiagnosticsManager
{ SponsorStatus.Unknown, CreateUnknown([.. Sponsorables.Keys], Funding.Product, Funding.Prefix) },
{ SponsorStatus.Grace, CreateGrace([.. Sponsorables.Keys], Funding.Product, Funding.Prefix) },
{ SponsorStatus.User, CreateSponsor([.. Sponsorables.Keys], Funding.Prefix) },
{ SponsorStatus.Contributor, CreateContributor([.. Sponsorables.Keys], Funding.Prefix) },
{ SponsorStatus.Contributor, CreateContributor([.. Sponsorables.Keys], Funding.Prefix, hidden: true) },
// NOTE: similar to contributor, we don't show OSS author membership in the IDE.
{ SponsorStatus.OpenSource, CreateOpenSource([.. Sponsorables.Keys], Funding.Prefix) },
// NOTE: organization is a special case of sponsor, but we report it as hidden since the user isn't directly involved.
{ SponsorStatus.Organization, CreateSponsor([.. Sponsorables.Keys], Funding.Prefix, hidden: true) },
// NOTE: similar to organization, we don't show team membership in the IDE.
Expand Down Expand Up @@ -192,6 +194,8 @@ SponsorStatus GetOrSetStatus(Func<ImmutableArray<AdditionalText>> getAdditionalF
SponsorStatus.Contributor :
claims.IsInRole("org") ?
SponsorStatus.Organization :
claims.IsInRole("oss") ?
SponsorStatus.OpenSource :
SponsorStatus.Unknown;

if (KnownDescriptors.TryGetValue(status, out var descriptor))
Expand Down Expand Up @@ -284,4 +288,15 @@ SponsorStatus GetOrSetStatus(Func<ImmutableArray<AdditionalText>> getAdditionalF
description: Resources.Contributor_Description,
helpLinkUri: Funding.HelpUrl,
"DoesNotSupportF1Help", "CompilationEnd");

internal static DiagnosticDescriptor CreateOpenSource(string[] sponsorable, string prefix, bool hidden = false) => new(
$"{prefix}112",
Resources.OpenSource_Title,
Resources.OpenSource_Message,
"SponsorLink",
hidden ? DiagnosticSeverity.Hidden : DiagnosticSeverity.Info,
isEnabledByDefault: true,
description: Resources.OpenSource_Description,
helpLinkUri: Funding.HelpUrl,
"DoesNotSupportF1Help", "CompilationEnd");
}
9 changes: 9 additions & 0 deletions src/SponsorLink/SponsorLink/Resources.es.resx
Original file line number Diff line number Diff line change
Expand Up @@ -212,4 +212,13 @@ Por favor considera apoyar el proyecto patrocinando en {0} y ejecutando posterio
/// ¡Gracias! 🙏
/// &lt;/remarks&gt;</value>
</data>
<data name="OpenSource_Description" xml:space="preserve">
<value>Gracias por ser parte de la comunidad de código abierto con tus contribuciones 🙏.</value>
</data>
<data name="OpenSource_Message" xml:space="preserve">
<value>Gracias por ser autor de código abierto 💟!</value>
</data>
<data name="OpenSource_Title" xml:space="preserve">
<value>Sos un autor de código abierto, eres lo máximo 💟!</value>
</data>
</root>
9 changes: 9 additions & 0 deletions src/SponsorLink/SponsorLink/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -216,4 +216,13 @@ Please consider supporting the project by sponsoring at {0} and running 'sponsor
/// Thanks! 🙏
/// &lt;/remarks&gt;</value>
</data>
<data name="OpenSource_Description" xml:space="preserve">
<value>Thanks for being part of the open source community with your contributions 🙏.</value>
</data>
<data name="OpenSource_Message" xml:space="preserve">
<value>Thank you for being an open source author 💟!</value>
</data>
<data name="OpenSource_Title" xml:space="preserve">
<value>You are a an open source author, you rock 💟!</value>
</data>
</root>
6 changes: 5 additions & 1 deletion src/SponsorLink/SponsorLink/SponsorStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,9 @@ public enum SponsorStatus
/// <summary>
/// The user is a member of a contributing organization.
/// </summary>
Organization
Organization,
/// <summary>
/// The user is a OSS author.
/// </summary>
OpenSource,
}
5 changes: 5 additions & 0 deletions src/SponsorLink/Tests/AnalyzerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,10 @@ public async Task WhenUnknownAndGraceExpired_ThenReportsUnknown()
[InlineData("org,contrib", SponsorStatus.Contributor)]
// team trumps contrib (since team members will typically also be contributors
[InlineData("contrib,team", SponsorStatus.Team)]
[InlineData("contrib,oss", SponsorStatus.Contributor)]
[InlineData("user,oss", SponsorStatus.User)]
[InlineData("org,oss", SponsorStatus.Organization)]
[InlineData("oss", SponsorStatus.OpenSource)]
public async Task WhenSponsoringRole_ThenEnsureStatus(string roles, SponsorStatus status)
{
var sponsor = sponsorable.Sign(roles.Split(',').Select(x => new Claim("roles", x)), expiration: TimeSpan.FromMinutes(5));
Expand Down Expand Up @@ -202,6 +206,7 @@ public async Task WhenMultipleAnalyzers_ThenReportsOnce()
// Simulate directly referenced package
{ "build_property.SponsorableLib", "1.0.0" },
{ "build_property.SponsorLink", "1.0.0" },
{ "build_metadata.SponsorManifest.ItemType", "SponsorManifest" }
}));

var diagnostics = (await compilation.GetAnalyzerDiagnosticsAsync())
Expand Down

0 comments on commit 7363c92

Please sign in to comment.