Skip to content
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

Format Comments in Common props, targets and tasks #6160

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
85 changes: 40 additions & 45 deletions .editorconfig
Expand Up @@ -3,20 +3,54 @@
# top-most EditorConfig file
root = true

# Default settings:
# A newline ending every file
# Use 4 spaces as indentation
# Defaults
[*]
insert_final_newline = true
indent_style = space
charset = utf-8
indent_size = 4
indent_style = space
insert_final_newline = false
trim_trailing_whitespace = true

[project.json]
# Bash scripts
[*.sh]
indent_size = 2
end_of_line = lf

# Batch scripts
[*.{cmd,bat}]
end_of_line = crlf

# MSBuild XML Build files
[*.{props,targets,tasks,overridetasks}]
indent_size = 2

# MSBuild XML Project files
[*.{csproj,vbproj,shproj,proj,projitems}]
indent_size = 2

# VisualStudio XML Source files
[*.{xaml,xml,xsd}]
indent_size = 2

# VisualStudio XML Configuration files
[*.{ruleset,config,nuspec,resx,vsixmanifest,vsct}]
indent_size = 2

# YAML config files
[*.{yml,yaml}]
indent_size = 2

# C++ Files
[*.{cpp,h,in}]
curly_bracket_next_line = true
indent_brace_style = Allman

# C# files
[*.cs]

# License header
file_header_template = Licensed to the .NET Foundation under one or more agreements.\nThe .NET Foundation licenses this file to you under the MIT license.\n

# New line preferences
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
Expand Down Expand Up @@ -156,44 +190,5 @@ csharp_space_between_square_brackets = false
# Analyzers
dotnet_code_quality.ca1802.api_surface = private, internal
dotnet_code_quality.ca2208.api_surface = public

# License header
file_header_template = Licensed to the .NET Foundation under one or more agreements.\nThe .NET Foundation licenses this file to you under the MIT license.\n

# C++ Files
[*.{cpp,h,in}]
curly_bracket_next_line = true
indent_brace_style = Allman

# Xml project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
indent_size = 2

[*.{csproj,vbproj,proj,nativeproj,locproj}]
charset = utf-8

# Xml build files
[*.builds]
indent_size = 2

# Xml files
[*.{xml,stylecop,resx,ruleset}]
indent_size = 2

# Xml config files
[*.{props,targets,config,nuspec}]
indent_size = 2

# YAML config files
[*.{yml,yaml}]
indent_size = 2

# Shell scripts
[*.sh]
end_of_line = lf
[*.{cmd, bat}]
end_of_line = crlf

[src/**/*.{cs,vb}]
# IDE0005: Remove unnecessary usings/imports
dotnet_diagnostic.IDE0005.severity = warning
3 changes: 1 addition & 2 deletions src/Tasks/Microsoft.CSharp.CrossTargeting.targets
Expand Up @@ -9,7 +9,6 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and
Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<!-- Import design time targets for Roslyn Project System. These are only available if Visual Studio is installed. -->
Expand All @@ -22,4 +21,4 @@ Copyright (C) Microsoft Corporation. All rights reserved.

<Import Project="Microsoft.Common.CrossTargeting.targets" />

</Project>
</Project>
5 changes: 2 additions & 3 deletions src/Tasks/Microsoft.CSharp.CurrentVersion.targets
@@ -1,4 +1,4 @@
<!--
<!--
***********************************************************************************************
Microsoft.CSharp.CurrentVersion.targets

Expand All @@ -14,7 +14,6 @@ this file.
Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
Expand Down Expand Up @@ -370,4 +369,4 @@ using System.Reflection%3b
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.CSharp.targets\ImportAfter\*" Condition="'$(ImportByWildcardAfterMicrosoftCSharpTargets)' == 'true' and exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.CSharp.targets\ImportAfter')"/>
<Import Project="$(MSBuildUserExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.CSharp.targets\ImportAfter\*" Condition="'$(ImportUserLocationsByWildcardAfterMicrosoftCSharpTargets)' == 'true' and exists('$(MSBuildUserExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.CSharp.targets\ImportAfter')"/>

</Project>
</Project>
354 changes: 176 additions & 178 deletions src/Tasks/Microsoft.CSharp.targets

Large diffs are not rendered by default.

93 changes: 44 additions & 49 deletions src/Tasks/Microsoft.Common.CrossTargeting.targets
@@ -1,4 +1,4 @@
<!--
<!--
***********************************************************************************************
Microsoft.Common.CrossTargeting.targets

Expand All @@ -9,7 +9,6 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and
Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->

<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<PropertyGroup>
Expand Down Expand Up @@ -43,7 +42,7 @@ Copyright (C) Microsoft Corporation. All rights reserved.
<TargetPlatformMonikers>@(_TargetFrameworkInfo->'%(TargetPlatformMonikers)')</TargetPlatformMonikers>
<AdditionalPropertiesFromProject>$(_AdditionalPropertiesFromProject)</AdditionalPropertiesFromProject>
<HasSingleTargetFramework>false</HasSingleTargetFramework>
<!-- indicate to caller that project is RID agnostic so that a global property RuntimeIdentifier value can be removed -->
<!-- indicate to caller that project is RID agnostic so that a global property $(RuntimeIdentifiers) value can be removed -->
<IsRidAgnostic>false</IsRidAgnostic>
<IsRidAgnostic Condition=" '$(RuntimeIdentifier)' == '' and '$(RuntimeIdentifiers)' == '' ">true</IsRidAgnostic>
<!-- Extract necessary information for SetPlatform negotiation -->
Expand Down Expand Up @@ -80,18 +79,18 @@ Copyright (C) Microsoft Corporation. All rights reserved.

<!--
============================================================
DispatchToInnerBuilds
DispatchToInnerBuilds

Builds this project with /t:$(InnerTarget) /p:TargetFramework=X for each
value X in $(TargetFrameworks)
Builds this project with /t:$(InnerTarget) /p:TargetFramework=X for each
value X in $(TargetFrameworks)

[IN]
$(TargetFrameworks) - Semicolon delimited list of target frameworks.
$(InnerTargets) - The targets to build for each target framework
[IN]
$(TargetFrameworks) - Semicolon delimited list of target frameworks.
$(InnerTargets) - The targets to build for each target framework

[OUT]
@(InnerOutput) - The combined output items of the inner targets across
all target frameworks..
[OUT]
@(InnerOutput) - The combined output items of the inner targets across
all target frameworks.
============================================================
-->
<Target Name="DispatchToInnerBuilds"
Expand All @@ -108,21 +107,21 @@ Copyright (C) Microsoft Corporation. All rights reserved.

<!--
============================================================
Build
Build

Cross-targeting version of Build.
Cross-targeting version of Build.

[IN]
$(TargetFrameworks) - Semicolon delimited list of target frameworks.
[IN]
$(TargetFrameworks) - Semicolon delimited list of target frameworks.

$(InnerTargets) - The targets to build for each target framework. Defaults
to 'Build' if unset, but allows override to support
`msbuild /p:InnerTargets=X;Y;Z` which will build X, Y,
and Z targets for each target framework.
$(InnerTargets) - The targets to build for each target framework. Defaults
to 'Build' if unset, but allows override to support
`msbuild /p:InnerTargets=X;Y;Z` which will build X, Y,
and Z targets for each target framework.

[OUT]
@(InnerOutput) - The combined output items of the inner targets across
all builds.
[OUT]
@(InnerOutput) - The combined output items of the inner targets across
all builds.
============================================================
-->
<Target Name="Build" DependsOnTargets="_SetBuildInnerTarget;DispatchToInnerBuilds" />
Expand All @@ -136,19 +135,19 @@ Copyright (C) Microsoft Corporation. All rights reserved.

<!--
============================================================
Clean
Clean

Cross-targeting version of clean.
Cross-targeting version of clean.

Inner-build dispatch is a clone of DispatchToInnerBuilds;
the only reason it's replicated is that it must be a different
target to be run in the same build (e.g. by Rebuild or by
a /t:Clean;Build invocation.
Inner-build dispatch is a clone of 'DispatchToInnerBuilds';
the only reason it's replicated is that it must be a different
target to be run in the same build (e.g. by Rebuild or by
a `/t:Clean;Build` invocation.
============================================================
-->
<Target Name="Clean"
DependsOnTargets="_ComputeTargetFrameworkItems">
<!-- If this logic is changed, also update DispatchToInnerBuilds -->
<!-- If this logic is changed, also update 'DispatchToInnerBuilds' -->
<MSBuild Projects="@(_InnerBuildProjects)"
Condition="'@(_InnerBuildProjects)' != '' "
Targets="Clean"
Expand All @@ -157,16 +156,14 @@ Copyright (C) Microsoft Corporation. All rights reserved.

<!--
============================================================
Rebuild
Rebuild

Cross-targeting version of rebuild.
Cross-targeting version of rebuild.
============================================================
-->
<Target Name="Rebuild" DependsOnTargets="Clean;Build" />

<!--
This will import NuGet restore targets. We need restore to work before any package assets are available.
-->
<!-- This will import NuGet restore targets. We need restore to work before any package assets are available. -->
<PropertyGroup>
<MSBuildUseVisualStudioDirectoryLayout Condition="'$(MSBuildUseVisualStudioDirectoryLayout)'==''">$([MSBuild]::IsRunningFromVisualStudio())</MSBuildUseVisualStudioDirectoryLayout>
<NuGetRestoreTargets Condition="'$(NuGetRestoreTargets)'=='' and '$(MSBuildUseVisualStudioDirectoryLayout)'=='true'">$([MSBuild]::GetToolsDirectory32())\..\..\..\Common7\IDE\CommonExtensions\Microsoft\NuGet\NuGet.targets</NuGetRestoreTargets>
Expand All @@ -177,9 +174,7 @@ Copyright (C) Microsoft Corporation. All rights reserved.

<Import Project="$(CustomAfterMicrosoftCommonCrossTargetingTargets)" Condition="'$(CustomAfterMicrosoftCommonCrossTargetingTargets)' != '' and Exists('$(CustomAfterMicrosoftCommonCrossTargetingTargets)')"/>

<!--
Allow extensions like NuGet restore to work before any package assets are available.
-->
<!-- Allow extensions like NuGet restore to work before any package assets are available. -->
<PropertyGroup>
<ImportByWildcardAfterMicrosoftCommonCrossTargetingTargets Condition="'$(ImportByWildcardAfterMicrosoftCommonCrossTargetingTargets)' == ''">true</ImportByWildcardAfterMicrosoftCommonCrossTargetingTargets>
</PropertyGroup>
Expand All @@ -188,15 +183,15 @@ Copyright (C) Microsoft Corporation. All rights reserved.
Condition="'$(ImportByWildcardAfterMicrosoftCommonCrossTargetingTargets)' == 'true' and exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.CrossTargeting.targets\ImportAfter')"/>

<!--
Import project extensions which usually come from packages. Package management systems will create a file at:
$(MSBuildProjectExtensionsPath)\$(MSBuildProjectFile).<SomethingUnique>.targets
Import project extensions which usually come from packages. Package management systems will create a file at:
'$(MSBuildProjectExtensionsPath)\$(MSBuildProjectFile).<SomethingUnique>.targets'

Each package management system should use a unique moniker to avoid collisions. It is a wild-card iport so the package
management system can write out multiple files but the order of the import is alphabetic because MSBuild sorts the list.
Each package management system should use a unique moniker to avoid collisions. It is a wild-card iport so the package
management system can write out multiple files but the order of the import is alphabetic because MSBuild sorts the list.

This is the same import that would happen in an inner (non-cross targeting) build. Package management systems are responsible for generating
appropriate conditions based on $(IsCrossTargetingBuild) to pull in only those package targets that are meant to participate in a cross-targeting
build.
This is the same import that would happen in an inner (non-cross targeting) build. Package management systems are responsible
for generating appropriate conditions based on $(IsCrossTargetingBuild) to pull in only those package targets that are meant
to participate in a cross-targeting build.
-->
<PropertyGroup>
<ImportProjectExtensionTargets Condition="'$(ImportProjectExtensionTargets)' == ''">true</ImportProjectExtensionTargets>
Expand All @@ -209,9 +204,9 @@ Copyright (C) Microsoft Corporation. All rights reserved.
</PropertyGroup>

<!--
Determine the path to the directory build targets file if the user did not disable $(ImportDirectoryBuildTargets) and
they did not already specify an absolute path to use via $(DirectoryBuildTargetsPath)
-->
Determine the path to the directory build targets file if the user did not disable $(ImportDirectoryBuildTargets) and
they did not already specify an absolute path to use via $(DirectoryBuildTargetsPath)
-->
<PropertyGroup Condition="'$(ImportDirectoryBuildTargets)' == 'true' and '$(DirectoryBuildTargetsPath)' == ''">
<_DirectoryBuildTargetsFile Condition="'$(_DirectoryBuildTargetsFile)' == ''">Directory.Build.targets</_DirectoryBuildTargetsFile>
<_DirectoryBuildTargetsBasePath Condition="'$(_DirectoryBuildTargetsBasePath)' == ''">$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildProjectDirectory), '$(_DirectoryBuildTargetsFile)'))</_DirectoryBuildTargetsBasePath>
Expand All @@ -220,4 +215,4 @@ Copyright (C) Microsoft Corporation. All rights reserved.

<Import Project="$(DirectoryBuildTargetsPath)" Condition="'$(ImportDirectoryBuildTargets)' == 'true' and exists('$(DirectoryBuildTargetsPath)')"/>

</Project>
</Project>