From da3aadb6ef9353bcbc2db0293e3398c23fb54025 Mon Sep 17 00:00:00 2001 From: devlooped-bot Date: Thu, 20 Jun 2024 01:03:04 +0000 Subject: [PATCH] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Bump=20files=20with=20dotn?= =?UTF-8?q?et-file=20sync=20#=20devlooped/oss?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Dynamically fetch devlooped JWK from github https://github.com/devlooped/oss/commit/55124bc - Fix path to jwk.ps1 alongside the SponsorLink.targets https://github.com/devlooped/oss/commit/c4830fc - Add targets for inclusion from tests https://github.com/devlooped/oss/commit/81ba912 - Remove dependency on ThisAssembly https://github.com/devlooped/oss/commit/c879f25 - SponsorLink code should be checked as regular code https://github.com/devlooped/oss/commit/e81ab75 - Improve versioning of sample package https://github.com/devlooped/oss/commit/3b943f5 - Fix scenario where multiple packages share product name https://github.com/devlooped/oss/commit/23f83bd - Set Version from VersionLabel if it's a refs/tags/ https://github.com/devlooped/oss/commit/57653a2 - Cleanup build and publish to use VersionLabel https://github.com/devlooped/oss/commit/14deaea - Rename sample assemblies for nicer display https://github.com/devlooped/oss/commit/93df7c7 - Switch to the dotnet global tool version of SL CLI https://github.com/devlooped/oss/commit/cff07df - Switch to renamed sponsorlink > sponsor https://github.com/devlooped/oss/commit/d5efe5e - Bump to renamed tool https://github.com/devlooped/oss/commit/b8fd87b - Revert back to dotnet-sponsor https://github.com/devlooped/oss/commit/8d29f01 - SponsorLink-enabled analyzers need copylocal https://github.com/devlooped/oss/commit/7593657 - Minor code simplification https://github.com/devlooped/oss/commit/cf154d5 --- .editorconfig | 3 - .netconfig | 111 ++++++++++-------- src/Directory.Build.props | 6 +- src/SponsorLink/Analyzer/Analyzer.csproj | 5 + .../Analyzer/StatusReportingAnalyzer.cs | 1 - src/SponsorLink/Directory.Build.props | 6 +- src/SponsorLink/Library/Library.csproj | 14 +-- src/SponsorLink/Library/readme.md | 5 + src/SponsorLink/SponsorLink.Tests.targets | 38 ++++++ src/SponsorLink/SponsorLink.targets | 73 +++++++++--- .../SponsorLink/DiagnosticsManager.cs | 29 +++-- ...{SponsorLink.es.resx => Resources.es.resx} | 10 +- .../{SponsorLink.resx => Resources.resx} | 8 +- src/SponsorLink/SponsorLink/SponsorLink.cs | 2 +- .../SponsorLink/SponsorLink.csproj | 55 +++++++-- .../SponsorLink/SponsorLinkAnalyzer.cs | 19 +-- src/SponsorLink/SponsorLink/ThisAssembly.cs | 31 ----- .../Devlooped.Sponsors.targets | 7 +- src/SponsorLink/SponsorLink/devlooped.pub.jwk | 5 - src/SponsorLink/Tests/Resources.Designer.cs | 63 ++++++++++ src/SponsorLink/Tests/Resources.resx | 101 ++++++++++++++++ src/SponsorLink/Tests/Sample.cs | 2 +- src/SponsorLink/Tests/Tests.csproj | 15 +++ src/SponsorLink/jwk.ps1 | 1 + 24 files changed, 442 insertions(+), 168 deletions(-) create mode 100644 src/SponsorLink/Library/readme.md create mode 100644 src/SponsorLink/SponsorLink.Tests.targets rename src/SponsorLink/SponsorLink/{SponsorLink.es.resx => Resources.es.resx} (92%) rename src/SponsorLink/SponsorLink/{SponsorLink.resx => Resources.resx} (94%) delete mode 100644 src/SponsorLink/SponsorLink/ThisAssembly.cs delete mode 100644 src/SponsorLink/SponsorLink/devlooped.pub.jwk create mode 100644 src/SponsorLink/Tests/Resources.Designer.cs create mode 100644 src/SponsorLink/Tests/Resources.resx create mode 100644 src/SponsorLink/jwk.ps1 diff --git a/.editorconfig b/.editorconfig index e17d14e..4cab270 100644 --- a/.editorconfig +++ b/.editorconfig @@ -107,6 +107,3 @@ dotnet_analyzer_diagnostic.category-Style.severity = none # VSTHRD200: Use "Async" suffix for async methods dotnet_diagnostic.VSTHRD200.severity = none - -[**/*SponsorLink*/**] -generated_code = true \ No newline at end of file diff --git a/.netconfig b/.netconfig index 75e23bf..20c5148 100644 --- a/.netconfig +++ b/.netconfig @@ -26,8 +26,8 @@ skip [file ".editorconfig"] url = https://github.com/devlooped/oss/blob/main/.editorconfig - sha = f571a42eac3cad554810dad15139ff390db5e1db - etag = ba2655b8b3ce5491b1c0eea5e0af201a085c48e07542bb9ec2c928084944ea86 + sha = e81ab754b366d52d92bd69b24bef1d5b1c610634 + etag = 7298c6450967975a8782b5c74f3071e1910fc59686e48f9c9d5cd7c68213cf59 weak [file ".gitattributes"] url = https://github.com/devlooped/oss/blob/main/.gitattributes @@ -87,8 +87,8 @@ weak [file "src/Directory.Build.props"] url = https://github.com/devlooped/oss/blob/main/src/Directory.Build.props - sha = 6e96c592c7b44bfda10404b9f90e4b8fab299249 - etag = a4925eb815bbcecc022de8d3245db069573d96ac5ecdf5f0e604f06b5577b01e + sha = 14deaea5cecc64df51781d29891a2f67caf8be16 + etag = f177eb767aaa6a347da43ff7ff419c9a0736c562cb171e17ded8007a1945a8b0 weak [file "src/Directory.Build.targets"] url = https://github.com/devlooped/oss/blob/main/src/Directory.Build.targets @@ -127,8 +127,8 @@ weak [file "src/SponsorLink/Analyzer/Analyzer.csproj"] url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/Analyzer/Analyzer.csproj - sha = 7cda4a18313b0b38b26c0152e1007cdbb9b6ba3a - etag = d9444fa36daa8f4ff8f06fc2f9f600dbd8032f25ff58542d3b96676e0305677e + sha = 93df7c7ec34f83ae58efbf213624d5ea31fe3c41 + etag = f76e33fde812244a275b95c8815101f6f87d144a5305a2c1f0f631f770d91920 weak [file "src/SponsorLink/Analyzer/Properties/launchSettings.json"] url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/Analyzer/Properties/launchSettings.json @@ -137,8 +137,8 @@ weak [file "src/SponsorLink/Analyzer/StatusReportingAnalyzer.cs"] url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/Analyzer/StatusReportingAnalyzer.cs - sha = a0ae7272f31c766ebb129ea38c11c01df93b6b5d - etag = 23d4cd16294974d85164fc26d6a7e2ae52698f23a62463db5025d69d9c166dc5 + sha = c879f25bf483086725c8a29f104555644e6ee542 + etag = cde10b763b87a3987e86cca2292c9afc7637d2113b9921e79492b6a31620bbb4 weak [file "src/SponsorLink/Analyzer/buildTransitive/SponsorableLib.targets"] url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/Analyzer/buildTransitive/SponsorableLib.targets @@ -147,8 +147,8 @@ weak [file "src/SponsorLink/Directory.Build.props"] url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/Directory.Build.props - sha = a0ae7272f31c766ebb129ea38c11c01df93b6b5d - etag = 6823e1e914ecedd174276e3d53517cc0b332bb47c56402a9512cfa6aeeeb067e + sha = 3b943f5aa59f33141d1c0fffcb215446d594ad53 + etag = 0c7737411744012078642dbfc174af3f2ac7dc9f7b8ea4423981ae38753a5be4 weak [file "src/SponsorLink/Directory.Build.targets"] url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/Directory.Build.targets @@ -157,8 +157,8 @@ weak [file "src/SponsorLink/Library/Library.csproj"] url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/Library/Library.csproj - sha = a0ae7272f31c766ebb129ea38c11c01df93b6b5d - etag = 3720f8ae0605aa64df8f6c1d9769969162175b79c93a21024653f210a42348e6 + sha = 93df7c7ec34f83ae58efbf213624d5ea31fe3c41 + etag = 56233a536fb38edd75f66f6a9a9e6044eb227a0b58fb791495ff88e43649feb7 weak [file "src/SponsorLink/Library/MyClass.cs"] url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/Library/MyClass.cs @@ -172,8 +172,8 @@ weak [file "src/SponsorLink/SponsorLink.targets"] url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/SponsorLink.targets - sha = 7cda4a18313b0b38b26c0152e1007cdbb9b6ba3a - etag = d725bd9cfa33f35224e91748f64237e4dc66270f7e5ec7c835b78164531ae3db + sha = 759365751e6529049a3df5701f85aecb51189289 + etag = 6e3955b7233c5c2000b9adf1bb281e74e7fb08813e17b3ef10fd8b5d50f9fb4d weak [file "src/SponsorLink/SponsorLink/AppDomainDictionary.cs"] url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/SponsorLink/AppDomainDictionary.cs @@ -182,8 +182,8 @@ weak [file "src/SponsorLink/SponsorLink/DiagnosticsManager.cs"] url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/SponsorLink/DiagnosticsManager.cs - sha = b2a11faac6c1c300bce8c1d45f95b585c19f2953 - etag = 9f289f45169f35916fff1857840d4118ed134215639d6dae9016dc62004291a5 + sha = cf154d5d9c2ac3dad56e95da04effdad64409471 + etag = 7ac9738f71cafd15dbb347bc9d83468b0691d0b0888cc82e35c161fd1f2d48eb weak [file "src/SponsorLink/SponsorLink/ManifestStatus.cs"] url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/SponsorLink/ManifestStatus.cs @@ -192,28 +192,18 @@ weak [file "src/SponsorLink/SponsorLink/SponsorLink.cs"] url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/SponsorLink/SponsorLink.cs - sha = 4fca946c3201d90d30e2183f699c850dcc1bf8d5 - etag = 96e1b1b28bfb2372bd5ffcc6bdef65ee926822b3489ce65be4e5a400884dce21 + sha = 55124bc610b2dcad9efb343bdffc79c959170593 + etag = 28178198489bf9b72f8a400563950194a06f7ce55ff4a016535eb1be35fa70b8 weak [file "src/SponsorLink/SponsorLink/SponsorLink.csproj"] url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/SponsorLink/SponsorLink.csproj - sha = a0ae7272f31c766ebb129ea38c11c01df93b6b5d - etag = ffaea0b580d8dccd672e749a5efd11fda318c484ca4a34428ff81524ec80ec4b - weak -[file "src/SponsorLink/SponsorLink/SponsorLink.es.resx"] - url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/SponsorLink/SponsorLink.es.resx - sha = a0ae7272f31c766ebb129ea38c11c01df93b6b5d - etag = ded7de7a2624b335beb462763e3580413da21e80c8b40b4c773ca46c7af4e859 - weak -[file "src/SponsorLink/SponsorLink/SponsorLink.resx"] - url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/SponsorLink/SponsorLink.resx - sha = a0ae7272f31c766ebb129ea38c11c01df93b6b5d - etag = 7d9e89ef2cf762a6119c9c6c2ed2517b71a546838151c005400301fde8def266 + sha = c879f25bf483086725c8a29f104555644e6ee542 + etag = 997b08082f85a491be7a68805d7811e65e1474a6e7d49cbe927617f7035d21e1 weak [file "src/SponsorLink/SponsorLink/SponsorLinkAnalyzer.cs"] url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/SponsorLink/SponsorLinkAnalyzer.cs - sha = b2a11faac6c1c300bce8c1d45f95b585c19f2953 - etag = fc96f7f5642cbf69b35b7e8de1756822580315f0cee61e47da3b2b1b03f68e1a + sha = 23f83bd6b1f0fe13ac02bf464377f576652fec97 + etag = 5f9823d1bf83f7d28e5809e0a08d942fb2c444f4653ca5b035d500ebef2ead15 weak [file "src/SponsorLink/SponsorLink/SponsorStatus.cs"] url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/SponsorLink/SponsorStatus.cs @@ -225,11 +215,6 @@ sha = a0ae7272f31c766ebb129ea38c11c01df93b6b5d etag = 2f923a97081481a6a264d63c8ff70ce5ba65c3dbaf7ea078cbe1388fb0868e1c weak -[file "src/SponsorLink/SponsorLink/ThisAssembly.cs"] - url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/SponsorLink/ThisAssembly.cs - sha = b2a11faac6c1c300bce8c1d45f95b585c19f2953 - etag = 978269025f58e2bae872af25fdfd94659e234e8365e3014c18b1b20fdcd155bf - weak [file "src/SponsorLink/SponsorLink/Tracing.cs"] url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/SponsorLink/Tracing.cs sha = a0ae7272f31c766ebb129ea38c11c01df93b6b5d @@ -237,13 +222,8 @@ weak [file "src/SponsorLink/SponsorLink/buildTransitive/Devlooped.Sponsors.targets"] url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/SponsorLink/buildTransitive/Devlooped.Sponsors.targets - sha = a0ae7272f31c766ebb129ea38c11c01df93b6b5d - etag = 72ec691a085dc34f946627f7038a82569e44f0b63a9f4a7bd60f0f7b52fd198f - weak -[file "src/SponsorLink/SponsorLink/devlooped.pub.jwk"] - url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/SponsorLink/devlooped.pub.jwk - sha = a0ae7272f31c766ebb129ea38c11c01df93b6b5d - etag = cf884781ff88b4d096841e3169282762a898b2050c9b5dac0013bc15bdbee267 + sha = 55124bc610b2dcad9efb343bdffc79c959170593 + etag = 46842d44ece3d55285bc30a6b22ac21c1c35d3b0c451aa5285d4ca4564b8698c weak [file "src/SponsorLink/SponsorLink/sponsorable.md"] url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/SponsorLink/sponsorable.md @@ -277,8 +257,8 @@ weak [file "src/SponsorLink/Tests/Sample.cs"] url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/Tests/Sample.cs - sha = e732f6a2c44a2f7940a1868a92cd66523f74ed24 - etag = db968d1d665b77a17e13bc7ca3d43ea65ed05cbebc18669f1b607ebe0e38a59a + sha = c879f25bf483086725c8a29f104555644e6ee542 + etag = c4ed1e041d1ec816710757790aaa6688e3756870cfd98ba7e6c7b5103ce3a9ba weak [file "src/SponsorLink/Tests/SponsorLinkTests.cs"] url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/Tests/SponsorLinkTests.cs @@ -292,11 +272,46 @@ weak [file "src/SponsorLink/Tests/Tests.csproj"] url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/Tests/Tests.csproj - sha = a0ae7272f31c766ebb129ea38c11c01df93b6b5d - etag = 237409e155202ec1b845593195d30057a949b2b18ae46a575e4cf480e4e2c8fe + sha = c879f25bf483086725c8a29f104555644e6ee542 + etag = 31d33feb5860cd6df71ee2d6f3ca6d8fdc9e6535bea8caa97300421c0502246e weak [file "src/SponsorLink/readme.md"] url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/readme.md sha = 827a1d18bf0245978d81bcd3d52e9e6f1584d1ef etag = 079b4aedba2aa9851e609b569f25c55db8d5922e3dbb1adc22611ce4d6cfe465 weak +[file "src/SponsorLink/Library/readme.md"] + url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/Library/readme.md + sha = 55124bc610b2dcad9efb343bdffc79c959170593 + etag = 5002ac8c5bbeee60c13937a32c1b6c1a5dbf0065617c8f2550e6eca6fded256d + weak +[file "src/SponsorLink/SponsorLink.Tests.targets"] + url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/SponsorLink.Tests.targets + sha = 81ba912310dd4b723c7a0103a76cb71b183983b1 + etag = cf6deba5b5cdadb5b2ea6b8533331da49afd3c841db2932a45618627ffc4ff9a + weak +[file "src/SponsorLink/SponsorLink/Resources.es.resx"] + url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/SponsorLink/Resources.es.resx + sha = c879f25bf483086725c8a29f104555644e6ee542 + etag = c0a05bb5efedf8e30a73ab96678579ad33832e4a4aec75d3b596b47f248c23f5 + weak +[file "src/SponsorLink/SponsorLink/Resources.resx"] + url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/SponsorLink/Resources.resx + sha = c879f25bf483086725c8a29f104555644e6ee542 + etag = fcb46a86511cb7996e8dcd1f4e283cea9cd51610b094ac49a7396301730814b0 + weak +[file "src/SponsorLink/Tests/Resources.Designer.cs"] + url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/Tests/Resources.Designer.cs + sha = c879f25bf483086725c8a29f104555644e6ee542 + etag = 69404ac09238930893fdbc225ae7839b14957e129b4c05f1ef0e7afcc4c91d63 + weak +[file "src/SponsorLink/Tests/Resources.resx"] + url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/Tests/Resources.resx + sha = c879f25bf483086725c8a29f104555644e6ee542 + etag = 13d1bb8b0de32a8c9b5dbdc806a036ed89d423cd7c0be187b8c56055c9bf7783 + weak +[file "src/SponsorLink/jwk.ps1"] + url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/jwk.ps1 + sha = c4830fc3b1aa78ec98d1d2ea4fed86ef0b7b803c + etag = f399e05ecb56adaf41d2545171f299a319142b17dd09fc38e452ca8c5d13bd0d + weak diff --git a/src/Directory.Build.props b/src/Directory.Build.props index 50fc169..1648dcd 100644 --- a/src/Directory.Build.props +++ b/src/Directory.Build.props @@ -118,6 +118,8 @@ <_VersionLabel>$(VersionLabel.Replace('refs/heads/', '')) + <_VersionLabel>$(_VersionLabel.Replace('refs/tags/v', '')) + <_VersionLabel Condition="$(_VersionLabel.Contains('refs/pull/'))">$(VersionLabel.TrimEnd('.0123456789')) @@ -128,7 +130,9 @@ <_VersionLabel>$(_VersionLabel.Replace('/', '-')) - $(_VersionLabel) + $(_VersionLabel) + + $(_VersionLabel) diff --git a/src/SponsorLink/Analyzer/Analyzer.csproj b/src/SponsorLink/Analyzer/Analyzer.csproj index 963c77b..f65390a 100644 --- a/src/SponsorLink/Analyzer/Analyzer.csproj +++ b/src/SponsorLink/Analyzer/Analyzer.csproj @@ -1,6 +1,7 @@  + SponsorableLib.Analyzers netstandard2.0 true analyzers/dotnet/roslyn4.0 @@ -29,4 +30,8 @@ + + + + \ No newline at end of file diff --git a/src/SponsorLink/Analyzer/StatusReportingAnalyzer.cs b/src/SponsorLink/Analyzer/StatusReportingAnalyzer.cs index e21acb7..ad82ed3 100644 --- a/src/SponsorLink/Analyzer/StatusReportingAnalyzer.cs +++ b/src/SponsorLink/Analyzer/StatusReportingAnalyzer.cs @@ -3,7 +3,6 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; using static Devlooped.Sponsors.SponsorLink; -using static ThisAssembly.Constants; namespace Analyzer; diff --git a/src/SponsorLink/Directory.Build.props b/src/SponsorLink/Directory.Build.props index c0a3e42..8afa061 100644 --- a/src/SponsorLink/Directory.Build.props +++ b/src/SponsorLink/Directory.Build.props @@ -15,7 +15,11 @@ - 42.42.$([System.Math]::Floor($([MSBuild]::Divide($([System.DateTime]::Now.TimeOfDay.TotalSeconds), 10)))) + $([System.DateTime]::Parse("2024-03-15")) + $([System.DateTime]::UtcNow.Subtract($(Epoc)).TotalDays) + $([System.Math]::Truncate($(TotalDays))) + $([System.Math]::Floor($([MSBuild]::Divide($([System.DateTime]::UtcNow.TimeOfDay.TotalSeconds), 10)))) + 42.$(Days).$(Seconds) SponsorableLib diff --git a/src/SponsorLink/Library/Library.csproj b/src/SponsorLink/Library/Library.csproj index f351273..f363648 100644 --- a/src/SponsorLink/Library/Library.csproj +++ b/src/SponsorLink/Library/Library.csproj @@ -1,11 +1,13 @@  + SponsorableLib netstandard2.0 true SponsorableLib Sample library incorporating SponsorLink checks true + true @@ -16,16 +18,4 @@ - - - - MSBuild:Compile - $(IntermediateOutputPath)\$([MSBuild]::ValueOrDefault('%(RelativeDir)', '').Replace('\', '.').Replace('/', '.'))%(Filename).g$(DefaultLanguageSourceExtension) - $(Language) - $(RootNamespace) - $(RootNamespace).$([MSBuild]::ValueOrDefault('%(RelativeDir)', '').Replace('\', '.').Replace('/', '.').TrimEnd('.')) - %(Filename) - - - diff --git a/src/SponsorLink/Library/readme.md b/src/SponsorLink/Library/readme.md new file mode 100644 index 0000000..ba4ce37 --- /dev/null +++ b/src/SponsorLink/Library/readme.md @@ -0,0 +1,5 @@ +# Sponsorable Library + +Example of a library that is available for sponsorship and leverages +[SponsorLink](https://github.com/devlooped/SponsorLink) to remind users +in an IDE (VS/Rider). diff --git a/src/SponsorLink/SponsorLink.Tests.targets b/src/SponsorLink/SponsorLink.Tests.targets new file mode 100644 index 0000000..ffc7586 --- /dev/null +++ b/src/SponsorLink/SponsorLink.Tests.targets @@ -0,0 +1,38 @@ + + + + + true + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/SponsorLink/SponsorLink.targets b/src/SponsorLink/SponsorLink.targets index de93845..6de86fb 100644 --- a/src/SponsorLink/SponsorLink.targets +++ b/src/SponsorLink/SponsorLink.targets @@ -7,11 +7,10 @@ true true - - true - - - $([System.IO.File]::ReadAllText('$(MSBuildThisFileDirectory)SponsorLink/devlooped.pub.jwk')) + + true + + CoreResGen;$(CoreCompileDependsOn) $(Product) @@ -21,13 +20,6 @@ 21 - - - - - - - + ManifestResourceName="Devlooped.Sponsors.%(Filename)"/> + @@ -85,6 +82,27 @@ + + + namespace Devlooped.Sponsors%3B + +partial class SponsorLink +{ + public partial class Funding + { + public const string Product = "$(FundingProduct)"%3B + public const string Prefix = "$(FundingPrefix)"%3B + public const int Grace = $(FundingGrace)%3B + } +} + + + + + + + + $(ILRepackArgs) "/lib:$(NetstandardDirectory)" --> - + @@ -138,4 +156,31 @@ + + + + + + + + + + + + + $([System.IO.File]::ReadAllText('$(MSBuildProjectDirectory)\$(BaseIntermediateOutputPath)devlooped.jwk')) + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/SponsorLink/SponsorLink/DiagnosticsManager.cs b/src/SponsorLink/SponsorLink/DiagnosticsManager.cs index 49143d9..c22ecc8 100644 --- a/src/SponsorLink/SponsorLink/DiagnosticsManager.cs +++ b/src/SponsorLink/SponsorLink/DiagnosticsManager.cs @@ -2,6 +2,7 @@ #nullable enable using System; using System.Collections.Concurrent; +using System.Globalization; using Humanizer; using Microsoft.CodeAnalysis; @@ -17,9 +18,7 @@ class DiagnosticsManager /// Acceses the diagnostics dictionary for the current . /// ConcurrentDictionary Diagnostics - { - get => AppDomainDictionary.Get>(nameof(Diagnostics)); - } + => AppDomainDictionary.Get>(nameof(Diagnostics)); /// /// Creates a descriptor from well-known diagnostic kinds. @@ -92,23 +91,23 @@ public Diagnostic Push(string product, Diagnostic diagnostic) static DiagnosticDescriptor CreateSponsor(string[] sponsorable, string prefix) => new( $"{prefix}100", - ThisAssembly.Strings.Sponsor.Title, - ThisAssembly.Strings.Sponsor.MessageFormat, + Resources.Sponsor_Title, + Resources.Sponsor_Message, "SponsorLink", DiagnosticSeverity.Info, isEnabledByDefault: true, - description: ThisAssembly.Strings.Sponsor.Description, + description: Resources.Sponsor_Description, helpLinkUri: "https://github.com/devlooped#sponsorlink", "DoesNotSupportF1Help"); static DiagnosticDescriptor CreateUnknown(string[] sponsorable, string product, string prefix) => new( $"{prefix}101", - ThisAssembly.Strings.Unknown.Title, - ThisAssembly.Strings.Unknown.MessageFormat, + Resources.Unknown_Title, + Resources.Unknown_Message, "SponsorLink", DiagnosticSeverity.Warning, isEnabledByDefault: true, - description: ThisAssembly.Strings.Unknown.Description( + description: string.Format(CultureInfo.CurrentCulture, Resources.Unknown_Description, sponsorable.Humanize(x => $"https://github.com/sponsors/{x}"), string.Join(" ", sponsorable)), helpLinkUri: "https://github.com/devlooped#sponsorlink", @@ -116,23 +115,23 @@ public Diagnostic Push(string product, Diagnostic diagnostic) static DiagnosticDescriptor CreateExpiring(string[] sponsorable, string prefix) => new( $"{prefix}103", - ThisAssembly.Strings.Expiring.Title, - ThisAssembly.Strings.Expiring.MessageFormat, + Resources.Expiring_Title, + Resources.Expiring_Message, "SponsorLink", DiagnosticSeverity.Warning, isEnabledByDefault: true, - description: ThisAssembly.Strings.Expiring.Description(string.Join(" ", sponsorable)), + description: string.Format(CultureInfo.CurrentCulture, Resources.Expiring_Description, string.Join(" ", sponsorable)), helpLinkUri: "https://github.com/devlooped#autosync", "DoesNotSupportF1Help", WellKnownDiagnosticTags.NotConfigurable); static DiagnosticDescriptor CreateExpired(string[] sponsorable, string prefix) => new( $"{prefix}104", - ThisAssembly.Strings.Expired.Title, - ThisAssembly.Strings.Expired.MessageFormat, + Resources.Expired_Title, + Resources.Expired_Message, "SponsorLink", DiagnosticSeverity.Warning, isEnabledByDefault: true, - description: ThisAssembly.Strings.Expired.Description(string.Join(" ", sponsorable)), + description: string.Format(CultureInfo.CurrentCulture, Resources.Expired_Description, string.Join(" ", sponsorable)), helpLinkUri: "https://github.com/devlooped#autosync", "DoesNotSupportF1Help", WellKnownDiagnosticTags.NotConfigurable); } diff --git a/src/SponsorLink/SponsorLink/SponsorLink.es.resx b/src/SponsorLink/SponsorLink/Resources.es.resx similarity index 92% rename from src/SponsorLink/SponsorLink/SponsorLink.es.resx rename to src/SponsorLink/SponsorLink/Resources.es.resx index d8794ca..ec1b5c1 100644 --- a/src/SponsorLink/SponsorLink/SponsorLink.es.resx +++ b/src/SponsorLink/SponsorLink/Resources.es.resx @@ -119,16 +119,16 @@ Patrocinar los proyectos en que dependes asegura que se mantengan activos, y que recibas el apoyo que necesitas. También es muy económico y está disponible en todo el mundo! -Por favor considera apoyar el proyecto patrocinando en {links} y ejecutando posteriormente 'gh sponsors sync {spaced}'. +Por favor considera apoyar el proyecto patrocinando en {0} y ejecutando posteriormente 'sponsor sync {1}'. - No se pudo determinar el estado de su patrocinio. Funcionalidades exclusivas para patrocinadores pueden no estar disponibles. + Por favor considere apoyar {0} patrocinando @{1} 🙏 Estado de patrocinio desconocido - Funcionalidades exclusivas para patrocinadores pueden no estar disponibles. Ejecuta 'gh sponsors sync {spaced}' y, opcionalmente, habilita la sincronización automática. + Funcionalidades exclusivas para patrocinadores pueden no estar disponibles. Ejecuta 'sponsor sync {0}' y, opcionalmente, habilita la sincronización automática. El estado de patrocino ha expirado y la sincronización automática no está habilitada. @@ -140,13 +140,13 @@ Por favor considera apoyar el proyecto patrocinando en {links} y ejecutando post Eres un verdadero héroe. Tu patrocinio ayuda a mantener el proyecto vivo y próspero 🙏. - Gracias por apoyar a {0} con tu patrocinio de {1} 💟! + Gracias por apoyar a {0} con tu patrocinio 💟! Eres un patrocinador del proyecto, eres lo máximo 💟! - El estado de patrocino ha expirado y estás en un período de gracia. Ejecuta 'gh sponsors sync {spaced}' y, opcionalmente, habilita la sincronización automática. + El estado de patrocino ha expirado y estás en un período de gracia. Ejecuta 'sponsor sync {0}' y, opcionalmente, habilita la sincronización automática. El estado de patrocino necesita actualización periódica y la sincronización automática no está habilitada. diff --git a/src/SponsorLink/SponsorLink/SponsorLink.resx b/src/SponsorLink/SponsorLink/Resources.resx similarity index 94% rename from src/SponsorLink/SponsorLink/SponsorLink.resx rename to src/SponsorLink/SponsorLink/Resources.resx index b8cdd5e..e12a0e5 100644 --- a/src/SponsorLink/SponsorLink/SponsorLink.resx +++ b/src/SponsorLink/SponsorLink/Resources.resx @@ -119,17 +119,17 @@ Sponsoring projects you depend on ensures they remain active, and that you get the support you need. It's also super affordable and available worldwide! -Please consider supporting the project by sponsoring at {links} and running 'gh sponsors sync {spaced}' afterwards. +Please consider supporting the project by sponsoring at {0} and running 'sponsor sync {1}' afterwards. Unknown sponsor description - Please consider supporting {0} by sponsoring {1} 🙏 + Please consider supporting {0} by sponsoring @{1} 🙏 Unknown sponsor status - Sponsor-only features may be disabled. Please run 'gh sponsors sync {spaced}' and optionally enable automatic sync. + Sponsor-only features may be disabled. Please run 'sponsor sync {0}' and optionally enable automatic sync. Sponsor status has expired and automatic sync has not been enabled. @@ -147,7 +147,7 @@ Please consider supporting the project by sponsoring at {links} and running 'gh You are a sponsor of the project, you rock 💟! - Sponsor status has expired and you are in the grace period. Please run 'gh sponsors sync {spaced}' and optionally enable automatic sync. + Sponsor status has expired and you are in the grace period. Please run 'sponsor sync {0}' and optionally enable automatic sync. Sponsor status needs periodic updating and automatic sync has not been enabled. diff --git a/src/SponsorLink/SponsorLink/SponsorLink.cs b/src/SponsorLink/SponsorLink/SponsorLink.cs index a5e5beb..f3d8328 100644 --- a/src/SponsorLink/SponsorLink/SponsorLink.cs +++ b/src/SponsorLink/SponsorLink/SponsorLink.cs @@ -82,7 +82,7 @@ public static bool TryRead([NotNullWhen(true)] out ClaimsPrincipal? principal, I foreach (var value in values) { - if (string.IsNullOrWhiteSpace(value.jwk) || string.IsNullOrEmpty(value.jwk)) + if (string.IsNullOrWhiteSpace(value.jwt) || string.IsNullOrEmpty(value.jwk)) continue; if (Validate(value.jwt, value.jwk, out var token, out var claims, false) == ManifestStatus.Valid && claims != null) diff --git a/src/SponsorLink/SponsorLink/SponsorLink.csproj b/src/SponsorLink/SponsorLink/SponsorLink.csproj index 4b00feb..824353d 100644 --- a/src/SponsorLink/SponsorLink/SponsorLink.csproj +++ b/src/SponsorLink/SponsorLink/SponsorLink.csproj @@ -5,10 +5,10 @@ SponsorLink disable false + CoreResGen;$(CoreCompileDependsOn) - $([System.IO.File]::ReadAllText('$(MSBuildThisFileDirectory)devlooped.pub.jwk')) $(Product) @@ -25,22 +25,55 @@ - - - - - - + + - - - - + + + + namespace Devlooped.Sponsors%3B + +partial class SponsorLink +{ + public partial class Funding + { + public const string Product = "$(FundingProduct)"%3B + public const string Prefix = "$(FundingPrefix)"%3B + public const int Grace = $(FundingGrace)%3B + } +} + + + + + + + + + + + + + + + + + + + + + $([System.IO.File]::ReadAllText('$(MSBuildProjectDirectory)\$(BaseIntermediateOutputPath)devlooped.jwk')) + + + + + + diff --git a/src/SponsorLink/SponsorLink/SponsorLinkAnalyzer.cs b/src/SponsorLink/SponsorLink/SponsorLinkAnalyzer.cs index 2e97528..2bf1783 100644 --- a/src/SponsorLink/SponsorLink/SponsorLinkAnalyzer.cs +++ b/src/SponsorLink/SponsorLink/SponsorLinkAnalyzer.cs @@ -7,10 +7,10 @@ using System.IO; using System.Linq; using Humanizer; +using Humanizer.Localisation; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; using static Devlooped.Sponsors.SponsorLink; -using static ThisAssembly.Constants; namespace Devlooped.Sponsors; @@ -20,7 +20,6 @@ namespace Devlooped.Sponsors; [DiagnosticAnalyzer(LanguageNames.CSharp, LanguageNames.VisualBasic)] public class SponsorLinkAnalyzer : DiagnosticAnalyzer { - static readonly int graceDays = int.Parse(Funding.Grace); static readonly Dictionary descriptors = new() { // Requires: @@ -65,19 +64,13 @@ public override void Initialize(AnalysisContext context) // NOTE: even if we don't report the diagnostic, we still set the status so other analyzers can use it. ctx.RegisterCompilationEndAction(ctx => { + // NOTE: for multiple projects with the same product name, we only report one diagnostic, + // so it's expected to NOT get a diagnostic back. Also, we don't want to report + // multiple diagnostics for each project in a solution that uses the same product. if (Diagnostics.Pop(Funding.Product) is Diagnostic diagnostic) { ctx.ReportDiagnostic(diagnostic); } - else - { - // This should never happen and would be a bug. - Debug.Assert(true, "We should have provided a diagnostic of some kind for " + Funding.Product); - // We'll report it as unknown as a fallback for now. - ctx.ReportDiagnostic(Diagnostic.Create(descriptors[SponsorStatus.Unknown], null, - properties: ImmutableDictionary.Create().Add(nameof(SponsorStatus), nameof(SponsorStatus.Unknown)), - Funding.Product, Sponsorables.Keys.Humanize(ThisAssembly.Strings.Or))); - } }); } }); @@ -93,13 +86,13 @@ SponsorStatus SetStatus(ImmutableArray manifests) // report unknown, either unparsed manifest or one with no expiration (which we never emit). Diagnostics.Push(Funding.Product, Diagnostic.Create(descriptors[SponsorStatus.Unknown], null, properties: ImmutableDictionary.Create().Add(nameof(SponsorStatus), nameof(SponsorStatus.Unknown)), - Funding.Product, Sponsorables.Keys.Humanize(ThisAssembly.Strings.Or))); + Funding.Product, Sponsorables.Keys.Humanize(Resources.Or))); return SponsorStatus.Unknown; } else if (exp < DateTime.Now) { // report expired or expiring soon if still within the configured days of grace period - if (exp.AddDays(graceDays) < DateTime.Now) + if (exp.AddDays(Funding.Grace) < DateTime.Now) { // report expiring soon Diagnostics.Push(Funding.Product, Diagnostic.Create(descriptors[SponsorStatus.Expiring], null, diff --git a/src/SponsorLink/SponsorLink/ThisAssembly.cs b/src/SponsorLink/SponsorLink/ThisAssembly.cs deleted file mode 100644 index 89f2316..0000000 --- a/src/SponsorLink/SponsorLink/ThisAssembly.cs +++ /dev/null @@ -1,31 +0,0 @@ -// -partial class ThisAssembly -{ - partial class Strings - { - partial class Unknown - { - public static string MessageFormat => GetResourceManager("Devlooped.SponsorLink").GetString("Unknown_Message"); - } - - partial class Expiring - { - public static string MessageFormat => GetResourceManager("Devlooped.SponsorLink").GetString("Expiring_Message"); - } - - partial class Expired - { - public static string MessageFormat => GetResourceManager("Devlooped.SponsorLink").GetString("Expired_Message"); - } - - partial class Grace - { - public static string MessageFormat => GetResourceManager("Devlooped.SponsorLink").GetString("Grace_Message"); - } - - partial class Sponsor - { - public static string MessageFormat => GetResourceManager("Devlooped.SponsorLink").GetString("Sponsor_Message"); - } - } -} \ No newline at end of file diff --git a/src/SponsorLink/SponsorLink/buildTransitive/Devlooped.Sponsors.targets b/src/SponsorLink/SponsorLink/buildTransitive/Devlooped.Sponsors.targets index 471f37f..de0563e 100644 --- a/src/SponsorLink/SponsorLink/buildTransitive/Devlooped.Sponsors.targets +++ b/src/SponsorLink/SponsorLink/buildTransitive/Devlooped.Sponsors.targets @@ -84,10 +84,13 @@ It's possible that some manifests will need interactive sync, and we'll render the messages in that case. Note that since running this requires autosync=true, we can safely assume the user - has already run `gh sponsors [...] -autosync` at least once to turn it on. Otherwise, + has already run `sponsorlink [...] -autosync` at least once to turn it on. Otherwise, this target won't run at all. + Note that since we don't specify -f (force), we only sync if the local manifest is expired, + so as not to slow the build unnecessarily. Analyzer checking for the manifest will still + check the validity of the manifest using the embedded key. --> - + diff --git a/src/SponsorLink/SponsorLink/devlooped.pub.jwk b/src/SponsorLink/SponsorLink/devlooped.pub.jwk deleted file mode 100644 index cdf45c2..0000000 --- a/src/SponsorLink/SponsorLink/devlooped.pub.jwk +++ /dev/null @@ -1,5 +0,0 @@ -{ - "e": "AQAB", - "kty": "RSA", - "n": "5inhv8QymaDBOihNi1eY-6-hcIB5qSONFZxbxxXAyOtxAdjFCPM-94gIZqM9CDrX3pyg1lTJfml_a_FZSU9dB1ii5mSX_mNHBFXn1_l_gi1ErdbkIF5YbW6oxWFxf3G5mwVXwnPfxHTyQdmWQ3YJR-A3EB4kaFwLqA6Ha5lb2ObGpMTQJNakD4oTAGDhqHMGhu6PupGq5ie4qZcQ7N8ANw8xH7nicTkbqEhQABHWOTmLBWq5f5F6RYGF8P7cl0IWl_w4YcIZkGm2vX2fi26F9F60cU1v13GZEVDTXpJ9kzvYeM9sYk6fWaoyY2jhE51qbv0B0u6hScZiLREtm3n7ClJbIGXhkUppFS2JlNaX3rgQ6t-4LK8gUTyLt3zDs2H8OZyCwlCpfmGmdsUMkm1xX6t2r-95U3zywynxoWZfjBCJf41leM9OMKYwNWZ6LQMyo83HWw1PBIrX4ZLClFwqBcSYsXDyT8_ZLd1cdYmPfmtllIXxZhLClwT5qbCWv73V" -} \ No newline at end of file diff --git a/src/SponsorLink/Tests/Resources.Designer.cs b/src/SponsorLink/Tests/Resources.Designer.cs new file mode 100644 index 0000000..7824a60 --- /dev/null +++ b/src/SponsorLink/Tests/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Tests { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Tests.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/src/SponsorLink/Tests/Resources.resx b/src/SponsorLink/Tests/Resources.resx new file mode 100644 index 0000000..4fdb1b6 --- /dev/null +++ b/src/SponsorLink/Tests/Resources.resx @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 1.3 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src/SponsorLink/Tests/Sample.cs b/src/SponsorLink/Tests/Sample.cs index 6249e62..897c91c 100644 --- a/src/SponsorLink/Tests/Sample.cs +++ b/src/SponsorLink/Tests/Sample.cs @@ -40,7 +40,7 @@ public void Test(string culture, SponsorStatus kind) public void RenderSponsorables() { Assert.NotEmpty(SponsorLink.Sponsorables); - + foreach (var pair in SponsorLink.Sponsorables) { output.WriteLine($"{pair.Key} = {pair.Value}"); diff --git a/src/SponsorLink/Tests/Tests.csproj b/src/SponsorLink/Tests/Tests.csproj index f753aad..0585911 100644 --- a/src/SponsorLink/Tests/Tests.csproj +++ b/src/SponsorLink/Tests/Tests.csproj @@ -23,6 +23,21 @@ + + + True + True + Resources.resx + + + + + + ResXFileCodeGenerator + Resources.Designer.cs + + + diff --git a/src/SponsorLink/jwk.ps1 b/src/SponsorLink/jwk.ps1 new file mode 100644 index 0000000..c66f56f --- /dev/null +++ b/src/SponsorLink/jwk.ps1 @@ -0,0 +1 @@ +curl https://raw.githubusercontent.com/devlooped/.github/main/sponsorlink.jwt --silent | jq -R 'split(".") | .[1] | @base64d | fromjson' | jq '.sub_jwk' \ No newline at end of file