[sln] Extract common build properties into Directory.Build.props

This commit is contained in:
Laura Hausmann 2024-07-09 21:48:15 +02:00
parent 557280fce3
commit b626ecd5f3
No known key found for this signature in database
GPG key ID: D044E84C5BE01605
6 changed files with 66 additions and 71 deletions

44
Directory.Build.props Normal file
View file

@ -0,0 +1,44 @@
<Project>
<!-- Target framework & language version -->
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<!-- Common build options -->
<PropertyGroup>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<InvariantGlobalization>true</InvariantGlobalization>
<SatelliteResourceLanguages>none</SatelliteResourceLanguages>
<UseCurrentRuntimeIdentifier>true</UseCurrentRuntimeIdentifier>
</PropertyGroup>
<!-- Version metadata -->
<PropertyGroup>
<VersionPrefix>2024.1</VersionPrefix>
<VersionSuffix>beta2</VersionSuffix>
</PropertyGroup>
<ItemGroup>
<AssemblyMetadata Include="codename" Value="phenidate"/>
<AssemblyMetadata Include="edition" Value="enterprise"/>
</ItemGroup>
<!-- Embed debug info instead of generating PDBs in release configuration -->
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugType>embedded</DebugType>
</PropertyGroup>
<!-- Don't copy blazor debug files to output directory in release configuration -->
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<BlazorWebAssemblyOmitDebugProxyOutput>true</BlazorWebAssemblyOmitDebugProxyOutput>
<PreserveCompilationContext>false</PreserveCompilationContext>
</PropertyGroup>
<!-- Enable Blazor AOT compilation when EnableAOT build flag is set -->
<PropertyGroup Condition="'$(EnableAOT)' == 'true'">
<RunAOTCompilation>true</RunAOTCompilation>
</PropertyGroup>
</Project>

View file

@ -1,29 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<InvariantGlobalization>true</InvariantGlobalization>
<SatelliteResourceLanguages>none</SatelliteResourceLanguages>
<VersionPrefix>2024.1</VersionPrefix>
<VersionSuffix>beta2</VersionSuffix>
<UseCurrentRuntimeIdentifier>true</UseCurrentRuntimeIdentifier>
<!-- ASP.NET MVC & Razor Pages don't support trimming yet (and everything else might also break) -->
<PublishTrimmed>false</PublishTrimmed>
<!-- Enables DATAS - https://www.thinktecture.com/en/net/optimize-asp-net-core-memory-with-datas -->
<GarbageCollectionAdaptationMode>1</GarbageCollectionAdaptationMode>
</PropertyGroup>
<ItemGroup>
<AssemblyMetadata Include="codename" Value="phenidate"/>
<AssemblyMetadata Include="edition" Value="enterprise"/>
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<BlazorWebAssemblyOmitDebugProxyOutput>true</BlazorWebAssemblyOmitDebugProxyOutput>
<PreserveCompilationContext>false</PreserveCompilationContext>
<DebugType>embedded</DebugType>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Iceshrimp.Frontend\Iceshrimp.Frontend.csproj"/>
<ProjectReference Include="..\Iceshrimp.Parsing\Iceshrimp.Parsing.fsproj"/>
@ -62,40 +45,45 @@
<PackageReference Include="Iceshrimp.WebPush" Version="2.0.0"/>
</ItemGroup>
<!-- We want Razor runtime compilation support, but only during development -->
<ItemGroup Condition=" '$(Configuration)' == 'Debug' ">
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="8.0.5"/>
</ItemGroup>
<!-- If the build flag EnableLibVips is set, switch the ImageProcessor to LibVips (with ImageSharp as fallback) -->
<PropertyGroup Condition=" '$(EnableLibVips)' == 'true' ">
<DefineConstants>$(DefineConstants);EnableLibVips</DefineConstants>
</PropertyGroup>
<!-- If the build flag EnableLibVips is set, reference the .NET bindings for LibVips -->
<ItemGroup Condition=" '$(EnableLibVips)' == 'true' ">
<PackageReference Include="NetVips" Version="2.4.1"/>
</ItemGroup>
<!-- If the build flags EnableLibVips and BundleNativeDeps are set, reference the LibVips native dependecy -->
<ItemGroup Condition=" '$(EnableLibVips)' == 'true' And '$(BundleNativeDeps)' == 'true' ">
<PackageReference Include="NetVips.Native" Version="8.15.2-iceshrimp"/>
</ItemGroup>
<!-- This makes sure configuration.ini & the preloaded AS contexts are added to the assembly as embedded resources -->
<ItemGroup>
<EmbeddedResource Include="configuration.ini" CopyToOutputDirectory="Always"/>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Core\Federation\ActivityStreams\Contexts\*.json">
<TargetPath>contexts\%(Filename)%(Extension)</TargetPath>
</EmbeddedResource>
<Content Update="Core\Federation\ActivityStreams\Contexts\*.json">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</Content>
<EmbeddedResource Include="Core\Federation\ActivityStreams\Contexts\*.json">
<TargetPath>contexts\%(Filename)%(Extension)</TargetPath>
</EmbeddedResource>
</ItemGroup>
<!-- This is a script used during development, and not needed in the final output -->
<ItemGroup>
<None Remove="Core\Database\prune-designer-cs-files.sh"/>
</ItemGroup>
<!-- This saves a bunch of disk space by discarding the original and gzip-compressed static assets. -->
<!-- For clients that don't support brotli, they will be transparently decompressed by the server. -->
<Target Name="KeepOnlyBrotliCompressedStaticAssets" AfterTargets="Publish">
<ItemGroup>
<CompressedFiles Include="$(PublishDir)\wwwroot\_framework\*.br"/>

View file

@ -1,30 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<PublishTrimmed>true</PublishTrimmed>
<NoDefaultLaunchSettingsFile>true</NoDefaultLaunchSettingsFile>
<SatelliteResourceLanguages>none</SatelliteResourceLanguages>
<InvariantGlobalization>false</InvariantGlobalization>
<UseCurrentRuntimeIdentifier>false</UseCurrentRuntimeIdentifier>
<BlazorWebAssemblyLoadAllGlobalizationData>true</BlazorWebAssemblyLoadAllGlobalizationData>
</PropertyGroup>
<!-- Remove me before beta3 -->
<PropertyGroup>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
</PropertyGroup>
<ItemGroup>
<None Update="Components/MfmText.razor.css" CssScope="mfm"/>
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugType>embedded</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(EnableAOT)' == 'true'">
<RunAOTCompilation>true</RunAOTCompilation>
</PropertyGroup>
<PropertyGroup>
<BlazorWebAssemblyLoadAllGlobalizationData>true</BlazorWebAssemblyLoadAllGlobalizationData>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Iceshrimp.Parsing\Iceshrimp.Parsing.fsproj"/>
<ProjectReference Include="..\Iceshrimp.Shared\Iceshrimp.Shared.csproj"/>

View file

@ -1,18 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<SatelliteResourceLanguages>none</SatelliteResourceLanguages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugType>embedded</DebugType>
</PropertyGroup>
<ItemGroup>
<Compile Include="SearchQuery.fs"/>
<Compile Include="Mfm.fs"/>
<Compile Include="*.fs"/>
</ItemGroup>
<ItemGroup>

View file

@ -1,15 +1,5 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugType>embedded</DebugType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Text.Json" Version="8.0.3"/>
</ItemGroup>

View file

@ -1,17 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugType>embedded</DebugType>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Iceshrimp.Backend\Iceshrimp.Backend.csproj"/>
</ItemGroup>