ファイル
ComputeSharp/src/Directory.Build.targets
T

112 行
5.2 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<Project>
<Import Project="..\build\Directory.Build.targets" />
<!-- Check whether any analyzers are available for packing -->
<PropertyGroup Condition="$(IsPackagedProject)">
<!-- Source generator project, if available -->
<IsSourceGeneratorAvailableForPacking>false</IsSourceGeneratorAvailableForPacking>
<IsSourceGeneratorAvailableForPacking Condition="Exists('..\$(MSBuildProjectName).SourceGenerators')">true</IsSourceGeneratorAvailableForPacking>
<!-- Code fixers project, if available -->
<IsCodeFixersAvailableForPacking>false</IsCodeFixersAvailableForPacking>
<IsCodeFixersAvailableForPacking Condition="Exists('..\$(MSBuildProjectName).CodeFixers')">true</IsCodeFixersAvailableForPacking>
</PropertyGroup>
<!-- Pack the source generator, if present -->
<ItemGroup Condition="'$(IsSourceGeneratorAvailableForPacking)' == 'true'" Label="Package">
<!-- Source generator reference (to trigger building the generator) -->
<ProjectReference Include="..\$(MSBuildProjectName).SourceGenerators\$(MSBuildProjectName).SourceGenerators.csproj"
ReferenceOutputAssembly="false" />
<!-- Pack the source generator from its output directory (source generators always use .NET Standard 2.0) -->
<None Include="..\$(MSBuildProjectName).SourceGenerators\bin\$(Configuration)\netstandard2.0\$(MSBuildProjectName).SourceGenerators.dll"
PackagePath="analyzers\dotnet\cs"
Pack="true"
Visible="false" />
</ItemGroup>
<!-- Pack the code fixers, if present -->
<ItemGroup Condition="'$(IsCodeFixersAvailableForPacking)' == 'true'" Label="Package">
<!-- Code fixers reference (to trigger building the project) -->
<ProjectReference Include="..\$(MSBuildProjectName).CodeFixers\$(MSBuildProjectName).CodeFixers.csproj"
ReferenceOutputAssembly="false" />
<!-- Pack the code fixers project from its output directory -->
<None Include="..\$(MSBuildProjectName).CodeFixers\bin\$(Configuration)\netstandard2.0\$(MSBuildProjectName).CodeFixers.dll"
PackagePath="analyzers\dotnet\cs"
Pack="true"
Visible="false" />
</ItemGroup>
<!--
Enable trimming support on .NET 8. This can't be in a target unlike the other
properties set below, because if that is the case the trimmable attribute
will be set but the analyzers will not run, so warnings will be skipped.
-->
<PropertyGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
<IsAotCompatible>true</IsAotCompatible>
</PropertyGroup>
<!-- Emit the [DisableRuntimeMarshalling] attribute for all .NET 8 projects -->
<ItemGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0'))">
<AssemblyAttribute Include="System.Runtime.CompilerServices.DisableRuntimeMarshallingAttribute" />
</ItemGroup>
<!-- Emit the [SupportedOSVersion] attribute if needed -->
<Target Name="EmitSupportedOSVersionAttributeForTargetOS"
BeforeTargets="PrepareForBuild">
<ItemGroup Condition="'$(SupportedOSVersion)' != ''">
<AssemblyAttribute Include="System.Runtime.Versioning.SupportedOSPlatformAttribute">
<_Parameter1>$(SupportedOSVersion)</_Parameter1>
</AssemblyAttribute>
</ItemGroup>
</Target>
<!-- Emit the [ComVisible(false)] attribute for WinUI targets -->
<ItemGroup Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net8.0-windows'))">
<AssemblyAttribute Include="System.Runtime.InteropServices.ComVisibleAttribute">
<_Parameter1>false</_Parameter1>
</AssemblyAttribute>
</ItemGroup>
<!--
The following target has been ported from TerraFX.Interop.Windows.
See: https://github.com/terrafx/terrafx.interop.windows.
This generates the [module: SkipLocalsInit] attribute for all projects.
-->
<PropertyGroup>
<GeneratedSkipLocalsInitFile Condition="'$(GeneratedSkipLocalsInitFile)' == ''">$(IntermediateOutputPath)$(MSBuildProjectName).SkipLocalsInit.g.cs</GeneratedSkipLocalsInitFile>
<GeneratedSkipLocalsInitFileLines>
<![CDATA[//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
[module: System.Runtime.CompilerServices.SkipLocalsInitAttribute]]]>
</GeneratedSkipLocalsInitFileLines>
</PropertyGroup>
<Target Name="GenerateSkipLocalsInit"
BeforeTargets="BeforeCompile;CoreCompile"
DependsOnTargets="PrepareForBuild"
Condition="'$(Language)' == 'C#'"
Inputs="$(MSBuildAllProjects)"
Outputs="$(GeneratedSkipLocalsInitFile)">
<!-- Write the file with the attribute -->
<WriteLinesToFile Lines="$(GeneratedSkipLocalsInitFileLines)" Overwrite="true" WriteOnlyWhenDifferent="true" File="$(GeneratedSkipLocalsInitFile)" />
<!-- Include the generated file in the list of files to compile -->
<ItemGroup>
<Compile Include="$(GeneratedSkipLocalsInitFile)" />
</ItemGroup>
</Target>
</Project>