Skip to content

Commit

Permalink
Reinstate the F#/net20 recorder based on issue #227
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveGilham committed Jul 23, 2024
1 parent 10f4d9a commit 1e6060e
Show file tree
Hide file tree
Showing 42 changed files with 1,190 additions and 3,162 deletions.
29 changes: 0 additions & 29 deletions AltCover.Async/AltCover.Async.csproj

This file was deleted.

31 changes: 31 additions & 0 deletions AltCover.Async/AltCover.Async.fsproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net46</TargetFrameworks>
<AssemblyName>AltCover.Async</AssemblyName>
<RootNamespace>AltCover.Recorder</RootNamespace>
<ContinuousIntegrationBuild>false</ContinuousIntegrationBuild>
<DeterministicSourcePaths>false</DeterministicSourcePaths>
<EnableDefaultEmbeddedResourceItems>false</EnableDefaultEmbeddedResourceItems>
<OtherFlags>--keyfile:$(InfrastructureKey)</OtherFlags>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DefineConstants>TRACE</DefineConstants>
<!-- OtherFlags>$(OtherFlags) - -standalone</OtherFlags -->
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<DefineConstants>TRACE;DEBUG;CODE_ANALYSIS</DefineConstants>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\_Generated\AssemblyVersion.fs" Link="AssemblyVersion.fs" />
<Compile Include="Library.fs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="FSharp.Compiler.Tools" />
<PackageReference Include="FSharp.Core" VersionOverride="4.1.18" />
</ItemGroup>
</Project>
59 changes: 0 additions & 59 deletions AltCover.Async/Instance.cs

This file was deleted.

55 changes: 0 additions & 55 deletions AltCover.Base/AltCover.Base.csproj

This file was deleted.

18 changes: 0 additions & 18 deletions AltCover.Base/AssemblyInfo.cs

This file was deleted.

2 changes: 1 addition & 1 deletion AltCover.DataCollector/DataCollector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private void Supervise()
RecorderInstance.ToList().ForEach(
i =>
{
var supervision = i.GetField("supervision",
var supervision = i.GetProperty("supervision",
BindingFlags.Static | BindingFlags.NonPublic);
if (supervision == null)
{
Expand Down
11 changes: 4 additions & 7 deletions AltCover.Engine/AltCover.Engine.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<DefineConstants>TRACE;$(GlobalDefineConstants)</DefineConstants>
<!-- OtherFlags>- -keyfile:$(SolutionDir)Build\Infrastructure.snk - -staticlink:Manatee.Json</OtherFlags -->
</PropertyGroup>

<ItemGroup>
Expand All @@ -25,7 +26,7 @@
<Compile Include="Output.fs" />
<Compile Include="Canonical.fs" />
<Compile Include="Augment.fs" />
<None Include="..\AltCover.Recorder\Base.fs" Link="Base.fs" />
<Compile Include="..\AltCover.Recorder\Base.fs" Link="Base.fs" />
<Compile Include="ProgramDatabase.fs" />
<Compile Include="Filter.fs" />
<Compile Include="Metadata.fs" />
Expand Down Expand Up @@ -66,10 +67,10 @@
<EmbeddedResource Include="..\Build\Recorder.snk">
<Link>Recorder.snk</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\_Repack\AltCover.Recorder.dll">
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\_Binaries\AltCover.Recorder\Release+AnyCPU\net20\AltCover.Recorder.dll">
<Link>AltCover.Recorder.net20.dll</Link>
</EmbeddedResource>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\_Repack\AltCover.Async.dll">
<EmbeddedResource Include="$(MSBuildThisFileDirectory)..\_Binaries\AltCover.Async\Release+AnyCPU\net46\AltCover.Async.dll">
<Link>AltCover.Async.net46.dll</Link>
</EmbeddedResource>
</ItemGroup>
Expand Down Expand Up @@ -120,10 +121,6 @@
<AbstractFs Include="$(ProjectDir)Abstract.fs" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\AltCover.Base\AltCover.Base.csproj" />
</ItemGroup>

<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Copy SourceFiles="@(AbstractFsi)" DestinationFiles="@(AbstractFs)" SkipUnchangedFiles="true" />
</Target>
Expand Down
14 changes: 8 additions & 6 deletions AltCover.Engine/Instrument.fs
Original file line number Diff line number Diff line change
Expand Up @@ -1209,7 +1209,7 @@ module internal Instrument =

let value =
calltrack.Properties
|> Seq.find (fun m -> m.Name == "Value")
|> Seq.find (fun m -> m.Name == "value")

let getValue = value.GetMethod

Expand All @@ -1222,7 +1222,7 @@ module internal Instrument =
GetValue = getValue
Instance =
calltrack.Methods
|> Seq.find (fun m -> m.Name == "Instance")
|> Seq.find (fun m -> m.Name == "instance")
Field = field
FieldType = field.FieldType :?> GenericInstanceType
Maker =
Expand Down Expand Up @@ -1336,7 +1336,7 @@ module internal Instrument =
let getterDef =
recorder.MainModule.GetTypes()
|> Seq.collect _.Methods
|> Seq.filter (fun m -> m.Name == "get_Modules")
|> Seq.filter (fun m -> m.Name == "get_modules")
|> Seq.head

let body = getterDef.Body
Expand All @@ -1363,13 +1363,15 @@ module internal Instrument =
[ worker.Create(OpCodes.Dup)
worker.Create(OpCodes.Ldc_I4, i)
worker.Create(OpCodes.Ldstr, k)
worker.Create(OpCodes.Stelem_Ref) ]
worker.Create(OpCodes.Stelem_Any, stringtype) ]

bulkInsertBefore worker head addElement true
|> ignore)

let ret = [ worker.Create OpCodes.Ret ]
bulkInsertBefore worker head ret true |> ignore
let store =
[ worker.Create(OpCodes.Stsfld, head.Operand :?> FieldReference) ]

bulkInsertBefore worker head store true |> ignore

let recorderFileName =
(extractName state.RecordingAssembly) + ".dll"
Expand Down
4 changes: 2 additions & 2 deletions AltCover.Engine/PostProcess.fs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ module internal PostProcess =
|> Seq.head

let vc =
(lookUpVisitsByToken token dict).Total
(lookUpVisitsByToken token dict).Total()

mp
|> Seq.iter (fun m ->
Expand Down Expand Up @@ -226,7 +226,7 @@ module internal PostProcess =
tracks.[index].Tracks
|> Seq.map (fun t ->
match t with
| :? Time as tx -> sprintf "%d" tx.Value
| Time tx -> sprintf "%d" tx
| _ -> String.Empty) // never happens
|> Seq.filter (fun s -> s.Length > 0)

Expand Down
Loading

0 comments on commit 1e6060e

Please sign in to comment.