Skip to content

Commit 51a46fd

Browse files
committed
Move MSBuild logic into new files
- Move the T4 MSBuild logic to a new file. - Move Public Key to a new file 'toolkit.spk'. - Move MSBuild logic to near-by `Directory.Build.{props|targets}` files.
1 parent d9afc2b commit 51a46fd

22 files changed

+110
-150
lines changed

CommunityToolkit.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Build", "Build", "{CD16E790
2323
eng\Toolkit.Common.targets = eng\Toolkit.Common.targets
2424
eng\Toolkit.CompilerTargeting.props = eng\Toolkit.CompilerTargeting.props
2525
eng\Toolkit.CompilerTargeting.targets = eng\Toolkit.CompilerTargeting.targets
26+
eng\toolkit.spk = eng\toolkit.spk
27+
eng\Toolkit.TextTemplates.targets = eng\Toolkit.TextTemplates.targets
2628
EndProjectSection
2729
EndProject
2830
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Docs", "Docs", "{88C6FFBE-322D-4CEA-842B-B2CB281D357D}"
@@ -52,6 +54,10 @@ EndProject
5254
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommunityToolkit.Mvvm.SourceGenerators.Roslyn43", "src\CommunityToolkit.Mvvm.SourceGenerators\CommunityToolkit.Mvvm.SourceGenerators.Roslyn43.csproj", "{DF455C40-B18E-4890-8758-7CCCB5CA7052}"
5355
EndProject
5456
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{B30036C4-D514-4E5B-A323-587A061772CE}"
57+
ProjectSection(SolutionItems) = preProject
58+
tests\Directory.Build.props = tests\Directory.Build.props
59+
tests\Directory.Build.targets = tests\Directory.Build.targets
60+
EndProjectSection
5561
EndProject
5662
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CommunityToolkit.Common.UnitTests", "tests\CommunityToolkit.Common.UnitTests\CommunityToolkit.Common.UnitTests.csproj", "{17522D0B-CA70-40B6-AFD8-8B8D45E75D92}"
5763
EndProject

Directory.Build.props

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,6 @@
77

88
<Import Project="$(BuildToolsDirectory)Toolkit.Common.props" />
99

10-
<Choose>
11-
<When Condition="$(IsCoreProject)">
12-
<PropertyGroup>
13-
<GenerateDocumentationFile>true</GenerateDocumentationFile>
14-
<PackageOutputPath>$(RepositoryDirectory)bin\nupkg</PackageOutputPath>
15-
<TreatWarningsAsErrors Condition="'$(Configuration)' == 'Release'">true</TreatWarningsAsErrors>
16-
</PropertyGroup>
17-
</When>
18-
<Otherwise>
19-
<PropertyGroup>
20-
<IsPackable>false</IsPackable>
21-
<IsPublishable>false</IsPublishable>
22-
<NoWarn>$(NoWarn);CS8002;SA0001</NoWarn>
23-
</PropertyGroup>
24-
</Otherwise>
25-
</Choose>
26-
2710
<ItemGroup>
2811
<PackageReference Include="Nerdbank.GitVersioning" Version="3.5.119" PrivateAssets="All" />
2912
</ItemGroup>

eng/Toolkit.Common.props

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,5 @@
11
<Project>
22

3-
<PropertyGroup>
4-
<Company>Microsoft</Company>
5-
<Authors>Microsoft</Authors>
6-
<Product>.NET Community Toolkit</Product>
7-
<CommonTags>dotnet;Community;Toolkit</CommonTags>
8-
<PackageLicenseExpression>MIT</PackageLicenseExpression>
9-
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
10-
<Copyright>(c) .NET Foundation and Contributors. All rights reserved.</Copyright>
11-
<PackageProjectUrl>https://github.com/CommunityToolkit/dotnet</PackageProjectUrl>
12-
<PackageReleaseNotes>https://github.com/CommunityToolkit/dotnet/releases</PackageReleaseNotes>
13-
<PackageIcon>Icon.png</PackageIcon>
14-
</PropertyGroup>
15-
163
<PropertyGroup>
174
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
185
</PropertyGroup>
@@ -33,19 +20,13 @@
3320
<PropertyGroup>
3421
<SignAssembly>true</SignAssembly>
3522
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)toolkit.snk</AssemblyOriginatorKeyFile>
36-
<AssemblySignPublicKey>002400000480000094000000060200000024000052534131000400000100010041753AF735AE6140C9508567666C51C6AB929806ADB0D210694B30AB142A060237BC741F9682E7D8D4310364B4BBA4EE89CC9D3D5CE7E5583587E8EA44DCA09977996582875E71FB54FA7B170798D853D5D8010B07219633BDB761D01AC924DA44576D6180CDCEAE537973982BB461C541541D58417A3794E34F45E6F2D129E2</AssemblySignPublicKey>
37-
</PropertyGroup>
38-
39-
<PropertyGroup>
40-
<IsTestProject>$(MSBuildProjectName.Contains('Test'))</IsTestProject>
41-
<IsCoreProject Condition="$(IsTestProject)">False</IsCoreProject>
42-
<IsCoreProject Condition="'$(IsCoreProject)' == ''">True</IsCoreProject>
23+
<AssemblySignPublicKeyFile>$(MSBuildThisFileDirectory)toolkit.spk</AssemblySignPublicKeyFile>
24+
<AssemblySignPublicKey>$([System.IO.File]::ReadAllText($(AssemblySignPublicKeyFile)))</AssemblySignPublicKey>
4325
</PropertyGroup>
4426

4527
<PropertyGroup>
46-
<IsPackable>true</IsPackable>
47-
<IsPublishable>true</IsPublishable>
4828
<ContinuousIntegrationBuild>$(TF_BUILD)</ContinuousIntegrationBuild>
29+
<SourceLinkEnabled>$(ContinuousIntegrationBuild)</SourceLinkEnabled>
4930
</PropertyGroup>
5031

5132
<!-- Identify projects targeting multiple Roslyn versions and add defaults -->

eng/Toolkit.Common.targets

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,24 @@
11
<Project>
22

3+
<PropertyGroup>
4+
<Company>Microsoft</Company>
5+
<Authors>Microsoft</Authors>
6+
<Product>.NET Community Toolkit</Product>
7+
<CommonTags>.NET;Community;Toolkit;dotnet</CommonTags>
8+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
9+
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
10+
<Copyright>(c) .NET Foundation and Contributors. All rights reserved.</Copyright>
11+
<PackageProjectUrl>https://github.com/CommunityToolkit/dotnet</PackageProjectUrl>
12+
<PackageReleaseNotes>https://github.com/CommunityToolkit/dotnet/releases</PackageReleaseNotes>
13+
<PackageIcon>Icon.png</PackageIcon>
14+
</PropertyGroup>
15+
316
<PropertyGroup>
417
<!-- TODO: Dynamically generate Title if one wasn't set -->
518
<Title Condition="'$(Title)' == ''">$(Product) Asset</Title>
619
</PropertyGroup>
720

821
<PropertyGroup>
9-
<CommonTags Condition="$(IsCoreProject)">$(CommonTags);.NET</CommonTags>
1022
<PackageTags Condition="'$(PackageTags)' != ''">$(CommonTags);$(PackageTags)</PackageTags>
1123
<PackageTags Condition="'$(PackageTags)' == ''">$(CommonTags)</PackageTags>
1224
</PropertyGroup>

eng/Toolkit.TextTemplates.targets

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<Project>
2+
3+
<ItemGroup>
4+
<None Update="Generated\Guard.Comparable.Numeric.tt">
5+
<Generator>TextTemplatingFileGenerator</Generator>
6+
<LastGenOutput>Guard.Comparable.Numeric.g.cs</LastGenOutput>
7+
</None>
8+
<None Update="Generated\Guard.Collection.tt">
9+
<Generator>TextTemplatingFileGenerator</Generator>
10+
<LastGenOutput>Guard.Collection.g.cs</LastGenOutput>
11+
</None>
12+
<None Update="Generated\ThrowHelper.Collection.tt">
13+
<Generator>TextTemplatingFileGenerator</Generator>
14+
<LastGenOutput>ThrowHelper.Collection.g.cs</LastGenOutput>
15+
</None>
16+
<None Update="Generated\TypeInfo.ttinclude">
17+
<Generator>TextTemplatingFileGenerator</Generator>
18+
<LastGenOutput>TypeInfo.g.cs</LastGenOutput>
19+
</None>
20+
</ItemGroup>
21+
22+
<!-- T4 service used by the Guard APIs -->
23+
<ItemGroup>
24+
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
25+
</ItemGroup>
26+
27+
<ItemGroup>
28+
<Compile Update="Generated\Guard.Comparable.Numeric.g.cs">
29+
<DesignTime>True</DesignTime>
30+
<AutoGen>True</AutoGen>
31+
<DependentUpon>Guard.Comparable.Numeric.tt</DependentUpon>
32+
</Compile>
33+
<Compile Update="Generated\Guard.Collection.g.cs">
34+
<DesignTime>True</DesignTime>
35+
<AutoGen>True</AutoGen>
36+
<DependentUpon>Guard.Collection.tt</DependentUpon>
37+
</Compile>
38+
<Compile Update="Generated\ThrowHelper.Collection.g.cs">
39+
<DesignTime>True</DesignTime>
40+
<AutoGen>True</AutoGen>
41+
<DependentUpon>ThrowHelper.Collection.tt</DependentUpon>
42+
</Compile>
43+
<Compile Update="Generated\TypeInfo.g.cs">
44+
<DesignTime>True</DesignTime>
45+
<AutoGen>True</AutoGen>
46+
<DependentUpon>TypeInfo.ttinclude</DependentUpon>
47+
</Compile>
48+
</ItemGroup>
49+
50+
</Project>

eng/toolkit.spk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
002400000480000094000000060200000024000052534131000400000100010041753AF735AE6140C9508567666C51C6AB929806ADB0D210694B30AB142A060237BC741F9682E7D8D4310364B4BBA4EE89CC9D3D5CE7E5583587E8EA44DCA09977996582875E71FB54FA7B170798D853D5D8010B07219633BDB761D01AC924DA44576D6180CDCEAE537973982BB461C541541D58417A3794E34F45E6F2D129E2

src/CommunityToolkit.Diagnostics/CommunityToolkit.Diagnostics.csproj

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -43,51 +43,6 @@
4343
</PolySharpIncludeGeneratedTypes>
4444
</PropertyGroup>
4545

46-
<ItemGroup>
47-
<None Update="Generated\Guard.Comparable.Numeric.tt">
48-
<Generator>TextTemplatingFileGenerator</Generator>
49-
<LastGenOutput>Guard.Comparable.Numeric.g.cs</LastGenOutput>
50-
</None>
51-
<None Update="Generated\Guard.Collection.tt">
52-
<Generator>TextTemplatingFileGenerator</Generator>
53-
<LastGenOutput>Guard.Collection.g.cs</LastGenOutput>
54-
</None>
55-
<None Update="Generated\ThrowHelper.Collection.tt">
56-
<Generator>TextTemplatingFileGenerator</Generator>
57-
<LastGenOutput>ThrowHelper.Collection.g.cs</LastGenOutput>
58-
</None>
59-
<None Update="Generated\TypeInfo.ttinclude">
60-
<Generator>TextTemplatingFileGenerator</Generator>
61-
<LastGenOutput>TypeInfo.g.cs</LastGenOutput>
62-
</None>
63-
</ItemGroup>
64-
65-
<!-- T4 service used by the Guard APIs -->
66-
<ItemGroup>
67-
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
68-
</ItemGroup>
69-
70-
<ItemGroup>
71-
<Compile Update="Generated\Guard.Comparable.Numeric.g.cs">
72-
<DesignTime>True</DesignTime>
73-
<AutoGen>True</AutoGen>
74-
<DependentUpon>Guard.Comparable.Numeric.tt</DependentUpon>
75-
</Compile>
76-
<Compile Update="Generated\Guard.Collection.g.cs">
77-
<DesignTime>True</DesignTime>
78-
<AutoGen>True</AutoGen>
79-
<DependentUpon>Guard.Collection.tt</DependentUpon>
80-
</Compile>
81-
<Compile Update="Generated\ThrowHelper.Collection.g.cs">
82-
<DesignTime>True</DesignTime>
83-
<AutoGen>True</AutoGen>
84-
<DependentUpon>ThrowHelper.Collection.tt</DependentUpon>
85-
</Compile>
86-
<Compile Update="Generated\TypeInfo.g.cs">
87-
<DesignTime>True</DesignTime>
88-
<AutoGen>True</AutoGen>
89-
<DependentUpon>TypeInfo.ttinclude</DependentUpon>
90-
</Compile>
91-
</ItemGroup>
46+
<Import Project="$(BuildToolsDirectory)Toolkit.TextTemplates.targets" />
9247

9348
</Project>

src/Directory.Build.props

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
<Import Project="..\Directory.Build.props" />
44

5+
<PropertyGroup>
6+
<IsPackable>true</IsPackable>
7+
<IsPublishable>true</IsPublishable>
8+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
9+
<PackageOutputPath>$(RepositoryDirectory)bin\nupkg</PackageOutputPath>
10+
<TreatWarningsAsErrors Condition="'$(Configuration)' == 'Release'">true</TreatWarningsAsErrors>
11+
</PropertyGroup>
12+
513
<!-- Include PolySharp to generate polyfills for all projects (on their .NET Standard 2.x targets) -->
614
<ItemGroup>
715
<PackageReference Include="PolySharp" Version="1.8.1">

tests/CommunityToolkit.Common.UnitTests/CommunityToolkit.Common.UnitTests.csproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@
44
<TargetFrameworks>net472;net6.0;net7.0</TargetFrameworks>
55
</PropertyGroup>
66

7-
<ItemGroup>
8-
<PackageReference Include="MSTest.TestAdapter" Version="3.0.1" />
9-
<PackageReference Include="MSTest.TestFramework" Version="3.0.1" />
10-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
11-
</ItemGroup>
12-
137
<ItemGroup>
148
<ProjectReference Include="..\..\src\CommunityToolkit.Common\CommunityToolkit.Common.csproj" />
159
</ItemGroup>

tests/CommunityToolkit.Diagnostics.UnitTests/CommunityToolkit.Diagnostics.UnitTests.csproj

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@
44
<TargetFrameworks>net472;net6.0;net7.0</TargetFrameworks>
55
</PropertyGroup>
66

7-
<ItemGroup>
8-
<PackageReference Include="MSTest.TestAdapter" Version="3.0.1" />
9-
<PackageReference Include="MSTest.TestFramework" Version="3.0.1" />
10-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
11-
</ItemGroup>
12-
137
<ItemGroup>
148
<ProjectReference Include="..\..\src\CommunityToolkit.Diagnostics\CommunityToolkit.Diagnostics.csproj" />
159
</ItemGroup>

0 commit comments

Comments
 (0)