Skip to content
This repository was archived by the owner on May 21, 2019. It is now read-only.

Commit 6ba347c

Browse files
author
Nate McMaster
committed
Move DefaultItem settings into a separate file
1 parent 4e32ec2 commit 6ba347c

File tree

2 files changed

+32
-35
lines changed

2 files changed

+32
-35
lines changed

build/targets/DefaultItems.targets

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<Project>
2+
<PropertyGroup>
3+
<SharedSourcesFolder>$(RepositoryRoot)shared/</SharedSourcesFolder>
4+
</PropertyGroup>
5+
6+
<!-- DisableDefaultItems only when you really want to control what is built and tested. Otherwise, use the Exclude* item groups -->
7+
<ItemGroup Condition="'$(DisableDefaultItems)' != 'true'">
8+
<Solutions Include="$(RepositoryRoot)\*.sln" />
9+
<Solutions Remove="@(ExcludeSolutions)" />
10+
11+
<ProjectsToPack Include="$(RepositoryRoot)src\*\*.csproj" />
12+
<ProjectsToPack Remove="@(ExcludeFromPack)" />
13+
14+
<SharedSourceDirectories Include="$([System.IO.Directory]::GetDirectories(&quot;$(SharedSourcesFolder)&quot;, '*.Sources'))" Condition="Exists('$(SharedSourcesFolder)')" />
15+
<SharedSourceDirectories Remove="@(ExcludeSharedSourceDirectories)" />
16+
17+
<!-- put unit test projects ahead of functional tests -->
18+
<_FunctionalTests Include="$(RepositoryRoot)test\*\*FunctionalTest*.csproj" />
19+
<ProjectsToTest Include="$(RepositoryRoot)test\*\*.csproj" Exclude="@(_FunctionalTests)" />
20+
<ProjectsToTest Include="@(_FunctionalTests)" />
21+
<ProjectsToTest Remove="@(ExcludeFromTest)" />
22+
</ItemGroup>
23+
24+
</Project>

build/targets/standard-lifecycle.targets

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

3+
<Import Project="DefaultItems.targets" />
4+
35
<!--
46
###################################################################
57
Standard lifecycle targets.
@@ -67,32 +69,27 @@ Executes /t:{Target} on all solutions
6769
<BuildInParallel>true</BuildInParallel>
6870
</PropertyGroup>
6971

70-
<Target Name="_GetSolutions">
71-
<ItemGroup>
72-
<Solutions Include="$(RepositoryRoot)\*.sln" />
73-
<Solutions Remove="@(ExcludeSolutions)" />
74-
</ItemGroup>
75-
72+
<Target Name="_ResolveSolutions">
7673
<RemoveDuplicates Inputs="@(Solutions)">
7774
<Output TaskParameter="Filtered" ItemName="_SolutionItems" />
7875
</RemoveDuplicates>
7976

80-
<Error Text="No solutions found to build" Conditio="'@(_SolutionItems)' == ''" />
77+
<Error Text="No solutions found to build" Condition="'@(_SolutionItems)' == ''" />
8178
</Target>
8279

83-
<Target Name="CleanSolutions" DependsOnTargets="_GetSolutions">
80+
<Target Name="CleanSolutions" DependsOnTargets="_ResolveSolutions">
8481
<MSBuild Targets="Clean"
8582
Projects="@(_SolutionItems)"
8683
Properties="Configuration=$(Configuration)" />
8784
</Target>
8885

89-
<Target Name="RestoreSolutions" DependsOnTargets="_GetSolutions">
86+
<Target Name="RestoreSolutions" DependsOnTargets="_ResolveSolutions">
9087
<MSBuild Targets="Restore"
9188
Projects="@(_SolutionItems)"
9289
Properties="Configuration=$(Configuration)" />
9390
</Target>
9491

95-
<Target Name="BuildSolutions" DependsOnTargets="_GetSolutions">
92+
<Target Name="BuildSolutions" DependsOnTargets="_ResolveSolutions">
9693
<MSBuild Targets="Build"
9794
Projects="@(_SolutionItems)"
9895
Properties="Configuration=$(Configuration)"
@@ -104,7 +101,7 @@ Executes /t:{Target} on all solutions
104101
</PropertyGroup>
105102
</Target>
106103

107-
<Target Name="RebuildSolutions" DependsOnTargets="_GetSolutions">
104+
<Target Name="RebuildSolutions" DependsOnTargets="_ResolveSolutions">
108105
<MSBuild Targets="Rebuild"
109106
Projects="@(_SolutionItems)"
110107
Properties="Configuration=$(Configuration)"
@@ -125,11 +122,6 @@ Executes /t:Pack on all projects matching src/*/*.csproj.
125122
<Target Name="PackageProjects">
126123
<!-- TODO consider using GeneratePackageOnBuild or calling Pack on the solution.
127124
This would require setting IsPackable=false and samples and possible on tests (see https://github.com/NuGet/NuGet.Client/pull/1170) -->
128-
<ItemGroup>
129-
<ProjectsToPack Include="$(RepositoryRoot)src\*\*.csproj" />
130-
<ProjectsToPack Remove="@(ExcludeFromPack)" />
131-
</ItemGroup>
132-
133125
<RemoveDuplicates Inputs="@(ProjectsToPack)">
134126
<Output TaskParameter="Filtered" ItemName="_PackProjectItems" />
135127
</RemoveDuplicates>
@@ -156,16 +148,7 @@ Creates a content files package for all each directory in
156148
that matches "$(RepositoryRoot)/shared/*.Sources".
157149
###################################################################
158150
-->
159-
<PropertyGroup>
160-
<SharedSourcesFolder>$(RepositoryRoot)shared/</SharedSourcesFolder>
161-
</PropertyGroup>
162-
163151
<Target Name="PackSharedSources" Condition="Exists('$(SharedSourcesFolder)') OR '@(SharedSourceDirectories)' != ''">
164-
<ItemGroup>
165-
<SharedSourceDirectories Include="$([System.IO.Directory]::GetDirectories(&quot;$(SharedSourcesFolder)&quot;, '*.Sources'))" Condition="Exists('$(SharedSourcesFolder)')" />
166-
<SharedSourceDirectories Remove="@(ExcludeSharedSourceDirectories)" />
167-
</ItemGroup>
168-
169152
<RemoveDuplicates Inputs="@(SharedSourceDirectories)">
170153
<Output TaskParameter="Filtered" ItemName="_SharedSourceItems" />
171154
</RemoveDuplicates>
@@ -200,16 +183,6 @@ Runs the VSTest on all projects in the ProjectsToTest itemgroup.
200183
</PropertyGroup>
201184

202185
<Target Name="TestProjects">
203-
204-
<ItemGroup>
205-
<!-- put unit test projects ahead of functional tests -->
206-
<ProjectsToTest Include="$(RepositoryRoot)test\*\*.Tests.csproj" />
207-
<ProjectsToTest Include="$(RepositoryRoot)test\*\*.Test.csproj" />
208-
<ProjectsToTest Include="$(RepositoryRoot)test\*\*.csproj" />
209-
<ProjectsToTest Remove="@(ProjectsToTest)" Condition="Exists('%(RootDir)%(Directory).notest')" />
210-
<ProjectsToTest Remove="@(ExcludeFromTest)" />
211-
</ItemGroup>
212-
213186
<RemoveDuplicates Inputs="@(ProjectsToTest)">
214187
<Output TaskParameter="Filtered" ItemName="_TestProjectItems" />
215188
</RemoveDuplicates>

0 commit comments

Comments
 (0)