Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions .netconfig
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@
url = https://github.com/devlooped/SponsorLink/tree/main/samples/dotnet/
[file "src/SponsorLink/Analyzer/Analyzer.csproj"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/Analyzer/Analyzer.csproj
sha = e55425333883c4470d745f8fee70bdf204c292ee
etag = 8aa140018fcfbd889c11da36c8c21b5cfb5730c07aa3317d734b118cfa60b416
sha = 697e210b68c7d6f0ececca7673d13f4309df6cd7
etag = 4cee5215a5472e4dcc40c4452d3db74c412a4413c021705c15709c1b4156937b
weak
[file "src/SponsorLink/Analyzer/Properties/launchSettings.json"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/Analyzer/Properties/launchSettings.json
Expand Down Expand Up @@ -166,8 +166,8 @@
weak
[file "src/SponsorLink/Library/Library.csproj"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/Library/Library.csproj
sha = f74ea7a8c7f81c5bceefb3ed7ef4249b1d8574a3
etag = 592707adba548606ec50ced6e424be4cbfe34f18bf01555a19b29fa61efa416a
sha = 0f551e3be564625ee4d078649c55363bf35954ba
etag = 1ba2df85e2aae342f575b9ea08c38b2117f43c131b24d38082d1d4394716f3d0
weak
[file "src/SponsorLink/Library/MyClass.cs"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/Library/MyClass.cs
Expand Down Expand Up @@ -216,8 +216,8 @@
weak
[file "src/SponsorLink/SponsorLink/SponsorLink.csproj"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/SponsorLink/SponsorLink.csproj
sha = 0d22f1ee7d7afc93e11060887de0e1773884978e
etag = dbf30ffb9baa63e45a4c821bc1433e4289b9af84855c2a306eaa116874a1c9f2
sha = 0f551e3be564625ee4d078649c55363bf35954ba
etag = 27db7c8288b721804b52a719a9218ab1198f4db5b7a7d06bce4e1770def2d4a0
weak
[file "src/SponsorLink/SponsorLink/SponsorLinkAnalyzer.cs"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/SponsorLink/SponsorLinkAnalyzer.cs
Expand All @@ -241,8 +241,8 @@
weak
[file "src/SponsorLink/SponsorLink/buildTransitive/Devlooped.Sponsors.targets"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/SponsorLink/buildTransitive/Devlooped.Sponsors.targets
sha = d7090c1dbcb20c68b99486a6dc53d86b8d9b06bb
etag = e992b97517c9bcc6c9e927832bc13fac3036fa6d4ecaad893caf320b3c582aee
sha = 697e210b68c7d6f0ececca7673d13f4309df6cd7
etag = e2cb4d1bbf4096f4b3fcfa0b20abccb33520442b656f19e01e5da928fd927da8
weak
[file "src/SponsorLink/SponsorLink/sponsorable.md"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/SponsorLink/sponsorable.md
Expand All @@ -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 = 29921560c73bb91c2a21a21800daf0b250773598
etag = 219df696a47a58d9de377166c87fbb199c84c33d3b7a0f7ae349543df050a583
sha = 697e210b68c7d6f0ececca7673d13f4309df6cd7
etag = 44ef3022d2ebe1251896542b697baa9dcef9b9805b68845ccc9d0ff0181ba9d1
weak
[file "src/SponsorLink/Tests/Attributes.cs"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/Tests/Attributes.cs
Expand Down Expand Up @@ -301,8 +301,8 @@
weak
[file "src/SponsorLink/Tests/Tests.csproj"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/Tests/Tests.csproj
sha = 0d22f1ee7d7afc93e11060887de0e1773884978e
etag = 5db4da024e4ecfb90be14feb4db952efa2109ee2ec84e715921291808d57b749
sha = 0f551e3be564625ee4d078649c55363bf35954ba
etag = 7d27c17944c61da196f11f904383b25b3f40579fbeb0cacb367bf05ec184ad7f
weak
[file "src/SponsorLink/Tests/keys/kzu.key"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/Tests/keys/kzu.key
Expand Down Expand Up @@ -346,13 +346,13 @@
weak
[file "src/SponsorLink/readme.md"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/readme.md
sha = 7407f5b3461213ae764f53ee93651a34487e458c
etag = 50937c64732bb2b97ddc67cc7b7b2d091c51390c9f5f2b5fdcfe9f1becb5d838
sha = 697e210b68c7d6f0ececca7673d13f4309df6cd7
etag = 3f3bb07d204d2539d90a28145653c4b48c1f373d7186b39d2593338cebcd3299
weak
[file "src/SponsorLink/SponsorLink.Analyzer.targets"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/SponsorLink.Analyzer.targets
sha = fb82cf346cea86140a51ae49b9bc730d72f7c7ac
etag = 284f794d03adabf10ac5e25ef87d257821a82eac112efe65d6fe23d675f9af7f
sha = 0f551e3be564625ee4d078649c55363bf35954ba
etag = 7276d81830e29f8d5f3e27ee62cadaf7aef02a0162b9a05c88e1daef9cc4875e
weak
[file "src/SponsorLink/SponsorLink.Analyzer.Tests.targets"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/SponsorLink.Analyzer.Tests.targets
Expand Down
14 changes: 8 additions & 6 deletions src/SponsorLink/Analyzer/Analyzer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NuGetizer" Version="1.2.3" />
<PackageReference Include="NuGetizer" Version="1.2.4" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.3.1" Pack="false" />
<PackageReference Include="PolySharp" Version="1.14.1" PrivateAssets="all" />
<PackageReference Include="ThisAssembly.AssemblyInfo" Version="1.4.3" PrivateAssets="all" />
<PackageReference Include="ThisAssembly.Git" Version="1.4.3" PrivateAssets="all" />
<PackageReference Include="ThisAssembly.Constants" Version="1.4.3" PrivateAssets="all" />
<PackageReference Include="ThisAssembly.Project" Version="1.4.3" PrivateAssets="all" />
<PackageReference Include="PolySharp" Version="1.15.0" PrivateAssets="all" />
<PackageReference Include="ThisAssembly.AssemblyInfo" Version="2.0.10" PrivateAssets="all" />
<PackageReference Include="ThisAssembly.Git" Version="2.0.10" PrivateAssets="all" />
<PackageReference Include="ThisAssembly.Constants" Version="2.0.10" PrivateAssets="all" />
<PackageReference Include="ThisAssembly.Project" Version="2.0.10" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand All @@ -29,6 +29,8 @@

<ItemGroup>
<InternalsVisibleTo Include="Tests" />
<!-- $(FundingPackageId) will suffice once ThisAssembly bumps to this fixed Devlooped.Sponsors.targets -->
<FundingAnalyzerPackageId Include="SponsorableLib" />
</ItemGroup>

<!-- To support tests, fake an extra sponsorable with the test key -->
Expand Down
2 changes: 1 addition & 1 deletion src/SponsorLink/Library/Library.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NuGetizer" Version="1.2.3" />
<PackageReference Include="NuGetizer" Version="1.2.4" />
</ItemGroup>

<ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions src/SponsorLink/SponsorLink.Analyzer.targets
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@
<ItemGroup Condition="'$(ManagePackageVersionsCentrally)' == 'true'">
<PackageReference Include="Humanizer.Core" VersionOverride="2.14.1" PrivateAssets="all" Pack="$(PackMergedAssemblies)" />
<PackageReference Include="Humanizer.Core.es" VersionOverride="2.14.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" VersionOverride="8.2.1" PrivateAssets="all" Pack="$(PackMergedAssemblies)" />
<PackageReference Include="ILRepack" Version="2.0.35" VersionOverride="all" PrivateAssets="all" Pack="false" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" VersionOverride="8.4.0" PrivateAssets="all" Pack="$(PackMergedAssemblies)" />
<PackageReference Include="ILRepack" Version="2.0.37" VersionOverride="all" PrivateAssets="all" Pack="false" />
</ItemGroup>

<ItemGroup Condition="'$(ManagePackageVersionsCentrally)' != 'true'">
<PackageReference Include="Humanizer.Core" Version="2.14.1" PrivateAssets="all" Pack="$(PackMergedAssemblies)" />
<PackageReference Include="Humanizer.Core.es" Version="2.14.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.2.1" PrivateAssets="all" Pack="$(PackMergedAssemblies)" />
<PackageReference Include="ILRepack" Version="2.0.35" PrivateAssets="all" Pack="false" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.4.0" PrivateAssets="all" Pack="$(PackMergedAssemblies)" />
<PackageReference Include="ILRepack" Version="2.0.37" PrivateAssets="all" Pack="false" />
</ItemGroup>

<Target Name="EmitFunding" BeforeTargets="CompileDesignTime;CoreCompile" Inputs="$(MSBuildAllProjects)" Outputs="$(IntermediateOutputPath)SponsorLink.g.cs">
Expand Down
8 changes: 4 additions & 4 deletions src/SponsorLink/SponsorLink/SponsorLink.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@
<ItemGroup>
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
<PackageReference Include="Humanizer.Core.es" Version="2.14.1" />
<PackageReference Include="ILRepack" Version="2.0.35" PrivateAssets="all" />
<PackageReference Include="NuGetizer" Version="1.2.3" />
<PackageReference Include="ILRepack" Version="2.0.37" PrivateAssets="all" />
<PackageReference Include="NuGetizer" Version="1.2.4" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.0.1" Pack="false" />
<PackageReference Include="PolySharp" Version="1.14.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.2.0" PrivateAssets="all" />
<PackageReference Include="PolySharp" Version="1.15.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.4.0" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@

<Target Name="SL_CollectSponsorableAnalyzer" Inputs="@(FundingPackageId)" Outputs="|%(FundingPackageId.Identity)|">
<PropertyGroup>
<FundingPackageId>%(FundingPackageId.Identity)</FundingPackageId>
<_FundingPackageId>%(FundingPackageId.Identity)</_FundingPackageId>
</PropertyGroup>
<ItemGroup>
<!--Used to determine installation time, for example, by looking up the analyzer assembly in additional files with:
build_metadata.Analyzer.ItemType = Analyzer
build_metadata.Analyzer.NuGetPackageId = [PackageId] -->
<AdditionalFiles Include="@(Analyzer -> WithMetadataValue('NuGetPackageId', '$(FundingPackageId)'))" />
<AdditionalFiles Include="@(Analyzer -> WithMetadataValue('NuGetPackageId', '$(_FundingPackageId)'))" />
</ItemGroup>
</Target>

Expand Down
2 changes: 1 addition & 1 deletion src/SponsorLink/Tests/AnalyzerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public async Task WhenMultipleAnalyzers_ThenReportsOnce()
.Where(x => x.Properties.TryGetValue(nameof(SponsorStatus), out var _));

Assert.NotEmpty(diagnostics);
Assert.Single(diagnostics.Where(x => x.Properties.TryGetValue(nameof(SponsorStatus), out var value)));
Assert.Single(diagnostics, x => x.Properties.TryGetValue(nameof(SponsorStatus), out var value));
}

[Fact]
Expand Down
10 changes: 5 additions & 5 deletions src/SponsorLink/Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.UserSecrets" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.1" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.2.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.4.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="ThisAssembly.Resources" Version="1.4.3" PrivateAssets="all" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />
<PackageReference Include="ThisAssembly.Resources" Version="2.0.10" PrivateAssets="all" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2" />
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
<PackageReference Include="Humanizer.Core.es" Version="2.14.1" />
<PackageReference Include="ThisAssembly.Constants" Version="1.4.3" />
<PackageReference Include="ThisAssembly.Constants" Version="2.0.10" />
</ItemGroup>

<ItemGroup>
Expand Down
15 changes: 15 additions & 0 deletions src/SponsorLink/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,19 @@ Including the analyzer and targets in a project involves two steps.
</Project>
```

3. Set the package id(s) that will be checked for funding in the analyzer, such as:

```xml
<PropertyGroup>
<FundingPackageId>SponsorableLib;SponsorableLib.Core</FundingPackageId>
</PropertyGroup>
```

The default analyzer will report a diagnostic for sponsorship status only
if the project being compiled as a direct package reference to one of the
specified package ids.

This property defaults to `$(PackageId)` if present. Otherwise, it defaults
to `$(FundingProduct)`, which in turn defaults to `$(Product)` if not provided.

As long as NuGetizer is used, the right packaging will be done automatically.