-
Notifications
You must be signed in to change notification settings - Fork 306
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify MSBuild logic in project files
- Add necessary guard to check for pack. - Remove redundant properties and values. - Remove and adjust quotes in property functions. - Use wildcards to generalize and reduce items declared.
- Loading branch information
Showing
12 changed files
with
48 additions
and
92 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
// This file contains assembly and module attributes that is shared across projects. | ||
// Include it in `Directory.Build.targets` near to all projects that need this file. | ||
|
||
using System.Runtime.CompilerServices; | ||
|
||
/* | ||
Using `[module: SkipLocalsInit]` suppresses the .init flag for local variables for the entire module. | ||
This doesn't affect the correctness of the methods in this assembly, as none of them are relying on | ||
JIT ensuring that all local memory is zeroed out to work. Doing this can provide some minor | ||
performance benefits, depending on the workload. | ||
*/ | ||
[module: SkipLocalsInit] |
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 |
---|---|---|
@@ -1,56 +1,19 @@ | ||
<Project> | ||
|
||
<Import Project="..\Directory.Build.targets" /> | ||
<Import Project="..\$(MSBuildThisFile)" /> | ||
|
||
<!-- Define NETSTANDARD2_1_OR_GREATER for .NET Standard 2.1 targets and above --> | ||
<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0' OR '$(TargetFramework)' == 'net7.0'"> | ||
<DefineConstants>NETSTANDARD2_1_OR_GREATER</DefineConstants> | ||
</PropertyGroup> | ||
|
||
<!-- Configure trimming for projects on .NET 6 and above --> | ||
<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0' OR '$(TargetFramework)' == 'net7.0'"> | ||
<EnableTrimAnalyzer>true</EnableTrimAnalyzer> | ||
<PropertyGroup Condition="'$(_NET_6_OR_GREATER)' == 'true'"> | ||
<IsTrimmable>true</IsTrimmable> | ||
<EnableTrimAnalyzer>true</EnableTrimAnalyzer> | ||
<DefineConstants>NETSTANDARD2_1_OR_GREATER</DefineConstants> | ||
</PropertyGroup> | ||
|
||
<!-- | ||
The following target has been ported from TerraFX.Interop.Windows. | ||
See: https://github.com/terrafx/terrafx.interop.windows. | ||
Using [module: SkipLocalsInit] suppresses the .init flag for local variables for the entire module. | ||
This doesn't affect the correctness of methods in this assembly, as none of them are relying on the | ||
JIT ensuring that all local memory is zeroed out to work. Doing this can provide some minor | ||
performance benefits, depending on the workload. | ||
--> | ||
<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: global::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)" /> | ||
<ItemGroup> | ||
<Compile Include="$(BuildToolsDirectory)AssemblyInfo.Shared.cs" LinkBase="Properties" Visible="False" /> | ||
</ItemGroup> | ||
|
||
<!-- Include the generated file in the list of files to compile --> | ||
<ItemGroup> | ||
<Compile Include="$(GeneratedSkipLocalsInitFile)" /> | ||
</ItemGroup> | ||
</Target> | ||
<ItemGroup> | ||
<InternalsVisibleTo Update="@(InternalsVisibleTo)" PublicKey="$(AssemblySignPublicKey)" Condition="@(InternalsVisibleTo->Count()) != 0" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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