-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #391 from mwasplund/masplund/trimmable
Enable Trimmable Assembly
- Loading branch information
Showing
15 changed files
with
135 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using System.Collections.Generic; | ||
using System.Text.Json; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace IdentityModel.OidcClient | ||
{ | ||
[JsonSourceGenerationOptions( | ||
WriteIndented = false, | ||
PropertyNamingPolicy = JsonKnownNamingPolicy.CamelCase, | ||
GenerationMode = JsonSourceGenerationMode.Metadata, | ||
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull)] | ||
[JsonSerializable(typeof(AuthorizeState))] | ||
[JsonSerializable(typeof(Dictionary<string, JsonElement>))] | ||
[JsonSerializable(typeof(OidcClientOptions))] | ||
internal partial class SourceGenerationContext : JsonSerializerContext | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Copyright (c) Brock Allen & Dominick Baier. All rights reserved. | ||
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information. | ||
|
||
using FluentAssertions; | ||
using System; | ||
using Xunit; | ||
using IdentityModel.OidcClient.Infrastructure; | ||
|
||
namespace IdentityModel.OidcClient.Tests | ||
{ | ||
public class LogSerializerTests | ||
{ | ||
[Fact] | ||
// This test exists to make sure that the public api for the log | ||
// serializer can serialize types that aren't part of the source | ||
// generation context. There is an internal api that does use the source | ||
// generation context types. We should always use that other serialize | ||
// method internally in order to be trimmable. The overload in this test | ||
// exists to avoid a breaking change. | ||
public void LogSerializer_should_serialize_arbitrary_types() | ||
{ | ||
// We instantiate the test class as an example of a class that is | ||
// not (and won't ever be) in the generation context. | ||
var act = () => LogSerializer.Serialize(new LogSerializerTests()); | ||
act.Should().NotThrow<Exception>(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
// See https://aka.ms/new-console-template for more information | ||
Console.WriteLine("Hello, World!"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
This project exists to facilitate analysis of trimmable warnings. | ||
|
||
See https://learn.microsoft.com/en-us/dotnet/core/deploying/trimming/prepare-libraries-for-trimming |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<PublishTrimmed>true</PublishTrimmed> | ||
<TrimmerSingleWarn>false</TrimmerSingleWarn> | ||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<TrimmerRootAssembly Include="IdentityModel.OidcClient" /> | ||
<ProjectReference Include="..\..\src\OidcClient\OidcClient.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |