Skip to content

Commit 747497a

Browse files
Merge pull request #3894 from Nirmal4G/feature/refactor
Update package titles and consolidate build logic
2 parents f67ccd1 + e984265 commit 747497a

File tree

77 files changed

+634
-646
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+634
-646
lines changed

.editorconfig

Lines changed: 59 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,49 @@
11
# Remove the line below if you want to inherit .editorconfig settings from higher directories
22
root = true
33

4-
# C# files
5-
[*.cs]
4+
# All files
5+
[*]
66

77
#### Core EditorConfig Options ####
88

99
# Encoding
1010
charset = utf-8
1111

1212
# Indentation and spacing
13+
tab_width = 4
1314
indent_size = 4
1415
indent_style = space
15-
tab_width = 4
1616

1717
# New line preferences
18-
end_of_line = crlf
18+
end_of_line = unset
1919
insert_final_newline = false
2020

21+
#### Build files ####
22+
23+
# Solution files
24+
[*.{sln,slnx}]
25+
tab_width = 4
26+
indent_size = 4
27+
indent_style = tab
28+
29+
# Configuration files
30+
[*.{json,xml,yml,config,runsettings}]
31+
indent_size = 2
32+
33+
# MSBuild files
34+
[*.{slnf,props,targets,projitems,csproj,shproj}]
35+
indent_size = 2
36+
37+
#### Source files ####
38+
39+
# Markdown files
40+
[*.md]
41+
indent_size = 2
42+
insert_final_newline = true
43+
44+
# C# files
45+
[*.cs]
46+
2147
#### .NET Coding Conventions ####
2248

2349
# this. and Me. preferences
@@ -138,8 +164,8 @@ csharp_space_between_square_brackets = false
138164
csharp_preserve_single_line_blocks = true
139165
csharp_preserve_single_line_statements = true
140166

141-
142167
# Naming Symbols
168+
143169
# constant_fields - Define constant fields
144170
dotnet_naming_symbols.constant_fields.applicable_kinds = field
145171
dotnet_naming_symbols.constant_fields.required_modifiers = const
@@ -171,6 +197,7 @@ dotnet_naming_symbols.non_interface_types.applicable_kinds
171197
dotnet_naming_symbols.interface_types.applicable_kinds = interface
172198

173199
# Naming Styles
200+
174201
# camel_case - Define the camelCase style
175202
dotnet_naming_style.camel_case.capitalization = camel_case
176203
# pascal_case - Define the Pascal_case style
@@ -239,15 +266,8 @@ dotnet_naming_rule.interface_types_must_be_prefixed_with_i.style
239266
dotnet_naming_style.prefix_private_field_with_underscore.capitalization = camel_case
240267
dotnet_naming_style.prefix_private_field_with_underscore.required_prefix = _
241268

242-
# Code files
269+
# .NET Code Analysis
243270

244-
# SA1009: Closing parenthesis should be spaced correctly
245-
# Needed for null forgiving operator after functions, "foo()!"
246-
dotnet_diagnostic.SA1009.severity = none
247-
248-
[*.{cs,vb}]
249-
250-
# Migrate back from old Toolkit.ruleset
251271
dotnet_diagnostic.CA1001.severity = warning
252272
dotnet_diagnostic.CA1009.severity = warning
253273
dotnet_diagnostic.CA1016.severity = warning
@@ -310,24 +330,43 @@ dotnet_diagnostic.CA2238.severity = warning
310330
dotnet_diagnostic.CA2240.severity = warning
311331
dotnet_diagnostic.CA2241.severity = warning
312332
dotnet_diagnostic.CA2242.severity = warning
333+
334+
# StyleCop Code Analysis
335+
336+
# Closing parenthesis should be spaced correctly: "foo()!"
337+
dotnet_diagnostic.SA1009.severity = none
338+
339+
# Hide warnings when using the new() expression from C# 9.
340+
dotnet_diagnostic.SA1000.severity = none
341+
313342
dotnet_diagnostic.SA1011.severity = none
314343
dotnet_diagnostic.SA1101.severity = none
344+
345+
# Hide warnings when accessing properties without "this".
346+
dotnet_diagnostic.SA1101.severity = none
315347
dotnet_diagnostic.SA1118.severity = none
316348
dotnet_diagnostic.SA1200.severity = none
317349
dotnet_diagnostic.SA1201.severity = none
318350
dotnet_diagnostic.SA1202.severity = none
319351
dotnet_diagnostic.SA1309.severity = none
320352
dotnet_diagnostic.SA1310.severity = none
353+
354+
# Hide warnings for record parameters.
355+
dotnet_diagnostic.SA1313.severity = none
356+
357+
# TypeParameterNamesMustBeginWithT: We do have a few templates that don't start with T. We need to double check that changing this is not a breaking change. If not, we can re-enable this.
358+
dotnet_diagnostic.SA1314.severity = none
359+
360+
# UseTrailingCommasInMultiLineInitializers: This would also mean a lot of changes at the end of all multiline initializers. It's also debatable if we want this or not.
361+
dotnet_diagnostic.SA1413.severity = none
362+
321363
dotnet_diagnostic.SA1600.severity = none
322364
dotnet_diagnostic.SA1602.severity = none
323365
dotnet_diagnostic.SA1611.severity = none
366+
367+
# DocumentationTextMustEndWithAPeriod: Let's enable this rule back when we shift to WinUI3 (v8.x). If we do it now, it would mean more than 400 file changes.
368+
dotnet_diagnostic.SA1629.severity = none
369+
324370
dotnet_diagnostic.SA1633.severity = none
325371
dotnet_diagnostic.SA1634.severity = none
326372
dotnet_diagnostic.SA1652.severity = none
327-
328-
dotnet_diagnostic.SA1629.severity = none # DocumentationTextMustEndWithAPeriod: Let's enable this rule back when we shift to WinUI3 (v8.x). If we do it now, it would mean more than 400 file changes.
329-
dotnet_diagnostic.SA1413.severity = none # UseTrailingCommasInMultiLineInitializers: This would also mean a lot of changes at the end of all multiline initializers. It's also debatable if we want this or not.
330-
dotnet_diagnostic.SA1314.severity = none # TypeParameterNamesMustBeginWithT: We do have a few templates that don't start with T. We need to double check that changing this is not a breaking change. If not, we can re-enable this.
331-
dotnet_diagnostic.SA1000.severity = none # Hide warnings when using the new() expression from C# 9.
332-
dotnet_diagnostic.SA1313.severity = none # Hide warnings for record parameters.
333-
dotnet_diagnostic.SA1101.severity = none # Hide warnings when accessing properties without "this".

Directory.Build.props

Lines changed: 31 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,65 @@
11
<Project>
22

33
<PropertyGroup>
4-
<Authors>Microsoft.Toolkit</Authors>
5-
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
6-
<NoPackageAnalysis>true</NoPackageAnalysis>
7-
<PackageIconUrl>https://raw.githubusercontent.com/CommunityToolkit/WindowsCommunityToolkit/main/build/nuget.png</PackageIconUrl>
8-
<PackageIcon>images\nuget.png</PackageIcon>
9-
<PackageProjectUrl>https://github.com/CommunityToolkit/WindowsCommunityToolkit</PackageProjectUrl>
10-
<PackageLicenseExpression>MIT</PackageLicenseExpression>
11-
<PackageReleaseNotes>https://github.com/CommunityToolkit/WindowsCommunityToolkit/releases</PackageReleaseNotes>
12-
<Copyright>(c) .NET Foundation and Contributors. All rights reserved.</Copyright>
13-
<DefaultLanguage>en-US</DefaultLanguage>
14-
<IsDesignProject>$(MSBuildProjectName.Contains('.Design'))</IsDesignProject>
15-
<IsTestProject>$(MSBuildProjectName.Contains('Test'))</IsTestProject>
16-
<IsUwpProject Condition="'$(IsDesignProject)' != 'true'">$(MSBuildProjectName.Contains('Uwp'))</IsUwpProject>
17-
<IsSampleProject>$(MSBuildProjectName.Contains('Sample'))</IsSampleProject>
18-
<TargetPlatformBaseVersion>10.0</TargetPlatformBaseVersion>
19-
<TargetPlatformRevision>19041</TargetPlatformRevision>
20-
<TargetPlatformMinRevision>17763</TargetPlatformMinRevision>
21-
<PackageOutputPath>$(MSBuildThisFileDirectory)bin\nupkg</PackageOutputPath>
4+
<RepositoryDirectory>$(MSBuildThisFileDirectory)</RepositoryDirectory>
5+
<BuildToolsDirectory>$(RepositoryDirectory)build\</BuildToolsDirectory>
226
</PropertyGroup>
237

24-
<PropertyGroup Condition="'$(TF_BUILD)' == 'true'">
25-
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
26-
</PropertyGroup>
8+
<Import Project="$(BuildToolsDirectory)Windows.Toolkit.Common.props" />
279

2810
<Choose>
29-
<When Condition="'$(IsTestProject)' != 'true' and '$(IsSampleProject)' != 'true' and '$(IsDesignProject)' != 'true'">
11+
<When Condition="$(IsCoreProject)">
3012
<PropertyGroup>
3113
<GenerateDocumentationFile>true</GenerateDocumentationFile>
14+
<PackageOutputPath>$(RepositoryDirectory)bin\nupkg</PackageOutputPath>
15+
<GenerateLibraryLayout Condition="$(IsUwpProject)">true</GenerateLibraryLayout>
16+
<TreatWarningsAsErrors Condition="'$(Configuration)' == 'Release'">true</TreatWarningsAsErrors>
3217
</PropertyGroup>
3318
</When>
3419
<Otherwise>
3520
<PropertyGroup>
3621
<IsPackable>false</IsPackable>
22+
<IsPublishable>false</IsPublishable>
23+
<NoWarn>$(NoWarn);CS8002;SA0001</NoWarn>
3724
</PropertyGroup>
3825
</Otherwise>
3926
</Choose>
4027

4128
<Choose>
42-
<When Condition="('$(IsUwpProject)' == 'true') and '$(IsSampleProject)' != 'true' and '$(IsDesignProject)' != 'true'">
29+
<When Condition="$(IsUwpProject)">
4330
<PropertyGroup>
44-
<GenerateLibraryLayout>true</GenerateLibraryLayout>
31+
<!-- Code CS8002 is a warning for strong named -> non-strong-named reference. This is valid for platforms other than .NET Framework (and is needed for the UWP targets. -->
32+
<NoWarn>$(NoWarn);CS8002</NoWarn>
33+
<!-- For including default @(Page) and @(Resource) items via 'MSBuild.Sdk.Extras' Sdk package. Also provides up to date check and file nesting -->
34+
<ExtrasEnableDefaultXamlItems>true</ExtrasEnableDefaultXamlItems>
4535
</PropertyGroup>
4636
</When>
4737
</Choose>
4838

4939
<Choose>
50-
<When Condition="'$(Configuration)' == 'Debug' and '$(IsDesignProject)' != 'true'">
51-
<!-- Debug builds have this turned on by default, but it breaks our Xaml Islands Scenarios -->
52-
<PropertyGroup>
40+
<When Condition="!$(IsDesignProject)">
41+
<!--
42+
Debug builds have this turned on by default, but it breaks our Xaml Islands Scenarios.
43+
ARM64 builds for managed apps use .NET Native. We can't use the Reflection Provider for that.
44+
-->
45+
<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
5346
<EnableXBindDiagnostics>false</EnableXBindDiagnostics>
5447
<EnableTypeInfoReflection>false</EnableTypeInfoReflection>
5548
</PropertyGroup>
49+
<ItemGroup>
50+
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />
51+
</ItemGroup>
5652
</When>
5753
</Choose>
5854

55+
<Import Project="$(BuildToolsDirectory)Windows.Toolkit.VisualStudio.Design.props" Condition="$(IsDesignProject)" />
56+
57+
<ItemGroup>
58+
<PackageReference Include="Nerdbank.GitVersioning" Version="3.3.37" PrivateAssets="All" />
59+
</ItemGroup>
60+
5961
<Choose>
60-
<When Condition="'$(SourceLinkEnabled)' != 'false' and '$(IsSampleProject)' != 'true'">
62+
<When Condition="!$(IsSampleProject) and '$(SourceLinkEnabled)' != 'false'">
6163
<PropertyGroup>
6264
<!-- Declare that the Repository URL can be published to NuSpec -->
6365
<PublishRepositoryUrl>true</PublishRepositoryUrl>
@@ -67,51 +69,9 @@
6769
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
6870
</PropertyGroup>
6971
<ItemGroup>
70-
<PackageReference Include="Microsoft.SourceLink.AzureRepos.Git" Version="1.0.0" PrivateAssets="All" />
7172
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
7273
</ItemGroup>
7374
</When>
7475
</Choose>
7576

76-
<Choose>
77-
<When Condition="'$(IsDesignProject)' != 'true'">
78-
<ItemGroup>
79-
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
80-
</ItemGroup>
81-
</When>
82-
</Choose>
83-
84-
<Choose>
85-
<When Condition="'$(IsTestProject)' != 'true' and '$(IsSampleProject)' != 'true' and '$(IsDesignProject)' != 'true'">
86-
<ItemGroup>
87-
<EmbeddedResource Include="**\*.rd.xml" />
88-
<Page Include="**\*.xaml" Exclude="**\bin\**\*.xaml;**\obj\**\*.xaml" SubType="Designer" Generator="MSBuild:Compile" />
89-
<Compile Update="**\*.xaml.cs" DependentUpon="%(Filename)" />
90-
</ItemGroup>
91-
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
92-
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
93-
</PropertyGroup>
94-
</When>
95-
</Choose>
96-
97-
<PropertyGroup Condition="'$(IsUwpProject)' == 'true'">
98-
<!-- 8002 is a strong named -> non-strong-named reference -->
99-
<!-- This is valid for platforms other than .NET Framework (and is needed for the UWP targets -->
100-
<NoWarn>$(NoWarn);8002</NoWarn>
101-
</PropertyGroup>
102-
103-
<ItemGroup>
104-
<PackageReference Include="Nerdbank.GitVersioning" Version="3.3.37" PrivateAssets="all" />
105-
</ItemGroup>
106-
107-
<ItemGroup>
108-
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json">
109-
<Link>stylecop.json</Link>
110-
</AdditionalFiles>
111-
<None Include="$(MSBuildThisFileDirectory)License.md" Pack="true" PackagePath="\" />
112-
<None Include="$(MSBuildThisFileDirectory)build\nuget.png" Pack="true" PackagePath="images\" />
113-
</ItemGroup>
114-
115-
<Import Project="$(MSBuildThisFileDirectory)build\Windows.Toolkit.VisualStudio.Design.props" Condition="'$(IsDesignProject)' == 'true'" />
116-
117-
</Project>
77+
</Project>

Directory.Build.targets

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
11
<Project>
22

3+
<Import Project="$(BuildToolsDirectory)Windows.Toolkit.Common.targets" />
4+
35
<PropertyGroup>
4-
<UseUWP Condition="$(TargetFramework.Contains(`uap10.0`)) or '$(TargetFramework)' == 'net461'">true</UseUWP>
6+
<!-- Exclude Notifications project from this since it sets different min versions than what we want for notifications -->
7+
<UseUWP Condition="($(TargetFramework.StartsWith('uap10.0')) or '$(TargetFramework)' == 'net461') and '$(MSBuildProjectName)' != 'Microsoft.Toolkit.Uwp.Notifications'">true</UseUWP>
8+
<UseUWP Condition="'$(UseUWP)' == ''">false</UseUWP>
59
</PropertyGroup>
610

711
<Choose>
812
<!-- We'll include signing the Notifications library since we need the DLL signature to match for interop from class libraries to main projects -->
9-
<When Condition="(!$(TargetFramework.Contains(`uap10.0`)) and '$(TargetFramework)' != 'native' and '$(IsSampleProject)' != 'true') or $(MSBuildProjectName) == 'Microsoft.Toolkit.Uwp.Notifications'">
13+
<When Condition="!($(TargetFramework.StartsWith('uap10.0')) or '$(TargetFramework)' == 'native' or $(IsSampleProject)) or '$(MSBuildProjectName)' == 'Microsoft.Toolkit.Uwp.Notifications'">
1014
<PropertyGroup>
1115
<SignAssembly>true</SignAssembly>
1216
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)toolkit.snk</AssemblyOriginatorKeyFile>
1317
</PropertyGroup>
1418
</When>
1519
</Choose>
1620

17-
<!--Exclude Notifications project from this since it sets different min versions than what we want for notifications-->
18-
<Import Project="$(MSBuildThisFileDirectory)build\Windows.Toolkit.Uwp.Build.targets" Condition="'$(UseUWP)' == 'true' and $(MSBuildProjectName) != 'Microsoft.Toolkit.Uwp.Notifications'" />
21+
<Import Project="$(BuildToolsDirectory)Windows.Toolkit.UWP.Build.targets" Condition="$(UseUWP)" />
22+
23+
<Import Project="$(BuildToolsDirectory)Windows.Toolkit.Workarounds.Xaml.targets" Condition="$(IsCoreProject)" />
1924

2025
<Target Name="AddCommitHashToAssemblyAttributes" BeforeTargets="GetAssemblyAttributes">
2126
<ItemGroup>

GazeInputTest/GazeInputTest.csproj

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
1818
<WindowsXamlEnableOverview>true</WindowsXamlEnableOverview>
1919
<AppxPackageSigningEnabled>false</AppxPackageSigningEnabled>
20+
<NoWarn>$(NoWarn);2008</NoWarn>
2021
</PropertyGroup>
2122
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
2223
<DebugSymbols>true</DebugSymbols>
2324
<OutputPath>bin\x86\Debug\</OutputPath>
2425
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
25-
<NoWarn>;2008</NoWarn>
2626
<DebugType>full</DebugType>
2727
<PlatformTarget>x86</PlatformTarget>
2828
<UseVSHostingProcess>false</UseVSHostingProcess>
@@ -33,7 +33,6 @@
3333
<OutputPath>bin\x86\Release\</OutputPath>
3434
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
3535
<Optimize>true</Optimize>
36-
<NoWarn>;2008</NoWarn>
3736
<DebugType>pdbonly</DebugType>
3837
<PlatformTarget>x86</PlatformTarget>
3938
<UseVSHostingProcess>false</UseVSHostingProcess>
@@ -45,7 +44,6 @@
4544
<DebugSymbols>true</DebugSymbols>
4645
<OutputPath>bin\ARM\Debug\</OutputPath>
4746
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
48-
<NoWarn>;2008</NoWarn>
4947
<DebugType>full</DebugType>
5048
<PlatformTarget>ARM</PlatformTarget>
5149
<UseVSHostingProcess>false</UseVSHostingProcess>
@@ -56,7 +54,6 @@
5654
<OutputPath>bin\ARM\Release\</OutputPath>
5755
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
5856
<Optimize>true</Optimize>
59-
<NoWarn>;2008</NoWarn>
6057
<DebugType>pdbonly</DebugType>
6158
<PlatformTarget>ARM</PlatformTarget>
6259
<UseVSHostingProcess>false</UseVSHostingProcess>
@@ -68,7 +65,6 @@
6865
<DebugSymbols>true</DebugSymbols>
6966
<OutputPath>bin\ARM64\Debug\</OutputPath>
7067
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
71-
<NoWarn>;2008</NoWarn>
7268
<DebugType>full</DebugType>
7369
<PlatformTarget>ARM64</PlatformTarget>
7470
<UseVSHostingProcess>false</UseVSHostingProcess>
@@ -79,7 +75,6 @@
7975
<OutputPath>bin\ARM64\Release\</OutputPath>
8076
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
8177
<Optimize>true</Optimize>
82-
<NoWarn>;2008</NoWarn>
8378
<DebugType>pdbonly</DebugType>
8479
<PlatformTarget>ARM64</PlatformTarget>
8580
<UseVSHostingProcess>false</UseVSHostingProcess>
@@ -91,7 +86,6 @@
9186
<DebugSymbols>true</DebugSymbols>
9287
<OutputPath>bin\x64\Debug\</OutputPath>
9388
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
94-
<NoWarn>;2008</NoWarn>
9589
<DebugType>full</DebugType>
9690
<PlatformTarget>x64</PlatformTarget>
9791
<UseVSHostingProcess>false</UseVSHostingProcess>
@@ -102,7 +96,6 @@
10296
<OutputPath>bin\x64\Release\</OutputPath>
10397
<DefineConstants>TRACE;NETFX_CORE;WINDOWS_UWP</DefineConstants>
10498
<Optimize>true</Optimize>
105-
<NoWarn>;2008</NoWarn>
10699
<DebugType>pdbonly</DebugType>
107100
<PlatformTarget>x64</PlatformTarget>
108101
<UseVSHostingProcess>false</UseVSHostingProcess>

0 commit comments

Comments
 (0)