Skip to content

Commit 4447ecc

Browse files
Add support for deterministic build for collectors driver (#802)
Add support for deterministic build for collectors driver
1 parent 471b847 commit 4447ecc

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

src/coverlet.collector/build/netstandard1.0/coverlet.collector.targets

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and
1212
<Target Name="CopyCoverletDataCollectorFiles" AfterTargets="ComputeFilesToPublish">
1313
<ItemGroup>
1414
<CoverletDataCollectorFiles Include="$(MSBuildThisFileDirectory)\*.*" />
15-
</ItemGroup>
15+
</ItemGroup>
1616
<Copy SourceFiles="@(CoverletDataCollectorFiles)" DestinationFolder="$(PublishDir)%(RecursiveDir)" />
1717

1818
</Target>
@@ -21,4 +21,26 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and
2121
<VSTestTestAdapterPath>$(VSTestTestAdapterPath);$(MSBuildThisFileDirectory)</VSTestTestAdapterPath>
2222
</PropertyGroup>
2323
</Target>
24+
25+
<Target Name="ReferencedPathMaps" BeforeTargets="CoreCompile" >
26+
<MSBuild Projects="@(ProjectReference->'%(FullPath)')"
27+
Targets="CoverletGetPathMap" SkipNonexistentTargets="true">
28+
<Output TaskParameter="TargetOutputs"
29+
ItemName="_LocalTopLevelSourceRoot" />
30+
</MSBuild>
31+
<ItemGroup>
32+
<_byProject Include="@(_LocalTopLevelSourceRoot->'%(MSBuildSourceProjectFile)')" OriginalPath="%(Identity)" />
33+
<_mapping Include="@(_byProject->'%(Identity)|%(OriginalPath)=%(MappedPath)')" />
34+
</ItemGroup>
35+
<PropertyGroup>
36+
<_sourceRootMappingFilePath>$(OutputPath)CoverletSourceRootsMapping</_sourceRootMappingFilePath>
37+
</PropertyGroup>
38+
<WriteLinesToFile File="$(_sourceRootMappingFilePath)" Lines="@(_mapping)"
39+
Overwrite="true" Encoding="Unicode"
40+
Condition="'@(_mapping)'!=''"
41+
WriteOnlyWhenDifferent="true" />
42+
<ItemGroup>
43+
<FileWrites Include="$(_sourceRootMappingFilePath)" Condition="'@(_mapping)'!=''" />
44+
</ItemGroup>
45+
</Target>
2446
</Project>

0 commit comments

Comments
 (0)