-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Added initial Trimming support. #21
base: main
Are you sure you want to change the base?
Changes from 3 commits
4f660d7
04d479f
56f8bbb
8ea3edc
b15739b
ce7228a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Console.WriteLine("Build, rebuild or publish this app to see trimming warnings."); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
|
||
<PublishTrimmed>true</PublishTrimmed> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\OpenAI.csproj" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<TrimmerRootAssembly Include="OpenAI" /> | ||
</ItemGroup> | ||
|
||
<PropertyGroup Label="Publish"> | ||
<RuntimeIdentifier Condition="$([MSBuild]::IsOSPlatform('windows'))">win-x64</RuntimeIdentifier> | ||
<RuntimeIdentifier Condition="!$([MSBuild]::IsOSPlatform('windows'))">osx-arm64</RuntimeIdentifier> | ||
|
||
<SelfContained>true</SelfContained> | ||
</PropertyGroup> | ||
|
||
<Target Name="ProduceTrimmingWarnings" AfterTargets="Build"> | ||
<CallTarget Targets="Publish"/> | ||
</Target> | ||
|
||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
<VersionPrefix>2.0.0</VersionPrefix> | ||
<VersionSuffix>beta.2</VersionSuffix> | ||
|
||
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks> | ||
<TargetFrameworks>netstandard2.0;net6.0;net8.0</TargetFrameworks> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what's the reason for adding this explicit target? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given that attributes only appeared in net7, I'm not sure that net6 issues all the appropriate warnings for trimming, so I always try to add net8 to see actual problems. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @stephentoub, what are your thoughts on this? We have been trying to minimize the number of cross-targets, as the matrix can become supper messy after a while, but maybe adding net 8 is not too bad? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We'll want net8.0 at least by Nov when net6.0 goes out of support. Might as well add it now, and gain the additional benefits. |
||
<LangVersion>latest</LangVersion> | ||
|
||
<!-- Sign the assembly with the specified key file. --> | ||
|
@@ -46,6 +46,6 @@ | |
<ItemGroup> | ||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" /> | ||
<PackageReference Include="System.ClientModel" Version="1.1.0-beta.4" /> | ||
<PackageReference Include="System.Text.Json" Version="8.0.2" /> | ||
HavenDV marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<PackageReference Include="System.Memory.Data" Version="9.0.0-preview.4.24266.19" /> | ||
HavenDV marked this conversation as resolved.
Show resolved
Hide resolved
|
||
</ItemGroup> | ||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text.Json.Serialization; | ||
|
||
namespace OpenAI; | ||
|
||
[JsonSourceGenerationOptions] | ||
[JsonSerializable(typeof(string))] | ||
[JsonSerializable(typeof(IEnumerable<string>))] | ||
[JsonSerializable(typeof(IEnumerable<IEnumerable<int>>))] | ||
[JsonSerializable(typeof(ReadOnlyMemory<float>))] | ||
internal sealed partial class SourceGenerationContext : JsonSerializerContext; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we want the TrimmingHelper project in this repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I will delete this after the review, right now it is still needed for re-checking