From 2b20531595610ec9dec6cd77e525f2a80b9f236b Mon Sep 17 00:00:00 2001 From: devlooped-bot Date: Sat, 4 Jan 2025 00:10:14 +0000 Subject: [PATCH] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Bump=20files=20with=20dotn?= =?UTF-8?q?et-file=20sync?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .netconfig | 4 ++-- src/SponsorLink/SponsorLink.Analyzer.Tests.targets | 14 ++++++++++++-- src/SponsorLink/SponsorLink/SponsorLink.cs | 9 +++++++++ 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/.netconfig b/.netconfig index c5dbaa98..51e23ef3 100644 --- a/.netconfig +++ b/.netconfig @@ -212,7 +212,7 @@ [file "src/SponsorLink/SponsorLink/SponsorLink.cs"] url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/SponsorLink/SponsorLink.cs sha = efda32a6eaaeffa485fb480e31adfd2f8130bd48 - etag = 555128f4279241225b4dc8bb2ec8835894edfe9f6b9223399ee8cb3dc7adaf06 + etag = 616598e0ecb6d2ce97660aa6ac049e2a31a1c953669743b7b612b61d40c37706 weak [file "src/SponsorLink/SponsorLink/SponsorLink.csproj"] url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/SponsorLink/SponsorLink.csproj @@ -357,7 +357,7 @@ [file "src/SponsorLink/SponsorLink.Analyzer.Tests.targets"] url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/SponsorLink.Analyzer.Tests.targets sha = fb82cf346cea86140a51ae49b9bc730d72f7c7ac - etag = 9944d7fe502d162aa06f6af00c027ece18ad10b595eb37a403fc42dfbbbac93c + etag = a3e9cbcc227dd56a7bed236eaded136f1b80f9f36a4fabce8be695ee844bf881 weak [file "src/SponsorLink/SponsorLink/Resources.es-AR.resx"] url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/SponsorLink/Resources.es-AR.resx diff --git a/src/SponsorLink/SponsorLink.Analyzer.Tests.targets b/src/SponsorLink/SponsorLink.Analyzer.Tests.targets index bd387907..1ce67f6e 100644 --- a/src/SponsorLink/SponsorLink.Analyzer.Tests.targets +++ b/src/SponsorLink/SponsorLink.Analyzer.Tests.targets @@ -21,19 +21,29 @@ - - + + + + + $([MSBuild]::ValueOrDefault('%(FullPath)', '').Replace('net6.0', 'netstandard2.0').Replace('net8.0', 'netstandard2.0').Replace('netcoreapp3.1', 'netstandard2.0')) + + + + diff --git a/src/SponsorLink/SponsorLink/SponsorLink.cs b/src/SponsorLink/SponsorLink/SponsorLink.cs index eecd2185..eec50c8c 100644 --- a/src/SponsorLink/SponsorLink/SponsorLink.cs +++ b/src/SponsorLink/SponsorLink/SponsorLink.cs @@ -107,6 +107,15 @@ public static IncrementalValueProvider GetStatusOptions(this Incr => context.GetSponsorAdditionalFiles().Combine(context.AnalyzerConfigOptionsProvider) .Select((source, _) => new StatusOptions(source.Left, source.Right.GlobalOptions)); + /// + /// Gets the status options for use within a source generator, to avoid depending on + /// analyzer runs. Used in combination with . + /// + public static StatusOptions GetStatusOptions(this GeneratorExecutionContext context) + => new StatusOptions( + context.AdditionalFiles.Where(x => x.IsSponsorManifest(context.AnalyzerConfigOptions) || x.IsSponsorableAnalyzer(context.AnalyzerConfigOptions)).ToImmutableArray(), + context.AnalyzerConfigOptions.GlobalOptions); + static bool IsSponsorManifest(this AdditionalText text, AnalyzerConfigOptionsProvider provider) => provider.GetOptions(text).TryGetValue("build_metadata.SponsorManifest.ItemType", out var itemType) && itemType == "SponsorManifest" &&