0b4916558df90e0dbe3c315a8ccd14f9bbd46c0c
[platform/core/dotnet/build-tools.git] /
1 <!--
2 ***********************************************************************************************
3 Microsoft.TestPlatform.CrossTargeting.targets
4
5 WARNING:  DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
6           created a backup copy.  Incorrect changes to this file will make it
7           impossible to load or build your projects from the command-line or the IDE.
8
9 Copyright (c) .NET Foundation. All rights reserved. 
10 ***********************************************************************************************
11 -->
12 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
13   <PropertyGroup>
14     <VSTestTaskAssemblyFile Condition="$(VSTestTaskAssemblyFile) == ''">$(MSBuildExtensionsPath)\Microsoft.TestPlatform.Build.dll</VSTestTaskAssemblyFile>
15     <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
16   </PropertyGroup>
17   <UsingTask TaskName="Microsoft.TestPlatform.Build.Tasks.BuildLogTask" AssemblyFile="$(VSTestTaskAssemblyFile)" />
18   <!--
19   ===================================================================================
20                DispatchToInnerBuildsWithVSTestTarget
21                                        
22      Builds this project with /t:$(InnerVSTestTargets) /p:TargetFramework=X for each
23      value X in $(TargetFrameworks)
24
25      [IN]
26      $(TargetFrameworks) - Semicolon delimited list of target frameworks.
27      $(InnerVSTestTargets) - The targets to build for each target framework
28
29      [OUT]
30      @(InnerOutput) - The combined output items of inner targets across
31                       all target frameworks..
32
33   ===================================================================================
34   -->
35
36   <Target Name="DispatchToInnerBuildsWithVSTestTarget" Returns="@(InnerOutput)">
37     <ItemGroup>
38       <_TargetFramework Include="$(TargetFrameworks)" />
39     </ItemGroup>
40     <MSBuild Projects="$(MSBuildProjectFile)"
41              Condition="'$(TargetFrameworks)' != '' "
42              Targets="$(InnerVSTestTargets)"
43              Properties="TargetFramework=%(_TargetFramework.Identity);VSTestNoBuild=true"
44              ContinueOnError="ErrorAndContinue">
45       <Output ItemName="InnerOutput" TaskParameter="TargetOutputs" />
46     </MSBuild>
47   </Target>
48
49   <!--
50   ==================================================================================
51                                    VSTest
52
53    Cross-targeting version of VSTest.
54
55    [IN]
56    $(TargetFrameworks) - Semicolon delimited list of target frameworks.
57    $(InnerVSTestTargets) - The targets to build for each target framework. Defaults
58                          to 'VSTest' if unset, but allows override to support
59                          `msbuild /p:InnerTargets=X;Y;Z` which will build X, Y,
60                          and Z targets for each target framework.
61
62    [OUT]
63    @(InnerOutput) - The combined output items of the inner targets across
64                     all builds.
65   =================================================================================
66   -->
67   <Target Name="VSTest" >
68     <CallTarget Condition="'$(VSTestNoBuild)' != 'true'" Targets="BuildProject" />
69     <CallTarget Targets="SetVSTestInnerTarget" />
70     <CallTarget Targets="DispatchToInnerBuildsWithVSTestTarget" />
71   </Target>
72
73   <Target Name="BuildProject">
74     <Microsoft.TestPlatform.Build.Tasks.BuildLogTask BuildStarted="True" />
75     <CallTarget Targets="Build" />
76     <Microsoft.TestPlatform.Build.Tasks.BuildLogTask />
77   </Target>
78
79   <Target Name="SetVSTestInnerTarget" Returns="@(InnerOutput)">
80     <PropertyGroup  Condition="'$(InnerVSTestTargets)' == ''">
81       <InnerVSTestTargets>VSTest</InnerVSTestTargets>
82     </PropertyGroup>
83   </Target>
84 </Project>