summaryrefslogtreecommitdiff
path: root/tests/helix.targets
blob: 16acf01ca4108b2c78d618a1dd07f7415ff0ac8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <PropertyGroup>
      <PackageTestRuntimeFolder>$(PackagesDir)test.Microsoft.NETCore.Runtime.CoreClr\1.1.1</PackageTestRuntimeFolder>
  </PropertyGroup>

  <ItemGroup>
    <!-- TODO This should come from some package -->
    <CoreRootFiles Include="$(CORE_ROOT)\crossgen.exe" /> 
    <CoreRootFiles Include="$(CORE_ROOT)\ildasm.exe" /> 
    <CoreRootFiles Include="$(CORE_ROOT)\ilasm.exe" /> 

    <!-- TODO these files should get copied to core_root but does not as they are xunit files. Using temporary workaround for now -->
    <CoreRootFiles Include="$(PackagesDir)Microsoft.DotNet.xunit.performance\1.0.0-alpha-build0035\lib\dotnet\xunit.performance.core.dll" />
    <CoreRootFiles Include="$(PackagesDir)xunit.extensibility.core\2.1.0\lib\dotnet\xunit.core.dll" />
  </ItemGroup>

  <!-- replace *.lock.json to be that of actual tests than XunitWrapper -->
  <Target Name="ReplaceProjectLockJson"
          BeforeTargets="CopyTestToTestDirectory">
    <PropertyGroup>
      <ProjectLockJson></ProjectLockJson>
      <TestRuntimeProjectLockJson></TestRuntimeProjectLockJson>
    </PropertyGroup>
    <ItemGroup>
      <TestNugetProjectLockFile Include="$(SourceDir)$(Category)\**\project.lock.json"/>
      <TestNugetProjectLockFile Include="$(TestRuntimeProjectLockJson)"/>
    </ItemGroup>
  </Target>

  <Target Name="CopyProductInPackagesFolder"
          BeforeTargets="CopyTestToTestDirectory">

    <Copy
      SourceFiles="@(CoreRootFiles)"
      DestinationFolder="$(PackageTestRuntimeFolder)"
      SkipUnchangedFiles="false"
      OverwriteReadOnlyFiles="$(OverwriteReadOnlyFiles)"
      Retries="$(CopyRetryCount)"
      RetryDelayMilliseconds="$(CopyRetryDelayMilliseconds)"
      UseHardlinksIfPossible="$(CreateHardLinksForCopyFilesToOutputDirectoryIfPossible)">
    </Copy>
 
  </Target>


  <Target Name="AddFilesToAssemblyList" 
          BeforeTargets="CreateAssemblyListTxt">

    <ItemGroup>

      <ToReplace Include="$(PackageTestRuntimeFolder)\*" />

      <!-- In helix xunit tests are run using xunit.console.exe instead of msbuild xunitrunner.
           This dependency should ideally be added in some project.json. But in the package the assemblies are present in tools folder.
           Assemblies in tools folder are not resolved during restore. Therefore forcing addition direclty. -->
      <XunitConsoleExe Include="$(PackagesDir)xunit.runner.console\**\xunit.console.exe" />
      <XunitConsoleExe Include="$(PackagesDir)xunit.runner.console\**\xunit.runner.utility.desktop.dll" />

      <ToRemove Include="@(_TestCopyLocalByFileNameWithoutDuplicates)" Condition="'%(_TestCopyLocalByFileNameWithoutDuplicates.Filename)' == 'xunit.performance.core'"/>
      <ToRemove Include="@(_TestCopyLocalByFileNameWithoutDuplicates)" Condition="'%(_TestCopyLocalByFileNameWithoutDuplicates.Filename)' == 'xunit.core'"/>

      <_TestCopyLocalByFileNameWithoutDuplicates Remove="@(ToRemove)" />

      <_TestCopyLocalByFileNameWithoutDuplicates Include="@(ToReplace)">
        <NugetPackageId>test.Microsoft.NETCore.Runtime.CoreClr</NugetPackageId>
        <SourcePath>%(ToReplace.Identity)</SourcePath>
      </_TestCopyLocalByFileNameWithoutDuplicates>

      <_TestCopyLocalByFileNameWithoutDuplicates Include="@(XunitConsoleExe)">
        <NugetPackageId>xunit.runner.console</NugetPackageId>
        <SourcePath>%(XunitConsoleExe.Identity)</SourcePath>
      </_TestCopyLocalByFileNameWithoutDuplicates>
    </ItemGroup>
  </Target>

</Project>