Skip to content

Commit c5295ac

Browse files
committed
Merge pull request dotnet#1117 from weshaggard/UpdateBuildTools
Switch to pulling the targets from build tools common target
2 parents 15bb3a8 + 867bd8e commit c5295ac

File tree

5 files changed

+9
-284
lines changed

5 files changed

+9
-284
lines changed

build.proj

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,4 @@
1515
<RemoveDir Directories="$(BinDir)" />
1616
</Target>
1717

18-
<Target Name="GenerateCoverageReport"
19-
AfterTargets="Test"
20-
Inputs="$(CoverageReportDir)\*.coverage.xml"
21-
Outputs="$(CoverageReportDir)index.htm"
22-
Condition="$(_CoverageEnabled)">
23-
24-
<Exec Command="$(CoverageReportGeneratorCommandLine) -reports:$(CoverageReportDir)\*.coverage.xml"
25-
ContinueOnError="ErrorAndContinue" />
26-
27-
<PropertyGroup>
28-
<CoverallsUploaderVersion>1.2</CoverallsUploaderVersion>
29-
<CoverallsUploaderCommandLine>$(PackagesDir)coveralls.io.$(CoverallsUploaderVersion)\tools\coveralls.net.exe</CoverallsUploaderCommandLine>
30-
<CoverallsUploaderOptions>--opencover $(CoverageReportDir)\*.coverage.xml -t $(CoverallsToken)</CoverallsUploaderOptions>
31-
</PropertyGroup>
32-
33-
<Exec
34-
Command="$(CoverallsUploaderCommandLine) $(CoverallsUploaderOptions)"
35-
ContinueOnError="ErrorAndContinue"
36-
Condition="'$(UploadCoverallsData)'" />
37-
</Target>
38-
3918
</Project>

dir.props

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Import Condition="Exists('..\dir.props')" Project="..\dir.props" />
33
<!-- Build Tools Version -->
44
<PropertyGroup>
5-
<BuildToolsVersion>1.0.25-prerelease-00015</BuildToolsVersion>
5+
<BuildToolsVersion>1.0.25-prerelease-00017</BuildToolsVersion>
66
</PropertyGroup>
77

88
<!-- Common repo directories -->
@@ -33,22 +33,7 @@
3333
<NugetRestoreCommand>$(NugetRestoreCommand) $(NuGetConfigCommandLine)</NugetRestoreCommand>
3434
<NugetRestoreCommand>$(NugetRestoreCommand) -Verbosity detailed</NugetRestoreCommand>
3535
</PropertyGroup>
36-
37-
<!-- Coverage options -->
38-
<PropertyGroup>
39-
<_CoverageEnabled>false</_CoverageEnabled>
40-
<_CoverageEnabled Condition="'$(SkipTests)' != 'true' and '$(OS)' == 'Windows_NT' and '$(Coverage)' == 'true'">true</_CoverageEnabled>
41-
<CoverageReportDir Condition="'$(CoverageReportDir)' == ''">$(BinDir)\tests\coverage\</CoverageReportDir>
42-
<CoverageVersion>4.5.3809-rc94</CoverageVersion>
43-
<CoverageToolPath>$(PackagesDir)OpenCover.$(CoverageVersion)\OpenCover.Console.exe</CoverageToolPath>
44-
<CoverageReportGeneratorVersion>2.0.4.0</CoverageReportGeneratorVersion>
45-
<CoverageReportGeneratorOptions>-targetdir:$(CoverageReportDir) -reporttypes:Html</CoverageReportGeneratorOptions>
46-
<CoverageReportGeneratorCommandLine>$(PackagesDir)ReportGenerator.$(CoverageReportGeneratorVersion)\ReportGenerator.exe $(CoverageReportGeneratorOptions)</CoverageReportGeneratorCommandLine>
47-
<!-- When coverage is enabled, we disallow building projects in parallel. There appear to be issues with the OpenCover tool
48-
in these scenarios. -->
49-
<SerializeProjects Condition="'$(_CoverageEnabled)'=='true'">true</SerializeProjects>
50-
</PropertyGroup>
51-
36+
5237
<!--
5338
Projects that have no OS-specific implementations just use Debug and Release for $(Configuration).
5439
Projects that do have OS-specific implementations use OS_Debug and OS_Release, e.g. a project with

src/.nuget/packages.config

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
3-
<package id="Microsoft.DotNet.BuildTools" version="1.0.25-prerelease-00015" />
4-
<package id="OpenCover" version="4.5.3809-rc94" />
5-
<package id="coveralls.io" version="1.2" />
6-
<package id="ReportGenerator" version="2.0.4.0" />
3+
<package id="Microsoft.DotNet.BuildTools" version="1.0.25-prerelease-00017" />
74
</packages>

src/dir.targets

Lines changed: 1 addition & 242 deletions
Original file line numberDiff line numberDiff line change
@@ -4,248 +4,7 @@
44
</PropertyGroup>
55

66
<Import Project="..\dir.targets" />
7-
8-
<PropertyGroup Condition=" '$(TargetFrameworkIdentifier)' == ''
9-
and '$(TargetFrameworkVersion)' == ''
10-
and '$(TargetFrameworkProfile)' == '' ">
11-
<TargetingDefaultPlatform>true</TargetingDefaultPlatform>
12-
</PropertyGroup>
13-
14-
<PropertyGroup Condition="'$(TargetFrameworkIdentifier)' == ''">
15-
<TargetFrameworkIdentifier>.NETPortable</TargetFrameworkIdentifier>
16-
</PropertyGroup>
17-
18-
<!--
19-
Limit the assembly resolution to just explicit locations.
20-
Don't search anything machine-wide or build-order dependent.
21-
-->
22-
<PropertyGroup>
23-
<AssemblySearchPaths>{HintPathFromItem};{RawFileName}</AssemblySearchPaths>
24-
</PropertyGroup>
25-
26-
<!--
27-
When targeting an explicit platform other than the default,
28-
also allow the target framework directory.
29-
-->
30-
<PropertyGroup Condition="'$(TargetingDefaultPlatform)' != 'true'">
31-
<AssemblySearchPaths>$(AssemblySearchPaths);{TargetFrameworkDirectory}</AssemblySearchPaths>
32-
</PropertyGroup>
33-
34-
<!-- Setup the default target for projects not already explicitly targeting another platform -->
35-
<PropertyGroup Condition="'$(TargetingDefaultPlatform)' == 'true'">
36-
<!-- Setting a default portable profile, although nothing should resolve from there as we want to use the pacakge refs -->
37-
<TargetPlatformIdentifier>Portable</TargetPlatformIdentifier>
38-
<TargetFrameworkIdentifier>.NETPortable</TargetFrameworkIdentifier>
39-
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
40-
<TargetFrameworkProfile>Profile7</TargetFrameworkProfile>
41-
<TargetFrameworkMonikerDisplayName>.NET Portable Subset</TargetFrameworkMonikerDisplayName>
42-
<ImplicitlyExpandTargetFramework>false</ImplicitlyExpandTargetFramework>
43-
</PropertyGroup>
44-
45-
46-
<!-- Need to add references to the mscorlib design-time facade for some old-style portable dependencies like xunit -->
47-
<Target Name="AddDesignTimeFacadeReferences"
48-
Condition="'$(TargetingDefaultPlatform)' == 'true'"
49-
BeforeTargets="ResolveReferences"
50-
DependsOnTargets="GetReferenceAssemblyPaths"
51-
>
52-
<ItemGroup>
53-
<PossibleTargetFrameworks Include="$(_TargetFrameworkDirectories)" />
54-
<ReferencePath Include="%(PossibleTargetFrameworks.Identity)mscorlib.dll"
55-
Condition="'%(PossibleTargetFrameworks.Identity)' != '' and Exists('%(PossibleTargetFrameworks.Identity)mscorlib.dll')" />
56-
</ItemGroup>
57-
</Target>
58-
59-
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets"
60-
Condition="'$(TargetFrameworkIdentifier)' == '.NETPortable'" />
61-
62-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets"
63-
Condition="'$(TargetFrameworkIdentifier)' != '.NETPortable'" />
64-
65-
<!-- Restore packages -->
66-
<PropertyGroup>
67-
<PackagesConfig Condition="Exists('$(MSBuildProjectDirectory)\packages.config')">$(MSBuildProjectDirectory)\packages.config</PackagesConfig>
68-
<RestorePackages Condition="'$(RestorePackages)' == '' and Exists('$(PackagesConfig)')">true</RestorePackages>
69-
<RestorePackagesSemaphore>$(PackagesDir)$(MSBuildProjectFile)-packages.config</RestorePackagesSemaphore>
70-
</PropertyGroup>
71-
72-
<Target Name="RestorePackages"
73-
BeforeTargets="ResolveNuGetPackages"
74-
Inputs="$(PackagesConfig)"
75-
Outputs="$(RestorePackagesSemaphore)"
76-
Condition="'$(RestorePackages)' == 'true'">
77-
<Exec Command="$(NugetRestoreCommand) &quot;$(PackagesConfig)&quot;" StandardOutputImportance="Low" />
78-
<Copy SourceFiles="$(PackagesConfig)" DestinationFiles="$(RestorePackagesSemaphore)" ContinueOnError="True" SkipUnchangedFiles="True" />
79-
</Target>
80-
81-
<Import Project="$(ToolsDir)packageresolve.targets" Condition="Exists('$(ToolsDir)packageresolve.targets')" />
82-
83-
<!-- Version assemblies -->
84-
<PropertyGroup>
85-
<!--
86-
For now to avoid conflicts with files coming from packages default assembly version to 999.999.999.999
87-
until we correctly add the AssemblyVersion property to each of the projects.
88-
-->
89-
<AssemblyVersion Condition="'$(AssemblyVersion)'==''">999.999.999.999</AssemblyVersion>
90-
<GenerateAssemblyInfo Condition="'$(GenerateAssemblyInfo)'==''">true</GenerateAssemblyInfo>
91-
<CLSCompliant Condition="'$(CLSCompliant)'==''">true</CLSCompliant>
92-
</PropertyGroup>
93-
94-
<Import Project="$(ToolsDir)versioning.targets" Condition="Exists('$(ToolsDir)versioning.targets')" />
95-
96-
<Import Project="$(ToolsDir)publishtest.targets" Condition="Exists('$(ToolsDir)publishtest.targets')" />
97-
98-
<PropertyGroup>
99-
<IsTestProject Condition="'$(IsTestProject)'=='' And $(MSBuildProjectName.EndsWith('.Tests'))">True</IsTestProject>
100-
<CLSCompliant Condition="'$(IsTestProject)'=='True'">false</CLSCompliant>
101-
</PropertyGroup>
102-
103-
<!-- VS does not evaluate the conditions when loading the projects and so we add this via a target file and import it with a condition -->
104-
<!--
105-
Disable temporarily until we can get this working in both TFS and Github
106-
<Import Project="$(ToolsDir)resources.targets" />
107-
-->
108-
109-
<PropertyGroup>
110-
<ResourcesSourceOutputDirectory Condition="'$(ResourcesSourceOutputDirectory)' == ''">$(MSBuildProjectDirectory)\Resources</ResourcesSourceOutputDirectory>
111-
<StringResourcesPath Condition="'$(StringResourcesPath)'=='' And Exists('$(ResourcesSourceOutputDirectory)\Strings.resx')">$(ResourcesSourceOutputDirectory)\Strings.resx</StringResourcesPath>
112-
<ResourceSRPath Condition="'$(ResourceSRPath)'=='' And '$(MSBuildProjectExtension)' == '.csproj'">$(ResourcesSourceOutputDirectory)\SR.cs</ResourceSRPath>
113-
</PropertyGroup>
114-
115-
<Import Project="$(ToolsDir)ResourcesIncludes.targets" Condition="Exists('$(ToolsDir)ResourcesIncludes.targets') and Exists('$(StringResourcesPath)') And Exists('$(ResourceSRPath)') And '$(SkipResourcesIncludesTarget)'==''"/>
116-
117-
<!-- sign.targets relies on the value of IsTestProject so be sure to import it after it's defined -->
118-
<Import Project="$(ToolsDir)sign.targets" Condition="Exists('$(ToolsDir)sign.targets')" />
119-
120-
<PropertyGroup>
121-
<TestRuntimePackageConfig>$(ToolsDir)test-runtime\packages.config</TestRuntimePackageConfig>
122-
<TestRuntimePackageSemaphore>$(PackagesDir)Test-Runtime-packages.config</TestRuntimePackageSemaphore>
123-
</PropertyGroup>
124-
125-
<Target Name="RestoreTestRuntimePackage"
126-
BeforeTargets="ResolveNuGetPackages"
127-
Inputs="$(TestRuntimePackageConfig)"
128-
Outputs="$(TestRuntimePackageSemaphore)"
129-
Condition="'$(IsTestProject)' == 'true'">
130-
<Exec Command="$(NugetRestoreCommand) &quot;$(TestRuntimePackageConfig)&quot;" StandardOutputImportance="Low" />
131-
<Copy SourceFiles="$(TestRuntimePackageConfig)" DestinationFiles="$(TestRuntimePackageSemaphore)" ContinueOnError="true" />
132-
</Target>
133-
134-
<!-- Which categories of tests to run by default -->
135-
<PropertyGroup>
136-
<RunTestsWithCategories Condition="'$(RunTestsWithCategories)' == '' And '$(RunTestsWithoutCategories)' == ''">InnerLoop</RunTestsWithCategories>
137-
<TestCategories Condition="'$(TestCategories)'==''">InnerLoop</TestCategories>
138-
139-
<TestDisabled>False</TestDisabled>
140-
<TestDisabled Condition="'$(IsTestProject)'!='True' Or '$(SkipTests)'=='True' Or '$(RunTestsForProject)'=='False'">True</TestDisabled>
141-
</PropertyGroup>
142-
143-
<ItemGroup>
144-
<!-- Split semicolon separated lists -->
145-
<TestCategoriesItems Include="$(TestCategories)" />
146-
<RunTestsWithCategoriesItems Include="$(RunTestsWithCategories)" />
147-
<RunTestsWithoutCategoriesItems Include="$(RunTestsWithoutCategories)" />
148-
</ItemGroup>
149-
150-
<!-- General xunit options -->
151-
<PropertyGroup>
152-
<XunitCommandLine>xunit.console.netcore.exe $(TargetFileName)</XunitCommandLine>
153-
<XunitOptions>$(XunitOptions) -xml .\testResults.xml</XunitOptions>
154-
<XunitOptions>$(XunitOptions) -notrait category=failing</XunitOptions>
155-
</PropertyGroup>
156-
157-
<!-- Directory specific coverage options -->
158-
<PropertyGroup>
159-
<CoverageEnabledForProject Condition="'$(CoverageEnabledForProject)'=='' and '$(IsTestProject)'=='true'">$(_CoverageEnabled)</CoverageEnabledForProject>
160-
<XunitHost>corerun.exe</XunitHost>
161-
<CoverageHost>$(CoverageToolPath)</CoverageHost>
162-
<CoverageOutputFilePath>$(CoverageReportDir)$(MSBuildProjectName).coverage.xml</CoverageOutputFilePath>
163-
<CoverageOptions>-filter:"+[*]* -[*.Tests]*" -nodefaultfilters -excludebyattribute:*.ExcludeFromCodeCoverage* -skipautoprops -hideskipped:All -threshold:1</CoverageOptions>
164-
<CoverageCommandLine>$(CoverageOptions) -returntargetcode -register:user -target:$(XunitHost) -output:$(CoverageOutputFilePath)</CoverageCommandLine>
165-
</PropertyGroup>
166-
167-
<!-- In VS (2015 Preview or later currently required): Debug to run unit tests on CoreCLR. -->
168-
<PropertyGroup Condition="'$(IsTestProject)'=='True'">
169-
<DebugTestFrameworkFolder>aspnetcore50</DebugTestFrameworkFolder>
170-
<StartWorkingDirectory Condition="'$(StartWorkingDirectory)' == ''">$(TestPath)$(DebugTestFrameworkFolder)</StartWorkingDirectory>
171-
<StartAction Condition="'$(StartAction)' == ''">Program</StartAction>
172-
<StartProgram Condition="'$(StartProgram)' == ''">$(StartWorkingDirectory)\$(TestHost)</StartProgram>
173-
<StartArguments Condition="'$(StartArguments)' == ''">$(TestCommandLine) -wait</StartArguments>
174-
<DebugEngines>{2E36F1D4-B23C-435D-AB41-18E608940038}</DebugEngines>
175-
</PropertyGroup>
176-
177-
<!-- On command line run unit tests on CoreCLR after the Test target -->
178-
<Target Name="RunTestsForProject"
179-
AfterTargets="CheckTestCategories"
180-
Condition="'$(TestDisabled)'!='True'">
181-
182-
<PropertyGroup>
183-
<XunitOptions Condition="'@(RunWithTraits)'!=''">$(XunitOptions) -trait category=@(RunWithTraits, ' -trait category=') </XunitOptions>
184-
<XunitOptions Condition="'@(RunWithoutTraits)'!=''">$(XunitOptions) -notrait category=@(RunWithoutTraits, ' -notrait category=') </XunitOptions>
185-
</PropertyGroup>
186-
187-
<!-- xUnit command line without coverage enabled -->
188-
<PropertyGroup>
189-
<TestHost>$(XunitHost)</TestHost>
190-
<TestCommandLine>$(XunitCommandLine) $(XunitOptions)</TestCommandLine>
191-
</PropertyGroup>
192-
193-
<!-- xUnit command line with coverage enabled -->
194-
<PropertyGroup Condition="'$(CoverageEnabledForProject)'=='true'">
195-
<TestHost>$(CoverageHost)</TestHost>
196-
<XunitOptions>$(XunitOptions) -parallel none</XunitOptions>
197-
<TestCommandLine>$(CoverageCommandLine) -targetargs:"$(TestCommandLine)"</TestCommandLine>
198-
</PropertyGroup>
199-
200-
<MakeDir Condition="'$(CoverageEnabledForProject)'=='true'" Directories="$(CoverageReportDir)" />
201-
202-
<Exec Command="$(TestHost) $(TestCommandLine)"
203-
WorkingDirectory="$(TestPath)%(TestTargetFramework.Folder)"
204-
ContinueOnError="True">
205-
<Output PropertyName="TestRunExitCode" TaskParameter="ExitCode" />
206-
</Exec>
207-
208-
<Error Condition="'$(TestRunExitCode)' != '0'" Text="One or more tests failed while running tests from '$(MSBuildProjectName)' please check log for details!" />
209-
</Target>
210-
211-
<Target Name="CheckTestCategories"
212-
AfterTargets="Test"
213-
Condition="'$(TestDisabled)'!='True'">
214-
215-
<Error Condition="'$(RunTestsWithCategories)' != '' And '$(RunTestsWithoutCategories)' != ''"
216-
Text="Specifying both RunTestsWithCategories and RunTestsWithoutCategories is not supported please only specify one or the other." />
217-
218-
<ItemGroup Condition="'@(RunTestsWithCategoriesItems)'!=''">
219-
<!-- Intersection of TestCategoriesItems and RunTestsWithCategoriesItems -->
220-
<TestCategoriesToRun Include="@(TestCategoriesItems)" Condition="'@(RunTestsWithCategoriesItems)'=='%(Identity)'" />
221-
</ItemGroup>
222-
<ItemGroup Condition="'@(RunTestsWithoutCategoriesItems)'!=''">
223-
<!-- Run all test categories except specified -->
224-
<TestCategoriesToRun Include="@(TestCategoriesItems)" Exclude="@(RunTestsWithoutCategoriesItems)" />
225-
</ItemGroup>
226-
<ItemGroup>
227-
<RunWithInnerLoopItems Include="@(TestCategoriesToRun)" Condition="'%(TestCategoriesToRun.Identity)'=='InnerLoop'" />
228-
229-
<RunWithTraits Condition="'@(RunWithInnerLoopItems)'==''" Include="@(TestCategoriesToRun)" />
230-
231-
<RunWithoutTraits Condition="'@(RunWithInnerLoopItems)'!=''" Include="@(TestCategoriesItems)" />
232-
<RunWithoutTraits Condition="'@(RunWithInnerLoopItems)'!=''" Remove="@(TestCategoriesToRun)" />
233-
</ItemGroup>
234-
<PropertyGroup>
235-
<!-- If there is nothing to run then disable the test -->
236-
<TestDisabled Condition="'@(TestCategoriesToRun)'==''">True</TestDisabled>
237-
</PropertyGroup>
238-
</Target>
239-
240-
<!-- Generate coverage reports for individual projects. -->
241-
<Target Name="GenerateIndividualCoverageReport"
242-
AfterTargets="RunTestsForProject"
243-
Inputs="$(CoverageOutputFilePath)"
244-
Outputs="$(CoverageReportDir)index.htm"
245-
Condition="'$(BuildAllProjects)'!='true' and '$(CoverageEnabledForProject)'=='true'">
2467

247-
<Exec Command="$(CoverageReportGeneratorCommandLine) -reports:$(CoverageOutputFilePath)"
248-
ContinueOnError="ErrorAndContinue" />
249-
</Target>
8+
<Import Project="$(ToolsDir)Build.Common.targets" Condition="Exists('$(ToolsDir)Build.Common.targets')" />
2509

25110
</Project>

src/dirs.proj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,9 @@
2121
</TraversalBuildDependsOn>
2222
</PropertyGroup>
2323

24+
<PropertyGroup>
25+
<GenerateCodeCoverageReportForAll>true</GenerateCodeCoverageReportForAll>
26+
</PropertyGroup>
27+
<Import Project="$(ToolsDir)CodeCoverage.targets" Condition="Exists('$(ToolsDir)CodeCoverage.targets')" />
28+
2429
</Project>

0 commit comments

Comments
 (0)