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
- Dynamically fetch devlooped JWK from github devlooped/oss@55124bc
- Replace JWT package in tests targets too devlooped/oss@ba1310c
- Remove dependency on ThisAssembly devlooped/oss@c879f25
- Fix path to jwk.ps1 alongside the SponsorLink.targets devlooped/oss@c4830fc
- SponsorLink code should be checked as regular code devlooped/oss@e81ab75
- Switch to the dotnet global tool version of SL CLI devlooped/oss@cff07df
- Switch to renamed sponsorlink > sponsor devlooped/oss@d5efe5e
- Bump to renamed tool devlooped/oss@b8fd87b
- Revert back to dotnet-sponsor devlooped/oss@8d29f01
- Rename sample assemblies for nicer display devlooped/oss@93df7c7
- Switch to built-in item metadata for manifest analyzer files devlooped/oss@49c9a38
- Add support and showcase determining install time devlooped/oss@717ddb1
- Set Version from VersionLabel if it's a refs/tags/ devlooped/oss@57653a2
- Cleanup build and publish to use VersionLabel devlooped/oss@14deaea
- Make sure we report only once per product for entire solution devlooped/oss@4b7f922
- Update to newest JsonWebTokens devlooped/oss@068140b
- SponsorLink-enabled analyzers need copylocal devlooped/oss@7593657
- 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
- Update sponsor.yml to use org-access token devlooped/oss@96ca2b1
- Fix formatting/whitespace devlooped/oss@7febebc
- Minor code simplification devlooped/oss@cf154d5
- Fix roles checking from new identity-based token handler devlooped/oss@6eecf46
- Change debug traces location to the well-known location of .sponsorlink devlooped/oss@1019e2a
- Improve versioning of sample package devlooped/oss@3b943f5
- Remove unused tracing overloads devlooped/oss@08a8488
  • Loading branch information
devlooped-bot committed Jul 2, 2024
1 parent 7ed516a commit ef1f075
Show file tree
Hide file tree
Showing 32 changed files with 859 additions and 366 deletions.
3 changes: 0 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/sponsor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: ubuntu-latest
continue-on-error: true
env:
token: ${{ secrets.GH_TOKEN }}
token: ${{ secrets.DEVLOOPED_TOKEN }}
if: ${{ !endsWith(github.event.sender.login, '[bot]') && !endsWith(github.event.sender.login, 'bot') }}
steps:
- name: 🤘 checkout
Expand Down
5 changes: 0 additions & 5 deletions .netconfig
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,6 @@
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
weak
[file "src/SponsorLink/SponsorLink/sponsorable.md"]
url = https://github.com/devlooped/oss/blob/main/src/SponsorLink/SponsorLink/sponsorable.md
sha = a0ae7272f31c766ebb129ea38c11c01df93b6b5d
Expand Down
6 changes: 5 additions & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@

<PropertyGroup Label="Version" Condition="$(VersionLabel) != ''">
<_VersionLabel>$(VersionLabel.Replace('refs/heads/', ''))</_VersionLabel>
<_VersionLabel>$(_VersionLabel.Replace('refs/tags/v', ''))</_VersionLabel>

<!-- For PRs, we just need a fixed package version numbered after the PR # itself, so remove the commits # at the end -->
<_VersionLabel Condition="$(_VersionLabel.Contains('refs/pull/'))">$(VersionLabel.TrimEnd('.0123456789'))</_VersionLabel>
<!-- Next replace the prefix for simply 'pr', so we end up with 'pr99/merge' by default -->
Expand All @@ -128,7 +130,9 @@
<_VersionLabel>$(_VersionLabel.Replace('/', '-'))</_VersionLabel>

<!-- Set sanitized version to the actual version suffix used in build/pack -->
<VersionSuffix>$(_VersionLabel)</VersionSuffix>
<VersionSuffix Condition="!$(VersionLabel.Contains('refs/tags/'))">$(_VersionLabel)</VersionSuffix>
<!-- Special case for tags, the label is actually the version. Backs compat since passed-in value overrides MSBuild-set one -->
<Version Condition="$(VersionLabel.Contains('refs/tags/'))">$(_VersionLabel)</Version>
</PropertyGroup>

<ItemGroup Label="ThisAssembly.Project">
Expand Down
5 changes: 5 additions & 0 deletions src/SponsorLink/Analyzer/Analyzer.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AssemblyName>SponsorableLib.Analyzers</AssemblyName>
<TargetFramework>netstandard2.0</TargetFramework>
<IsRoslynComponent>true</IsRoslynComponent>
<PackFolder>analyzers/dotnet/roslyn4.0</PackFolder>
Expand Down Expand Up @@ -29,4 +30,8 @@
<None Update="buildTransitive\SponsorableLib.targets" Pack="true" />
</ItemGroup>

<ItemGroup>
<Compile Remove="C:\Code\devlooped.oss\src\SponsorLink\SponsorLink\ThisAssembly.cs" />
</ItemGroup>

</Project>
33 changes: 26 additions & 7 deletions src/SponsorLink/Analyzer/StatusReportingAnalyzer.cs
Original file line number Diff line number Diff line change
@@ -1,26 +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;
using static ThisAssembly.Constants;

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>
6 changes: 5 additions & 1 deletion src/SponsorLink/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@

<!-- Roslyn caches analyzers aggressively so we are better off using a very dynamic version number
for local builds where a quick devloop is key. We bump version every 10 seconds -->
<Version>42.42.$([System.Math]::Floor($([MSBuild]::Divide($([System.DateTime]::Now.TimeOfDay.TotalSeconds), 10))))</Version>
<Epoc>$([System.DateTime]::Parse("2024-03-15"))</Epoc>
<TotalDays>$([System.DateTime]::UtcNow.Subtract($(Epoc)).TotalDays)</TotalDays>
<Days>$([System.Math]::Truncate($(TotalDays)))</Days>
<Seconds>$([System.Math]::Floor($([MSBuild]::Divide($([System.DateTime]::UtcNow.TimeOfDay.TotalSeconds), 10))))</Seconds>
<Version>42.$(Days).$(Seconds)</Version>

<Product>SponsorableLib</Product>
</PropertyGroup>
Expand Down
16 changes: 5 additions & 11 deletions src/SponsorLink/Library/Library.csproj
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<AssemblyName>SponsorableLib</AssemblyName>
<TargetFramework>netstandard2.0</TargetFramework>
<PackNone>true</PackNone>
<PackageId>SponsorableLib</PackageId>
<Description>Sample library incorporating SponsorLink checks</Description>
<PackOnBuild>true</PackOnBuild>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
</PropertyGroup>

<ItemGroup>
Expand All @@ -16,16 +18,8 @@
<ProjectReference Include="..\Analyzer\Analyzer.csproj" ReferenceOutputAssembly="false" OutputType="Analyzer" />
</ItemGroup>

<ItemGroup>
<EmbeddedResource Update="Resources.resx">
<!-- Default to Just Works resources generation. See https://www.cazzulino.com/resources.html -->
<Generator>MSBuild:Compile</Generator>
<StronglyTypedFileName>$(IntermediateOutputPath)\$([MSBuild]::ValueOrDefault('%(RelativeDir)', '').Replace('\', '.').Replace('/', '.'))%(Filename).g$(DefaultLanguageSourceExtension)</StronglyTypedFileName>
<StronglyTypedLanguage>$(Language)</StronglyTypedLanguage>
<StronglyTypedNamespace Condition="'%(RelativeDir)' == ''">$(RootNamespace)</StronglyTypedNamespace>
<StronglyTypedNamespace Condition="'%(RelativeDir)' != ''">$(RootNamespace).$([MSBuild]::ValueOrDefault('%(RelativeDir)', '').Replace('\', '.').Replace('/', '.').TrimEnd('.'))</StronglyTypedNamespace>
<StronglyTypedClassName>%(Filename)</StronglyTypedClassName>
</EmbeddedResource>
</ItemGroup>
<Target Name="Version" AfterTargets="GetPackageContents" DependsOnTargets="GetPackageTargetPath">
<Message Importance="high" Text="$(MSBuildProjectName) &gt; $(PackageTargetPath)" />
</Target>

</Project>
5 changes: 5 additions & 0 deletions src/SponsorLink/Library/readme.md
Original file line number Diff line number Diff line change
@@ -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).
38 changes: 38 additions & 0 deletions src/SponsorLink/SponsorLink.Tests.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<Project>
<!-- For inclusion in test projects that reference analyzers as project references -->

<PropertyGroup>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>

<ItemGroup Condition="'$(ManagePackageVersionsCentrally)' == 'true'">
<PackageReference Include="Humanizer.Core" VersionOverride="2.14.1" 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="Microsoft.IdentityModel.JsonWebTokens" Version="7.6.2" PrivateAssets="all" Pack="false" />
</ItemGroup>

<Target Name="AddSponsorLinkAnalyzerDependencies" BeforeTargets="CoreCompile" DependsOnTargets="ResolveLockFileCopyLocalFiles">
<ItemGroup>
<!-- NOTE: keep in sync with ILRepack'ed assemblies as needed -->
<ReferenceCopyLocalAssemblies Include="@(ReferenceCopyLocalPaths)" Condition="'%(Extension)' == '.dll'
And !$([MSBuild]::ValueOrDefault('%(FileName)', '').EndsWith('.resources', StringComparison.OrdinalIgnoreCase))
And !$([MSBuild]::ValueOrDefault('%(FileName)', '').StartsWith('ThisAssembly', StringComparison.OrdinalIgnoreCase))" />
<Analyzer Include="@(ReferenceCopyLocalAssemblies)" Condition="
!$([MSBuild]::ValueOrDefault('%(FileName)', '').StartsWith('Microsoft.CodeAnalysis', StringComparison.OrdinalIgnoreCase)) And
!$([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 -->
<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))"
/>
</ItemGroup>
</Target>

</Project>
86 changes: 68 additions & 18 deletions src/SponsorLink/SponsorLink.targets
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,32 @@
<ShowSponsorLinkInProject Condition="$(ShowSponsorLinkInProject) == '' and '$(TargetFramework)' == 'netstandard2.0'">true</ShowSponsorLinkInProject>
<!-- This ensures we expose only the main assembly in the Dependencies > Analyzers node -->
<MergeAnalyzerAssemblies Condition="'$(MergeAnalyzerAssemblies)' == '' and '$(Configuration)' == 'Release'">true</MergeAnalyzerAssemblies>
<!-- If we are going to merge files, we need to copy local -->
<CopyLocalLockFileAssemblies Condition="'$(MergeAnalyzerAssemblies)' == 'true'">true</CopyLocalLockFileAssemblies>

<!-- Read public key we validate manifests against -->
<DevloopedJwk>$([System.IO.File]::ReadAllText('$(MSBuildThisFileDirectory)SponsorLink/devlooped.pub.jwk'))</DevloopedJwk>
<!-- Whether we merge files or not, dependencies will need to be copy-local -->
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<!-- Make Resources visible to intellisense -->
<CoreCompileDependsOn>CoreResGen;$(CoreCompileDependsOn)</CoreCompileDependsOn>

<!-- Default funding product the Product, which already part of ThisAssembly -->
<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>
<AssemblyMetadata Include="Funding.GitHub.devlooped" Value="$(DevloopedJwk)" />
<Constant Include="Funding.Product" Value="$(FundingProduct)" />
<Constant Include="Funding.Prefix" Value="$(FundingPrefix)" />
<Constant Include="Funding.Grace" Value="$(FundingGrace)" />
</ItemGroup>

<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)SponsorLink/*.cs"
Exclude="$(MSBuildThisFileDirectory)SponsorLink/bin/**;$(MSBuildThisFileDirectory)SponsorLink/obj/**"
Source="SponsorLink"/>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)SponsorLink/*.resx"
Exclude="$(MSBuildThisFileDirectory)SponsorLink/bin/**;$(MSBuildThisFileDirectory)SponsorLink/obj/**"
Source="SponsorLink"
ManifestResourceName="Devlooped.%(Filename)"/>
ManifestResourceName="Devlooped.Sponsors.%(Filename)"/>
<EmbeddedResource Update="$(MSBuildThisFileDirectory)SponsorLink/Resources.resx"
StronglyTypedManifestPrefix="Devlooped.Sponsors"
StronglyTypedClassName="%(Filename)"
StronglyTypedNamespace="Devlooped.Sponsors"
StronglyTypedLanguage="$(Language)" />
<None Include="$(MSBuildThisFileDirectory)SponsorLink/buildTransitive/*.*"
Source="SponsorLink"
PackagePath="buildTransitive/%(Filename)%(Extension)"/>
Expand Down Expand Up @@ -74,17 +71,38 @@
<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="CompileDesignTime;CoreCompile" Inputs="$(MSBuildAllProjects)" Outputs="$(IntermediateOutputPath)SponsorLink.g.cs">
<PropertyGroup>
<SponsorLinkPartial>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
}
}
</SponsorLinkPartial>
</PropertyGroup>
<WriteLinesToFile File="$(IntermediateOutputPath)SponsorLink.g.cs" Lines="$(SponsorLinkPartial)" WriteOnlyWhenDifferent="true" Overwrite="true" />
<ItemGroup>
<Compile Include="$(IntermediateOutputPath)SponsorLink.g.cs" />
</ItemGroup>
</Target>

<Target Name="ILRepack" AfterTargets="CoreCompile" BeforeTargets="CopyFilesToOutputDirectory"
Inputs="@(IntermediateAssembly -&gt; '%(FullPath)')"
Outputs="$(IntermediateOutputPath)ilrepack.txt"
Expand Down Expand Up @@ -123,7 +141,7 @@
<!--<ILRepackArgs>$(ILRepackArgs) "/lib:$(NetstandardDirectory)"</ILRepackArgs> -->
<!-- This is needed for ilrepack to find netstandard.dll, which is referenced by the System.Text.Json assembly -->
</PropertyGroup>
<Exec Command="&quot;$(ILRepack)&quot; $(ILRepackArgs)" WorkingDirectory="$(MSBuildProjectDirectory)\$(OutputPath)" StandardErrorImportance="high" StandardOutputImportance="low" ConsoleToMSBuild="true" ContinueOnError="true">
<Exec Command='"$(ILRepack)" $(ILRepackArgs)' WorkingDirectory="$(MSBuildProjectDirectory)\$(OutputPath)" StandardErrorImportance="high" IgnoreStandardErrorWarningFormat="true" StandardOutputImportance="low" ConsoleToMSBuild="true" ContinueOnError="true">
<Output TaskParameter="ConsoleOutput" PropertyName="ILRepackOutput" />
<Output TaskParameter="ExitCode" PropertyName="ExitCode" />
</Exec>
Expand All @@ -138,4 +156,36 @@
<Delete Files="@(MergedAssembliesToRemove -&gt; '$(MSBuildProjectDirectory)\$(OutputPath)%(Filename)%(Extension)')" Condition="Exists('$(MSBuildProjectDirectory)\$(OutputPath)%(Filename)%(Extension)')" />
</Target>

<Target Name="DownloadDevloopedJwk" BeforeTargets="GetAssemblyAttributes" Inputs="$(MSBuildProjectFullPath)" Outputs="$(MSBuildProjectDirectory)\$(BaseIntermediateOutputPath)devlooped.jwk">
<Exec Command="pwsh -nop -f $(MSBuildThisFileDirectory)jwk.ps1" ConsoleToMSBuild="true" EchoOff="true">
<Output TaskParameter="ConsoleOutput" PropertyName="RawJwk"/>
<Output TaskParameter="ExitCode" PropertyName="MSBuildLastExitCode" />
</Exec>
<Error Text="$(RawJwk)" Condition="'$(MSBuildLastExitCode)' != '0'" />
<WriteLinesToFile File="$(MSBuildProjectDirectory)\$(BaseIntermediateOutputPath)devlooped.jwk" Lines="$(RawJwk)" Overwrite="true" />
</Target>

<Target Name="ReadDevloopedJwk" DependsOnTargets="DownloadDevloopedJwk" BeforeTargets="GetAssemblyAttributes">
<PropertyGroup>
<!-- Read public key we validate manifests against -->
<DevloopedJwk>$([System.IO.File]::ReadAllText('$(MSBuildProjectDirectory)\$(BaseIntermediateOutputPath)devlooped.jwk'))</DevloopedJwk>
</PropertyGroup>
<ItemGroup>
<AssemblyMetadata Include="Funding.GitHub.devlooped" Value="$(DevloopedJwk)" />
</ItemGroup>
</Target>

<!-- Make sure dependencies are available in the package when not merging (i.e. local dev) -->
<Target Name="PackCopyLocalLockFileAssemblies" Condition="'$(MergeAnalyzerAssemblies)' != 'true'"
BeforeTargets="GetPackageContents" DependsOnTargets="ReferenceCopyLocalPathsOutputGroup">
<ItemGroup>
<PackageFile Include="@(ReferenceCopyLocalPathsOutputGroupOutput)" PackFolder="$(PackFolder)" />
</ItemGroup>
</Target>

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

</Project>
Loading

0 comments on commit ef1f075

Please sign in to comment.