Skip to content

Commit

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

- Simplify .gitattributes devlooped/oss@5f92a68

# devlooped/SponsorLink

- Add overload to simplify getting or setting status devlooped/SponsorLink@efda32a
  • Loading branch information
devlooped-bot authored and kzu committed Sep 15, 2024
1 parent 4f6c0bc commit 313e6da
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 31 deletions.
22 changes: 3 additions & 19 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,24 +1,8 @@
# sln, csproj files (and friends) are always CRLF, even on linux
*.sln text eol=crlf
*.proj text eol=crlf
*.csproj text eol=crlf
# normalize by default
* text=auto encoding=UTF-8
*.sh text eol=lf

# These are windows specific files which we may as well ensure are
# always crlf on checkout
*.bat text eol=crlf
*.cmd text eol=crlf

# Opt in known filetypes to always normalize line endings on checkin
# and always use native endings on checkout
*.c text
*.config text
*.h text
*.cs text
*.md text
*.tt text
*.txt text

# Some must always be checked out as lf so enforce that for those files
# If these are not lf then bash/cygwin on windows will not be able to
# excute the files
*.sh text eol=lf
16 changes: 8 additions & 8 deletions .netconfig
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
sha = e81ab754b366d52d92bd69b24bef1d5b1c610634
[file ".gitattributes"]
url = https://github.com/devlooped/oss/blob/main/.gitattributes
etag = 7acb32f5fa6d4ccd9c824605a7c2b8538497f0068c165567807d393dcf4d6bb7
etag = 338ba6d92c8d1774363396739c2be4257bfc58026f4b0fe92cb0ae4460e1eff7
weak
sha = 0683ee777d7d878d4bf013d7deea352685135a05
sha = 5f92a68e302bae675b394ef343114139c075993e
[file ".github/dependabot.yml"]
url = https://github.com/devlooped/oss/blob/main/.github/dependabot.yml
etag = c147ea2f3431ca0338c315c4a45b56ee233c4d30f8d6ab698d0e1980a257fd6a
Expand Down Expand Up @@ -146,8 +146,8 @@
weak
[file "src/SponsorLink/Analyzer/StatusReportingGenerator.cs"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/Analyzer/StatusReportingGenerator.cs
sha = 38a11504cc9cbd994fb7380fd580102e7514b3b5
etag = 8a457fdb6d22be34740ae474f4dfc32e55696093d315519e08dd2280c8cb3745
sha = efda32a6eaaeffa485fb480e31adfd2f8130bd48
etag = 34dd69526941ce9c6eb8fe259020333b2b55c8422d1d620eb431a8ba7125b3f9
weak
[file "src/SponsorLink/Analyzer/buildTransitive/SponsorableLib.targets"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/Analyzer/buildTransitive/SponsorableLib.targets
Expand Down Expand Up @@ -191,8 +191,8 @@
weak
[file "src/SponsorLink/SponsorLink/DiagnosticsManager.cs"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/SponsorLink/DiagnosticsManager.cs
sha = 46e9abe02e5a6abadda66ef050ddc5b9859aa2b8
etag = 72fe901dd67f30c1b78990599303ec6f409b2021a6da20edd66cc57f5d6e299c
sha = efda32a6eaaeffa485fb480e31adfd2f8130bd48
etag = 76c240a3677af6c7f474ec65f0d883a746137a122ad986f8356753e2d03372c3
weak
[file "src/SponsorLink/SponsorLink/ManifestStatus.cs"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/SponsorLink/ManifestStatus.cs
Expand All @@ -211,8 +211,8 @@
weak
[file "src/SponsorLink/SponsorLink/SponsorLink.cs"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/SponsorLink/SponsorLink.cs
sha = f6fd85da07d1b52922fb48676d9aed9f1aef782b
etag = 0904bd22c6abf4a5a4f6334ee38413eddcf2af8540901b3541f68ae0c20ce6d3
sha = efda32a6eaaeffa485fb480e31adfd2f8130bd48
etag = 555128f4279241225b4dc8bb2ec8835894edfe9f6b9223399ee8cb3dc7adaf06
weak
[file "src/SponsorLink/SponsorLink/SponsorLink.csproj"]
url = https://github.com/devlooped/SponsorLink/blob/main/samples/dotnet/SponsorLink/SponsorLink.csproj
Expand Down
7 changes: 3 additions & 4 deletions src/SponsorLink/Analyzer/StatusReportingGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ 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),
context.GetStatusOptions(),
(spc, source) =>
{
var (manifests, options) = source;
var status = Diagnostics.GetOrSetStatus(manifests, options);
var status = Diagnostics.GetOrSetStatus(source);
spc.AddSource("StatusReporting.cs",
$"""
// Status: {status}
// DesignTimeBuild: {options.IsDesignTimeBuild()}
// DesignTimeBuild: {source.GlobalOptions.IsDesignTimeBuild()}
""");
spc.ReportDiagnostic(Diagnostic.Create("SL200", "Compiler", "Don't disable me!",
DiagnosticSeverity.Warning,
Expand Down
7 changes: 7 additions & 0 deletions src/SponsorLink/SponsorLink/DiagnosticsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ ConcurrentDictionary<string, Diagnostic> Diagnostics
public SponsorStatus GetOrSetStatus(ImmutableArray<AdditionalText> manifests, AnalyzerConfigOptionsProvider options)
=> GetOrSetStatus(() => manifests, () => options.GlobalOptions);

/// <summary>
/// Gets the status of the <see cref="Funding.Product"/>, or sets it from
/// the given set of <paramref name="options"/> if not already set.
/// </summary>
public SponsorStatus GetOrSetStatus(StatusOptions options)
=> GetOrSetStatus(() => options.AdditionalFiles, () => options.GlobalOptions);

/// <summary>
/// Gets the status of the <see cref="Funding.Product"/>, or sets it from
/// the given analyzer <paramref name="options"/> if not already set.
Expand Down
14 changes: 14 additions & 0 deletions src/SponsorLink/SponsorLink/SponsorLink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ namespace Devlooped.Sponsors;

static partial class SponsorLink
{
public record StatusOptions(ImmutableArray<AdditionalText> AdditionalFiles, AnalyzerConfigOptions GlobalOptions);

/// <summary>
/// Statically cached dictionary of sponsorable accounts and their public key (in JWK format),
/// retrieved from assembly metadata attributes starting with "Funding.GitHub.".
/// </summary>
public static Dictionary<string, string> Sponsorables { get; } = typeof(SponsorLink).Assembly
.GetCustomAttributes<AssemblyMetadataAttribute>()
.Where(x => x.Key.StartsWith("Funding.GitHub."))
Expand Down Expand Up @@ -93,6 +99,14 @@ public static IncrementalValueProvider<ImmutableArray<AdditionalText>> GetSponso
.Select((source, c) => source.Left)
.Collect();

/// <summary>
/// Gets the status options for use within an incremental generator, to avoid depending on
/// analyzer runs. Used in combination with <see cref="DiagnosticsManager.GetOrSetStatus(StatusOptions)"/>.
/// </summary>
public static IncrementalValueProvider<StatusOptions> GetStatusOptions(this IncrementalGeneratorInitializationContext context)
=> context.GetSponsorAdditionalFiles().Combine(context.AnalyzerConfigOptionsProvider)
.Select((source, _) => new StatusOptions(source.Left, source.Right.GlobalOptions));

static bool IsSponsorManifest(this AdditionalText text, AnalyzerConfigOptionsProvider provider)
=> provider.GetOptions(text).TryGetValue("build_metadata.SponsorManifest.ItemType", out var itemType) &&
itemType == "SponsorManifest" &&
Expand Down

0 comments on commit 313e6da

Please sign in to comment.