Skip to content

Commit

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

- Introduce lazy-init of sponsoring status, simplify diagnostics devlooped/oss@5009784
- Switch to built-in item metadata for manifest analyzer files devlooped/oss@49c9a38
- Extend grace period to unknown status too devlooped/oss@9f918ec
- Make sure we report only once per product for entire solution devlooped/oss@4b7f922
- Update to newest JsonWebTokens devlooped/oss@068140b
- Improve default value for GenerateDocumentationFile devlooped/oss@b76de49
- Add SponsorLinkImported so we can skip imports devlooped/oss@c81f532
- Make sure Funding class is available to intellisense devlooped/oss@5813f21
- 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
- SponsorLink metadata will be opt-in only by analyzer projects devlooped/oss@c618ea8
- Change debug traces location to the well-known location of .sponsorlink devlooped/oss@1019e2a
- Remove unused tracing overloads devlooped/oss@08a8488
- Fix roles checking from new identity-based token handler devlooped/oss@6eecf46
- Add support and showcase determining install time devlooped/oss@717ddb1
- Replace JWT package in tests targets too devlooped/oss@ba1310c
- Fix typo in targets devlooped/oss@33a20db
  • Loading branch information
devlooped-bot committed Jul 4, 2024
1 parent 3614d9b commit b5c1217
Show file tree
Hide file tree
Showing 22 changed files with 496 additions and 281 deletions.
24 changes: 0 additions & 24 deletions .github/workflows/sponsor.yml

This file was deleted.

5 changes: 0 additions & 5 deletions .netconfig
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,6 @@
sha = 5fb172362c767bef7c36478f1a6bdc264723f8f9
etag = e5ee22e115c925fb85ec931cda3ac811fcc453c03904554fa3f573935b221d34
weak
[file ".github/workflows/sponsor.yml"]
url = https://github.com/devlooped/oss/blob/main/.github/workflows/sponsor.yml
sha = 5fb172362c767bef7c36478f1a6bdc264723f8f9
etag = 0849ee61af6daee29615f9632173b4e82da5bfa9d78ff28907e9408bd5acde4d
weak
[file ".github/workflows/test/action.yml"]
url = https://github.com/devlooped/oss/blob/main/.github/workflows/test/action.yml
sha = 9a1b07589b9bde93bc12528e9325712a32dec418
Expand Down
2 changes: 0 additions & 2 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,6 @@

<PropertyGroup Label="Build">
<Configuration Condition="'$(Configuration)' == '' and $(CI)">Release</Configuration>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<GenerateDocumentationFile Condition="$(MSBuildProjectName.Contains('Tests'))">false</GenerateDocumentationFile>
<LangVersion>Latest</LangVersion>

<!-- See https://docs.microsoft.com/en-us/dotnet/standard/assembly/reference-assemblies -->
Expand Down
7 changes: 7 additions & 0 deletions src/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
<PropertyGroup Condition="'$(CI)' == 'true' and '$(Language)' == 'C#'">
<DefineConstants>CI;$(DefineConstants)</DefineConstants>
</PropertyGroup>

<PropertyGroup Label="Build">
<!-- Tests projects don't need API docs, typically -->
<GenerateDocumentationFile Condition="$(GenerateDocumentationFile) == '' and $(IsTestProject) == 'true'">false</GenerateDocumentationFile>
<GenerateDocumentationFile Condition="$(GenerateDocumentationFile) == '' and $(MSBuildProjectName.Contains('Tests'))">false</GenerateDocumentationFile>
<GenerateDocumentationFile Condition="$(GenerateDocumentationFile) == ''">true</GenerateDocumentationFile>
</PropertyGroup>

<PropertyGroup Condition="'$(IsPackable)' == ''">
<IsPackable Condition="'$(PackAsTool)' == 'true'">true</IsPackable>
Expand Down
32 changes: 26 additions & 6 deletions src/SponsorLink/Analyzer/StatusReportingAnalyzer.cs
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");
});
}
}
20 changes: 20 additions & 0 deletions src/SponsorLink/Analyzer/StatusReportingGenerator.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
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(
context.GetSponsorManifests(),
(spc, source) =>
{
var status = Diagnostics.GetOrSetStatus(source);
spc.AddSource("StatusReporting.cs", $"// Status: {status}");
});
}
}
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 -->
<SponsorablePackageId Include="SponsorableLib" />
</ItemGroup>
</Project>
4 changes: 4 additions & 0 deletions src/SponsorLink/Library/Library.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@
<ProjectReference Include="..\Analyzer\Analyzer.csproj" ReferenceOutputAssembly="false" OutputType="Analyzer" />
</ItemGroup>

<Target Name="Version" AfterTargets="GetPackageContents" DependsOnTargets="GetPackageTargetPath">
<Message Importance="high" Text="$(MSBuildProjectName) &gt; $(PackageTargetPath)" />
</Target>

</Project>
4 changes: 2 additions & 2 deletions src/SponsorLink/SponsorLink.Tests.targets
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

<ItemGroup Condition="'$(ManagePackageVersionsCentrally)' == 'true'">
<PackageReference Include="Humanizer.Core" VersionOverride="2.14.1" PrivateAssets="all" Pack="false" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" VersionOverride="7.6.0" PrivateAssets="all" Pack="false" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="7.6.2" PrivateAssets="all" Pack="false" />
</ItemGroup>

<ItemGroup Condition="'$(ManagePackageVersionsCentrally)' != 'true'">
<PackageReference Include="Humanizer.Core" Version="2.14.1" PrivateAssets="all" Pack="false" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.6.0" PrivateAssets="all" Pack="false" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="7.6.2" PrivateAssets="all" Pack="false" />
</ItemGroup>

<Target Name="AddSponsorLinkAnalyzerDependencies" BeforeTargets="CoreCompile" DependsOnTargets="ResolveLockFileCopyLocalFiles">
Expand Down
15 changes: 10 additions & 5 deletions src/SponsorLink/SponsorLink.targets
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<FundingProduct Condition="'$(FundingProduct)' == ''">$(Product)</FundingProduct>
<!-- Default prefix is the joined upper-case letters in the product name (i.e. for ThisAssembly, TA) -->
<FundingPrefix Condition="'$(FundingPrefix)' == ''">$([System.Text.RegularExpressions.Regex]::Replace("$(FundingProduct)", "[^A-Z]", ""))</FundingPrefix>
<!-- Default grace days for an expired sponsor manifest -->
<FundingGrace Condition="'$(FundingGrace)' == ''">21</FundingGrace>
<!-- Default grace days for an expired sponsor manifest or unknown status -->
<FundingGrace Condition="'$(FundingGrace)' == ''">15</FundingGrace>
</PropertyGroup>

<ItemGroup>
Expand Down Expand Up @@ -71,18 +71,18 @@
<ItemGroup Condition="'$(ManagePackageVersionsCentrally)' == 'true'">
<PackageReference Include="Humanizer.Core" VersionOverride="2.14.1" PrivateAssets="all" Pack="false" />
<PackageReference Include="Humanizer.Core.es" VersionOverride="2.14.1" PrivateAssets="all" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" VersionOverride="7.6.0" PrivateAssets="all" Pack="false" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" VersionOverride="7.6.2" PrivateAssets="all" Pack="false" />
<PackageReference Include="ILRepack" Version="2.0.33" VersionOverride="all" PrivateAssets="all" Pack="false" />
</ItemGroup>

<ItemGroup Condition="'$(ManagePackageVersionsCentrally)' != 'true'">
<PackageReference Include="Humanizer.Core" Version="2.14.1" PrivateAssets="all" Pack="false" />
<PackageReference Include="Humanizer.Core.es" Version="2.14.1" PrivateAssets="all" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.6.0" PrivateAssets="all" Pack="false" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="7.6.2" PrivateAssets="all" Pack="false" />
<PackageReference Include="ILRepack" Version="2.0.33" PrivateAssets="all" Pack="false" />
</ItemGroup>

<Target Name="EmitFunding" BeforeTargets="GenerateMSBuildEditorConfigFileShouldRun" Inputs="$(MSBuildAllProjects)" Outputs="$(IntermediateOutputPath)SponsorLink.g.cs">
<Target Name="EmitFunding" BeforeTargets="CompileDesignTime;CoreCompile" Inputs="$(MSBuildAllProjects)" Outputs="$(IntermediateOutputPath)SponsorLink.g.cs">
<PropertyGroup>
<SponsorLinkPartial>namespace Devlooped.Sponsors%3B

Expand Down Expand Up @@ -183,4 +183,9 @@ partial class SponsorLink
</ItemGroup>
</Target>

<PropertyGroup>
<!-- Can be used in analyzer projects to detect double imports -->
<SponsorLinkImported>true</SponsorLinkImported>
</PropertyGroup>

</Project>
Loading

0 comments on commit b5c1217

Please sign in to comment.