-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# devlooped/oss - Add grace period support post-install, simplify analyzer/generator devlooped/oss@75d492d - Update to newest JsonWebTokens devlooped/oss@068140b - Extend grace period to unknown status too devlooped/oss@9f918ec - Add SponsorLinkImported so we can skip imports devlooped/oss@c81f532 - Make sure Funding class is available to intellisense devlooped/oss@5813f21 - Improve default value for GenerateDocumentationFile devlooped/oss@b76de49 - ILRepack requires Windows as-is devlooped/oss@7295d74 - Fix tests loading the right analyzer assemblies devlooped/oss@ae166f7 - Introduce lazy-init of sponsoring status, simplify diagnostics devlooped/oss@5009784 - Make sure we report only once per product for entire solution devlooped/oss@4b7f922 - Fix formatting/whitespace devlooped/oss@7febebc - Add common sponsors metadata to assemblies devlooped/oss@0789bf0 - Update assembly metadata format for Funding.GitHub devlooped/oss@5801de0 - Never use map name on non-win, just file path devlooped/oss@2260425 - Fix error due to writing an int rather than a byte devlooped/oss@c5f5b4e - SponsorLink metadata will be opt-in only by analyzer projects devlooped/oss@c618ea8 - Fix roles checking from new identity-based token handler devlooped/oss@6eecf46 - Fix typo in targets devlooped/oss@33a20db - Switch to built-in item metadata for manifest analyzer files devlooped/oss@49c9a38 - Replace JWT package in tests targets too devlooped/oss@ba1310c - Change debug traces location to the well-known location of .sponsorlink devlooped/oss@1019e2a - Remove unused tracing overloads devlooped/oss@08a8488
- Loading branch information
1 parent
3614d9b
commit 6565885
Showing
34 changed files
with
854 additions
and
406 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[ "ubuntu-latest", "macOS-latest", "windows-latest" ] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,45 @@ | ||
using System.Collections.Immutable; | ||
using System; | ||
using System.Collections.Immutable; | ||
using System.IO; | ||
using System.Linq; | ||
using Devlooped.Sponsors; | ||
using Humanizer; | ||
using Microsoft.CodeAnalysis; | ||
using Microsoft.CodeAnalysis.Diagnostics; | ||
using static Devlooped.Sponsors.SponsorLink; | ||
|
||
namespace Analyzer; | ||
|
||
[DiagnosticAnalyzer(LanguageNames.CSharp)] | ||
[DiagnosticAnalyzer(LanguageNames.CSharp, LanguageNames.VisualBasic)] | ||
public class StatusReportingAnalyzer : DiagnosticAnalyzer | ||
{ | ||
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray<DiagnosticDescriptor>.Empty; | ||
public override ImmutableArray<DiagnosticDescriptor> SupportedDiagnostics => ImmutableArray.Create(new DiagnosticDescriptor( | ||
"SL001", "Report Sponsoring Status", "Reports sponsoring status determined by SponsorLink", "Sponsors", | ||
DiagnosticSeverity.Warning, true)); | ||
|
||
public override void Initialize(AnalysisContext context) | ||
{ | ||
context.EnableConcurrentExecution(); | ||
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.None); | ||
|
||
context.RegisterCodeBlockAction(c => | ||
context.RegisterCompilationAction(c => | ||
{ | ||
var status = Diagnostics.GetStatus(Funding.Product); | ||
Tracing.Trace($"Status: {status}"); | ||
var installed = c.Options.AdditionalFiles.Where(x => | ||
{ | ||
var options = c.Options.AnalyzerConfigOptionsProvider.GetOptions(x); | ||
// In release builds, we'll have a single such item, since we IL-merge the analyzer. | ||
return options.TryGetValue("build_metadata.Analyzer.ItemType", out var itemType) && | ||
options.TryGetValue("build_metadata.Analyzer.NuGetPackageId", out var packageId) && | ||
itemType == "Analyzer" && | ||
packageId == "SponsorableLib"; | ||
}).Select(x => File.GetLastWriteTime(x.Path)).OrderByDescending(x => x).FirstOrDefault(); | ||
|
||
var status = Diagnostics.GetOrSetStatus(() => c.Options); | ||
|
||
if (installed != default) | ||
Tracing.Trace($"Status: {status}, Installed: {(DateTime.Now - installed).Humanize()} ago"); | ||
else | ||
Tracing.Trace($"Status: {status}, unknown install time"); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using Devlooped.Sponsors; | ||
using Microsoft.CodeAnalysis; | ||
using static Devlooped.Sponsors.SponsorLink; | ||
|
||
namespace Analyzer; | ||
|
||
[Generator] | ||
public class StatusReportingGenerator : IIncrementalGenerator | ||
{ | ||
public void Initialize(IncrementalGeneratorInitializationContext context) | ||
{ | ||
context.RegisterSourceOutput( | ||
// this is required to ensure status is registered properly independently | ||
// of analyzer runs. | ||
context.GetSponsorAdditionalFiles().Combine(context.AnalyzerConfigOptionsProvider), | ||
(spc, source) => | ||
{ | ||
var (manifests, options) = source; | ||
var status = Diagnostics.GetOrSetStatus(manifests, options); | ||
spc.AddSource("StatusReporting.cs", $"// Status: {status}"); | ||
}); | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
src/SponsorLink/Analyzer/buildTransitive/SponsorableLib.targets
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="Devlooped.Sponsors.targets"/> | ||
<ItemGroup> | ||
<!-- Brings in the analyzer file to report installation time --> | ||
<FundingPackageId Include="SponsorableLib" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.