Skip to content

Commit 0e7d013

Browse files
committed
Incremental replacement of base
1 parent 7c5dafb commit 0e7d013

File tree

9 files changed

+170
-59
lines changed

9 files changed

+170
-59
lines changed

AltCover.Base/AltCover.Base.csproj

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.0</TargetFramework>
5+
<RootNamespace>AltCover</RootNamespace>
6+
<AssemblyName>AltCover.Base</AssemblyName>
7+
<GlobalDefineConstants>RUNNER</GlobalDefineConstants>
8+
</PropertyGroup>
9+
10+
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
11+
<DefineConstants>TRACE;DEBUG;CODE_ANALYSIS;$(GlobalDefineConstants)</DefineConstants>
12+
</PropertyGroup>
13+
<PropertyGroup Condition="'$(Configuration)'=='Release'">
14+
<DefineConstants>TRACE;$(GlobalDefineConstants)</DefineConstants>
15+
</PropertyGroup>
16+
17+
<ItemGroup>
18+
<Compile Include="..\_Generated\VisibleToTest.cs" Link="VisibleToTest.cs" />
19+
<Compile Include="..\AltCover.Recorder\Base.cs" Link="Base.cs" />
20+
<None Include="..\AltCover.Recorder\Base.fs" Link="Base.fs" />
21+
</ItemGroup>
22+
23+
<ItemGroup>
24+
<PackageReference Include="Microsoft.SourceLink.GitHub">
25+
<PrivateAssets>all</PrivateAssets>
26+
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
27+
</PackageReference>
28+
<PackageReference Include="Mono.Cecil" Condition="'$(LocalCecil)' != 'true'" />
29+
<Reference Include="Mono.Cecil" Condition="'$(LocalCecil)' == 'true'">
30+
<HintPath>..\ThirdParty\cecil\Mono.Cecil.dll</HintPath>
31+
</Reference>
32+
<Reference Include="Mono.Cecil.Rocks" Condition="'$(LocalCecil)' == 'true'">
33+
<HintPath>..\ThirdParty\cecil\Mono.Cecil.Rocks.dll</HintPath>
34+
</Reference>
35+
<Reference Include="Mono.Cecil.Mdb" Condition="'$(LocalCecil)' == 'true'">
36+
<HintPath>..\ThirdParty\cecil\Mono.Cecil.Mdb.dll</HintPath>
37+
</Reference>
38+
<Reference Include="Mono.Cecil.Pdb" Condition="'$(LocalCecil)' == 'true'">
39+
<HintPath>..\ThirdParty\cecil\Mono.Cecil.Pdb.dll</HintPath>
40+
</Reference>
41+
<PackageReference Include="System.IO.Compression" />
42+
</ItemGroup>
43+
44+
<ItemGroup>
45+
<Reference Include="Manatee.Json">
46+
<HintPath>..\ThirdParty\Manatee.Json.dll</HintPath>
47+
<!-- Last static linkable version; the local version of [Nullable] kills later version linkage -->
48+
<!-- PackageReference Include="Manatee.Json" Version="11.0.4" / -->
49+
<!-- Last official version; moved to ThirdParty; see https://github.com/gregsdennis/Manatee.Json and https://graphqello.com/ -->
50+
<!-- PackageReference Include="Manatee.Json" Version="13.0.5" / -->
51+
</Reference>
52+
</ItemGroup>
53+
54+
</Project>

AltCover.Base/AssemblyInfo.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System;
2+
using System.Runtime.CompilerServices;
3+
using System.Runtime.InteropServices;
4+
5+
[assembly: InternalsVisibleTo("AltCover.Engine, PublicKey=0024000004800000940000000602000000240000525341310004000001000100916443A2EE1D294E8CFA7666FB3F512D998D7CEAC4909E35EDB2AC1E104DE68890A93716D1D1931F7228AAC0523CACF50FD82CDB4CCF4FF4BF0DED95E3A383F4F371E3B82C45502CE74D7D572583495208C1905E0F1E8A3CCE66C4C75E4CA32E9A8F8DEE64E059C0DC0266E8D2CB6D7EBD464B47E062F80B63D390E389217FB7")]
6+
[assembly: InternalsVisibleTo("AltCover.PowerShell, PublicKey=0024000004800000940000000602000000240000525341310004000001000100916443A2EE1D294E8CFA7666FB3F512D998D7CEAC4909E35EDB2AC1E104DE68890A93716D1D1931F7228AAC0523CACF50FD82CDB4CCF4FF4BF0DED95E3A383F4F371E3B82C45502CE74D7D572583495208C1905E0F1E8A3CCE66C4C75E4CA32E9A8F8DEE64E059C0DC0266E8D2CB6D7EBD464B47E062F80B63D390E389217FB7")]
7+
[assembly: InternalsVisibleTo("AltCover.Toolkit, PublicKey=0024000004800000940000000602000000240000525341310004000001000100916443A2EE1D294E8CFA7666FB3F512D998D7CEAC4909E35EDB2AC1E104DE68890A93716D1D1931F7228AAC0523CACF50FD82CDB4CCF4FF4BF0DED95E3A383F4F371E3B82C45502CE74D7D572583495208C1905E0F1E8A3CCE66C4C75E4CA32E9A8F8DEE64E059C0DC0266E8D2CB6D7EBD464B47E062F80B63D390E389217FB7")]
8+
[assembly: InternalsVisibleTo("AltCover, PublicKey=0024000004800000940000000602000000240000525341310004000001000100916443A2EE1D294E8CFA7666FB3F512D998D7CEAC4909E35EDB2AC1E104DE68890A93716D1D1931F7228AAC0523CACF50FD82CDB4CCF4FF4BF0DED95E3A383F4F371E3B82C45502CE74D7D572583495208C1905E0F1E8A3CCE66C4C75E4CA32E9A8F8DEE64E059C0DC0266E8D2CB6D7EBD464B47E062F80B63D390E389217FB7")]
9+
#if DEBUG
10+
// Self-test signing key
11+
[assembly: InternalsVisibleTo("AltCover.Engine, PublicKey=002400000480000094000000060200000024000052534131000400000100010041C08339BC8FE3A8B847E3EC38CB1BB31A9B39855347761BAB7AC04E726FFB227B147DF92DE5C3D8BCE3B7CFC7C9AC8110AF2E22F5E35D9CB0EBF47C36890DF617BD83E211002A1979DAB26CC18743DE674CE6F34ABAC834F597364BC5598C133F192596FC2161A832A9BBD33835DBB44F3B924A6F736BE6217ECE42889ABBCF")]
12+
[assembly: InternalsVisibleTo("AltCover.PowerShell, PublicKey=002400000480000094000000060200000024000052534131000400000100010041C08339BC8FE3A8B847E3EC38CB1BB31A9B39855347761BAB7AC04E726FFB227B147DF92DE5C3D8BCE3B7CFC7C9AC8110AF2E22F5E35D9CB0EBF47C36890DF617BD83E211002A1979DAB26CC18743DE674CE6F34ABAC834F597364BC5598C133F192596FC2161A832A9BBD33835DBB44F3B924A6F736BE6217ECE42889ABBCF")]
13+
[assembly: InternalsVisibleTo("AltCover.Toolkit, PublicKey=002400000480000094000000060200000024000052534131000400000100010041C08339BC8FE3A8B847E3EC38CB1BB31A9B39855347761BAB7AC04E726FFB227B147DF92DE5C3D8BCE3B7CFC7C9AC8110AF2E22F5E35D9CB0EBF47C36890DF617BD83E211002A1979DAB26CC18743DE674CE6F34ABAC834F597364BC5598C133F192596FC2161A832A9BBD33835DBB44F3B924A6F736BE6217ECE42889ABBCF")]
14+
[assembly: InternalsVisibleTo("AltCover, PublicKey=002400000480000094000000060200000024000052534131000400000100010041C08339BC8FE3A8B847E3EC38CB1BB31A9B39855347761BAB7AC04E726FFB227B147DF92DE5C3D8BCE3B7CFC7C9AC8110AF2E22F5E35D9CB0EBF47C36890DF617BD83E211002A1979DAB26CC18743DE674CE6F34ABAC834F597364BC5598C133F192596FC2161A832A9BBD33835DBB44F3B924A6F736BE6217ECE42889ABBCF")]
15+
#endif
16+
[assembly: CLSCompliant(true)]
17+
[assembly: ComVisible(false)]
18+
[assembly: System.Resources.NeutralResourcesLanguage("en-GB")]

AltCover.Engine/AltCover.Engine.fsproj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</PropertyGroup>
1313
<PropertyGroup Condition="'$(Configuration)'=='Release'">
1414
<DefineConstants>TRACE;$(GlobalDefineConstants)</DefineConstants>
15-
<!-- OtherFlags>- -keyfile:$(SolutionDir)Build\Infrastructure.snk - -staticlink:Manatee.Json</OtherFlags -->
15+
<OtherFlags>--staticlink:AltCover.Base</OtherFlags>
1616
</PropertyGroup>
1717

1818
<ItemGroup>
@@ -121,6 +121,10 @@
121121
<AbstractFs Include="$(ProjectDir)Abstract.fs" />
122122
</ItemGroup>
123123

124+
<ItemGroup>
125+
<ProjectReference Include="..\AltCover.Base\AltCover.Base.csproj" />
126+
</ItemGroup>
127+
124128
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
125129
<Copy SourceFiles="@(AbstractFsi)" DestinationFiles="@(AbstractFs)" SkipUnchangedFiles="true" />
126130
</Target>

AltCover.Engine/Runner.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,7 +1031,7 @@ module internal Runner =
10311031
| Tag.Both ->
10321032
let time = formatter.ReadInt64()
10331033
let call = formatter.ReadInt32()
1034-
Both { Time = time; Call = call }
1034+
Both (Pair.Create(time, call))
10351035
| Tag.Table ->
10361036
let t =
10371037
Dictionary<string, Dictionary<int, PointVisit>>()
@@ -1075,7 +1075,7 @@ module internal Runner =
10751075
pv.Tracks.Add(
10761076
let time = formatter.ReadInt64()
10771077
let call = formatter.ReadInt32()
1078-
Both { Time = time; Call = call }
1078+
Both (Pair.Create(time, call))
10791079
)
10801080

10811081
tracking ()

AltCover.Recorder/Base.cs

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#if RUNNER
2+
3+
namespace AltCover
4+
#else
5+
namespace AltCover.Recorder
6+
#endif
7+
{
8+
using System;
9+
using System.Collections.Generic;
10+
using System.Diagnostics.CodeAnalysis;
11+
using System.Globalization;
12+
using System.IO;
13+
using System.Xml;
14+
15+
#if !RUNNER
16+
using ICSharpCode.SharpZipLib.Zip;
17+
18+
[AttributeUsage(AttributeTargets.All, Inherited = false, AllowMultiple = false)]
19+
[SuppressMessage("Gendarme.Rules.Performance",
20+
"AvoidUninstantiatedInternalClassesRule",
21+
Justification = "Looks like a bug, not detecting its use")]
22+
internal sealed class ExcludeFromCodeCoverageAttribute : Attribute
23+
{}
24+
#endif
25+
26+
[Flags]
27+
[SuppressMessage("Gendarme.Rules.Design",
28+
"FlagsShouldNotDefineAZeroValueRule",
29+
Justification = "Zero is meaningful")]
30+
[SuppressMessage("Gendarme.Rules.Naming",
31+
"UsePluralNameInEnumFlagsRule",
32+
Justification = "Not meaningful to do so")]
33+
internal enum ReportFormat
34+
{
35+
NCover = 0,
36+
OpenCover = 1,
37+
NativeJson = 2,
38+
TrackMask = 63,
39+
WithTracking = 64,
40+
ZipMask = 127,
41+
Zipped = 128,
42+
};
43+
44+
internal enum Sampling
45+
{
46+
All = 0,
47+
Single = 1,
48+
};
49+
50+
// TODO isolate where
51+
[SuppressMessage("Gendarme.Rules.Performance",
52+
"AvoidUninstantiatedInternalClassesRule",
53+
Justification = "Used as pattern match and compiled away")]
54+
internal enum Tag
55+
{
56+
Null = 0,
57+
Time = 1,
58+
Call = 2,
59+
Both = 3,
60+
Table = 4,
61+
}
62+
63+
[ExcludeFromCodeCoverage]
64+
internal struct Pair
65+
{
66+
public long Time;
67+
public int Call;
68+
69+
public static Pair Create(long time, int call)
70+
{
71+
return new Pair { Time = time, Call = call };
72+
}
73+
}
74+
}

AltCover.Recorder/Base.fs

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -11,55 +11,6 @@ open System.Globalization
1111
open System.IO
1212
open System.Xml
1313

14-
[<Flags>]
15-
[<SuppressMessage("Gendarme.Rules.Design",
16-
"FlagsShouldNotDefineAZeroValueRule",
17-
Justification = "Zero is meaningful")>]
18-
[<SuppressMessage("Gendarme.Rules.Naming",
19-
"UsePluralNameInEnumFlagsRule",
20-
Justification = "Not meaningful to do so")>]
21-
type internal ReportFormat =
22-
| NCover = 0
23-
| OpenCover = 1
24-
| NativeJson = 2
25-
| TrackMask = 63
26-
| WithTracking = 64
27-
| ZipMask = 127
28-
| Zipped = 128
29-
30-
#if !RUNNER
31-
open ICSharpCode.SharpZipLib.Zip
32-
33-
[<AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)>]
34-
[<Sealed>]
35-
[<SuppressMessage("Gendarme.Rules.Performance",
36-
"AvoidUninstantiatedInternalClassesRule",
37-
Justification = "Looks like a bug, not detecting its use")>]
38-
type internal ExcludeFromCodeCoverageAttribute() =
39-
inherit Attribute()
40-
#endif
41-
42-
type internal Sampling =
43-
| All = 0
44-
| Single = 1
45-
46-
// TODO isolate where
47-
#if RUNNER
48-
[<SuppressMessage("Gendarme.Rules.Performance",
49-
"AvoidUninstantiatedInternalClassesRule",
50-
Justification = "Used as pattern match and compiled away")>]
51-
#endif
52-
type internal Tag =
53-
| Null = 0
54-
| Time = 1
55-
| Call = 2
56-
| Both = 3
57-
| Table = 4
58-
59-
[<ExcludeFromCodeCoverage>]
60-
[<NoComparison>]
61-
type internal Pair = { Time: int64; Call: int }
62-
6314
[<ExcludeFromCodeCoverage>]
6415
[<NoComparison>]
6516
type internal Track =

AltCover.Tests/Runner.Tests.fs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2690,7 +2690,7 @@ module AltCoverRunnerTests =
26902690
[| Null
26912691
Call 0
26922692
Time t
2693-
Both { Time = t; Call = 0 } |]
2693+
Both (Pair.Create(t, 0)) |]
26942694

26952695
let t0 = tracks 0L
26962696

@@ -2988,7 +2988,7 @@ module AltCoverRunnerTests =
29882988
[| Null
29892989
Call 0
29902990
Time t
2991-
Both { Time = t; Call = 0 } |]
2991+
Both (Pair.Create(t, 0)) |]
29922992

29932993
let t0 = tracks 0L
29942994

@@ -3260,7 +3260,7 @@ module AltCoverRunnerTests =
32603260
[| Null
32613261
Call 0
32623262
Time t
3263-
Both { Time = t; Call = 0 } |]
3263+
Both (Pair.Create(t, 0)) |]
32643264

32653265
let t0 = tracks 0L
32663266

@@ -3578,7 +3578,7 @@ module AltCoverRunnerTests =
35783578
[| Null
35793579
Call 0
35803580
Time t
3581-
Both { Time = t; Call = 0 } |]
3581+
Both (Pair.Create(t, 0)) |]
35823582

35833583
let t0 = tracks 0L
35843584

@@ -3900,7 +3900,7 @@ module AltCoverRunnerTests =
39003900
[ Null
39013901
Call 17
39023902
Time 23L
3903-
Both { Time = 5L; Call = 42 }
3903+
Both (Pair.Create(5, 42))
39043904
Time 42L
39053905
Call 5 ]
39063906

@@ -4012,7 +4012,7 @@ module AltCoverRunnerTests =
40124012
let d =
40134013
Dictionary<int, int64 * Track list>()
40144014

4015-
d.Add(4, (0L, [ Both { Time = 5L; Call = 42 } ]))
4015+
d.Add(4, (0L, [ Both (Pair.Create(5, 42)) ]))
40164016

40174017
let e =
40184018
Dictionary<int, int64 * Track list>()
@@ -4062,7 +4062,7 @@ module AltCoverRunnerTests =
40624062
[ Null
40634063
Call 17
40644064
Time 23L
4065-
Both { Time = 5L; Call = 42 }
4065+
Both (Pair.Create(5, 42))
40664066
Time 42L
40674067
Time 5L ]
40684068

AltCover.sln

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ MinimumVisualStudioVersion = 15.0.26124.0
55
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "AltCover.Engine", "AltCover.Engine\AltCover.Engine.fsproj", "{26C01B27-9A3E-4460-BB43-5383C8E818FB}"
66
ProjectSection(ProjectDependencies) = postProject
77
{5D4A7DFE-688D-4D1B-804C-A06743FFC4BC} = {5D4A7DFE-688D-4D1B-804C-A06743FFC4BC}
8+
{79E50E5A-381F-4C9A-8F1D-3603CE9247BB} = {79E50E5A-381F-4C9A-8F1D-3603CE9247BB}
89
EndProjectSection
910
EndProject
1011
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "AltCover.PowerShell", "AltCover.PowerShell\AltCover.PowerShell.fsproj", "{208B8925-5626-4E5D-A00B-6A993D850524}"
@@ -157,6 +158,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AltCover.Recorder2.Tests",
157158
{5D4A7DFE-688D-4D1B-804C-A06743FFC4BC} = {5D4A7DFE-688D-4D1B-804C-A06743FFC4BC}
158159
EndProjectSection
159160
EndProject
161+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AltCover.Base", "AltCover.Base\AltCover.Base.csproj", "{79E50E5A-381F-4C9A-8F1D-3603CE9247BB}"
162+
EndProject
160163
Global
161164
GlobalSection(SolutionConfigurationPlatforms) = preSolution
162165
Debug|Any CPU = Debug|Any CPU
@@ -389,6 +392,12 @@ Global
389392
{2079F388-81AE-4A76-9428-3C8D7F86825B}.Debug|x86.ActiveCfg = Debug|Any CPU
390393
{2079F388-81AE-4A76-9428-3C8D7F86825B}.Release|Any CPU.ActiveCfg = Release|Any CPU
391394
{2079F388-81AE-4A76-9428-3C8D7F86825B}.Release|x86.ActiveCfg = Release|Any CPU
395+
{79E50E5A-381F-4C9A-8F1D-3603CE9247BB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
396+
{79E50E5A-381F-4C9A-8F1D-3603CE9247BB}.Debug|Any CPU.Build.0 = Debug|Any CPU
397+
{79E50E5A-381F-4C9A-8F1D-3603CE9247BB}.Debug|x86.ActiveCfg = Debug|Any CPU
398+
{79E50E5A-381F-4C9A-8F1D-3603CE9247BB}.Release|Any CPU.ActiveCfg = Release|Any CPU
399+
{79E50E5A-381F-4C9A-8F1D-3603CE9247BB}.Release|Any CPU.Build.0 = Release|Any CPU
400+
{79E50E5A-381F-4C9A-8F1D-3603CE9247BB}.Release|x86.ActiveCfg = Release|Any CPU
392401
EndGlobalSection
393402
GlobalSection(SolutionProperties) = preSolution
394403
HideSolutionNode = FALSE

Build/actions.fs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ using System.Runtime.CompilerServices;
124124
125125
#if DEBUG
126126
[assembly: AssemblyConfiguration("Debug {0}")]
127+
[assembly: InternalsVisibleTo("AltCover.Tests, PublicKey={1}")]
127128
[assembly: InternalsVisibleTo("AltCover.Monitor.Tests, PublicKey={1}")]
128129
[assembly: InternalsVisibleTo("AltCover.Recorder.Tests, PublicKey={1}")]
129130
[assembly: InternalsVisibleTo("AltCover.Recorder2.Tests, PublicKey={1}")]

0 commit comments

Comments
 (0)