:: Check presence of VS
if defined VS%__VSProductVersion%COMNTOOLS goto CheckMSbuild
-echo InVisual Studio 2013+ (Community is free) is a pre-requisite to build this repository.
+echo Visual Studio 2013+ (Community is free) is a pre-requisite to build this repository.
exit /b 1
:CheckMSBuild
if not exist %_msbuildexe% set _msbuildexe="%ProgramFiles%\MSBuild\14.0\Bin\MSBuild.exe"
if not exist %_msbuildexe% echo Error: Could not find MSBuild.exe. Please see https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/developer-guide.md for build instructions. && exit /b 1
-:: Set the environment for the build- Vs cmd prompt
+:: Set the environment for the build- VS cmd prompt
call "!VS%__VSProductVersion%COMNTOOLS!\VsDevCmd.bat"
if not defined VSINSTALLDIR echo Error: runtest.cmd should be run from a Visual Studio Command Prompt. Please see https://github.com/dotnet/coreclr/blob/master/Documentation/project-docs/developer-guide.md for build instructions. && exit /b 1
if not defined __TestWorkingDir set __TestWorkingDir=%__ProjectFilesDir%..\bin\tests\%__BuildOS%.%__BuildArch%.%__BuildType%
if not defined __LogsDir set __LogsDir=%__ProjectFilesDir%..\bin\Logs
-:: Default global test environmet variables
+:: Default global test environment variables
if not defined XunitTestBinBase set XunitTestBinBase=%__TestWorkingDir%\
if not defined XunitTestReportDirBase set XunitTestReportDirBase=%XunitTestBinBase%\Reports\
if defined Core_Root goto :CheckTestEnv
echo BuildType can be: Debug, Release
echo SkipWrapperGeneration- Optional parameter - this will run the same set of tests as the last time it was run
echo Exclude- Optional parameter - this will exclude individual tests from running, specified by ExcludeList ItemGroup in an .targets file.
-echo TestEnv- Optional parameter - this will run a custom script to set custom test envirommnent settings.
+echo TestEnv- Optional parameter - this will run a custom script to set custom test environment settings.
echo VSVersion- optional argument to use VS2013 or VS2015 (default VS2015)
echo CORE_ROOT The path to the runtime
exit /b 1
<DisabledTestDir Include="Common" />
<_SkipTestDir Include="@(DisabledTestDir)" />
</ItemGroup>
-
- <Target Name="FindCmdDirectories"
- DependsOnTargets="GetListOfTestCmds"
- >
+ <Target Name="FindCmdDirectories" DependsOnTargets="GetListOfTestCmds">
<Error Condition="!Exists('$(XunitTestBinBase)')"
- Text="$(XunitTestBinBase) does not exists. Please run buildtest.cmd from the (repo root)\tests at least once to get the tests built." />
- <ItemGroup>
-
- <AllTestDirsNonCanonicalPaths Include="$([System.IO.Directory]::GetDirectories(`$(XunitTestBinBase)`))" />
+ Text="$(XunitTestBinBase) does not exist. Please run buildtest.cmd from the (repo root)\tests at least once to get the tests built." />
+
+ <ItemGroup>
+ <AllTestDirsNonCanonicalPaths Include="$([System.IO.Directory]::GetDirectories(`$(XunitTestBinBase)`))" />
<AllTestDirsPaths Include="@(AllTestDirsNonCanonicalPaths)" />
<AllTestDirsPaths Include="@(AllTestDirsNonCanonicalPaths)" >
<Path>$([System.IO.Path]::GetFullPath(%(Identity)))</Path>
</AllTestDirsPaths>
-
<NonExcludedTestDirectories Include="@(AllTestDirsPaths -> '%(Path)')" Exclude="@(_SkipTestDir -> '$(XunitTestBinBase)%(Identity)')">
<Path>$([System.IO.Path]::GetFullPath(%(AllRunnableTestPaths.Identity)))</Path>
</NonExcludedTestDirectories>
-
<TestDirectoriesWithDup Include="@(NonExcludedTestDirectories -> '%(Identity)')" Condition="$([System.String]::new('%(Path)').StartsWith('%(Identity)'))" />
</ItemGroup>
- <RemoveDuplicates
- Inputs="@(TestDirectoriesWithDup)">
- <Output
- TaskParameter="Filtered"
- ItemName="TestDirectories"/>
- </RemoveDuplicates>
+ <RemoveDuplicates Inputs="@(TestDirectoriesWithDup)">
+ <Output
+ TaskParameter="Filtered"
+ ItemName="TestDirectories"/>
+ </RemoveDuplicates>
+
</Target>
-
<Import Project="$(__Exclude)" Condition="'$(__Exclude)' != '' AND '$(XunitTestBinBase)' != ''" />
- <Target Name="CreateXunitWrapper"
- DependsOnTargets="CreateXunitFacts">
+ <Target Name="CreateXunitWrapper" DependsOnTargets="CreateXunitFacts">
<PropertyGroup>
<_XunitWrapperGen >
<!-- <Exec Command="md" -->
<MakeDir Directories="$(XunitWrapperGeneratedCSDirBase)$(Category)"/>
+
<!-- Write the file -->
<WriteLinesToFile
File="$(XunitWrapperSrcDir)\$(XunitWrapper).cs"
Lines="$(_XunitWrapperGen)"
Overwrite="true" />
+
<!-- Write the file -->
<WriteLinesToFile
File="$(XunitWrapperSrcDir)\$(XunitWrapper).csproj"
Lines="$(XunitWrapperGenPackConfig)"
Overwrite="true" />
- <MSBuild Projects="$(XunitWrapperSrcDir)\$(XunitWrapper).csproj" />
+ <MSBuild Projects="$(XunitWrapperSrcDir)\$(XunitWrapper).csproj" />
+
</Target>
+
<Target Name="CreateXunitFacts">
<!-- NOTE! semicolons must be escaped with %3B boooo -->
-
+
<PropertyGroup>
<_CMDDIR_Parent>$([System.IO.Path]::GetDirectoryName($(_CMDDIR)))</_CMDDIR_Parent>
<Category>$([System.String]::Copy('$(_CMDDIR)').Replace($(_CMDDIR_Parent)\,''))</Category>
]]>
</_XunitProlog>
- <_XunitEpilog Condition=" '$(_XunitEpilog)'=='' ">
+
+ <_XunitEpilog Condition=" '$(_XunitEpilog)'=='' ">
<![CDATA[
}
]]>
- </_XunitEpilog>
+ </_XunitEpilog>
</PropertyGroup>
<ItemGroup>
- <CanonicalExcludeList Include="%(ExcludeList.FullPath)" Condition="'$(__Exclude)' != ''"/>
+ <CanonicalExcludeList Include="%(ExcludeList.FullPath)" Condition="'$(__Exclude)' != ''"/>
</ItemGroup>
<ItemGroup>
- <AllCMDsPresent Include="$(_CMDDIR)\**\*.cmd" />
- <AllCMDExcludeFilter Include="@(CanonicalExcludeList)" Condition="'$(__Exclude)' != ''"/>
- <AllCMDs Include="@(AllCMDsPresent)" Exclude="@(AllCMDExcludeFilter)"/>
-
+ <AllCMDsPresent Include="$(_CMDDIR)\**\*.cmd" />
+ <AllCMDExcludeFilter Include="@(CanonicalExcludeList)" Condition="'$(__Exclude)' != ''"/>
+ <AllCMDs Include="@(AllCMDsPresent)" Exclude="@(AllCMDExcludeFilter)"/>
+
<AllCommamds Include="@(AllCMDs)" >
<_FactName>$([System.String]::Copy('%(AllCMDs.FullPath)').Replace("$(_CMDDIR)",'').Replace(".","_"))</_FactName>
}
}
-
+
]]>
</_XunitFact>
</Target>
- <Target Name="CreateAllWrappers"
- DependsOnTargets="GetListOfTestCmds;FindCmdDirectories">
-
+ <Target Name="CreateAllWrappers" DependsOnTargets="GetListOfTestCmds;FindCmdDirectories">
<MSBuild Projects="$(MSBuildProjectFile)" Targets="CreateXunitWrapper" Properties="_CMDDIR=%(TestDirectories.Identity)" />
</Target>
<AllRunnableTestPaths Include="$(XunitTestBinBase)\**\*.cmd" />
</ItemGroup>
</Target>
-
+
<Import Project="tests.targets" />
<Import Project="publishdependency.targets" />
-
+
<Target Name="Build">
<!-- Default for building -->
<MSBuild Projects="$(MSBuildProjectFile)"
- Targets="CreateAllWrappers"
- Properties="_CMDDIR=%(TestDirectories.Identity)"
- Condition=" '$(NoBuild)'!='true' " />
-
+ Targets="CreateAllWrappers"
+ Properties="_CMDDIR=%(TestDirectories.Identity)"
+ Condition=" '$(NoBuild)'!='true' " />
+
<!-- Execution -->
-
+
<MSBuild Projects="$(MSBuildProjectFile)" Targets="CopyDependecyToCoreRoot"
Condition=" '$(NoRun)'!='true' "/>
-
+
<MSBuild Projects="$(MSBuildProjectFile)" Targets="RunTests"
Condition=" '$(NoRun)'!='true' "/>
</Target>
-
+
<Target Name="Clean">
<RemoveDir Condition=" '$(NoBuild)'!='true'" Directories="$(XunitWrapperGeneratedCSDirBase);$(XunitWrapperOutputIntermediatedDirBase)" ContinueOnError="WarnAndContinue" />
</Target>