Skip to content

Commit

Permalink
Merge branch 'develop/github/net8' into release/Habu
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveGilham committed Nov 14, 2023
2 parents 09a552c + 5811ccd commit f96f096
Show file tree
Hide file tree
Showing 85 changed files with 604 additions and 420 deletions.
4 changes: 2 additions & 2 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"dotnet-reportgenerator-globaltool": {
"version": "5.1.21",
"version": "5.1.26",
"commands": [
"reportgenerator"
]
Expand All @@ -15,7 +15,7 @@
]
},
"altcode.gendarme-tool": {
"version": "2023.1.22.12221",
"version": "2023.8.26.15512",
"commands": [
"gendarme"
]
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ jobs:
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.304'
dotnet-version: '8.0.100'
- name: Tools
run: dotnet tool restore
- name: Setup
Expand All @@ -58,12 +58,12 @@ jobs:
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0.304'
dotnet-version: '8.0.100'
- name: Tools
run: dotnet tool restore
- name: Setup
Expand Down
4 changes: 2 additions & 2 deletions AltCover.Api.Tests/AltCover.Api.Tests.fsproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net7.0;net472</TargetFrameworks>
<TargetFrameworks>net8.0;net472</TargetFrameworks>
<IsPackable>false</IsPackable>
<AssemblyName>AltCover.Api.Tests</AssemblyName>
<GenerateProgramFile>false</GenerateProgramFile>
Expand All @@ -12,7 +12,7 @@
</PropertyGroup>

<ItemGroup>
<EmbeddedResource Include="..\nupkg\build\netstandard2.0\AltCover.targets" Link="AltCover.targets" />
<EmbeddedResource Include="..\nupkg\build\AltCover.targets" Link="AltCover.targets" />
<EmbeddedResource Include="..\AltCover.Tests\CompressBoth.xml" Link="CompressBoth.xml" />
<EmbeddedResource Include="..\AltCover.Tests\Compressible.xml" Link="Compressible.xml" />
<EmbeddedResource Include="..\AltCover.Tests\CompressInterior.xml" Link="CompressInterior.xml" />
Expand Down
7 changes: 1 addition & 6 deletions AltCover.Api.Tests/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,6 @@ module ExpectoMain =
module UnitTestStub =
[<EntryPoint; System.Runtime.CompilerServices.CompilerGenerated>]
let unitTestStub argv =
let writeResults =
TestResults.writeNUnitSummary ("AltCover.Api.TestResults.xml", "AltCover.Api.Tests")

let config =
defaultConfig.appendSummaryHandler writeResults

runTestsWithArgs config argv ExpectoMain.tests
runTestsWithCLIArgs Seq.empty<CLIArguments> argv ExpectoMain.tests
#endif
10 changes: 5 additions & 5 deletions AltCover.Avalonia/AltCover.Avalonia11.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Avalonia" VersionOverride="11.0.0-preview4" />
<PackageReference Include="Avalonia.Desktop" VersionOverride="11.0.0-preview4" />
<PackageReference Include="Avalonia.Themes.Fluent" VersionOverride="11.0.0-preview4" />
<PackageReference Include="Avalonia.Themes.Simple" VersionOverride="11.0.0-preview4" />
<PackageReference Include="MessageBox.Avalonia" VersionOverride="2.3.1-prev2" />
<PackageReference Include="Avalonia" VersionOverride="11.0.5" />
<PackageReference Include="Avalonia.Desktop" VersionOverride="11.0.5" />
<PackageReference Include="Avalonia.Themes.Fluent" VersionOverride="11.0.5" />
<PackageReference Include="Avalonia.Themes.Simple" VersionOverride="11.0.5" />
<PackageReference Include="MessageBox.Avalonia" VersionOverride="3.1.5.1" />
<PackageReference Include="Microsoft.SourceLink.GitHub">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
Expand Down
73 changes: 55 additions & 18 deletions AltCover.Avalonia/MainWindow.fs
Original file line number Diff line number Diff line change
Expand Up @@ -65,26 +65,32 @@ type AboutBox() as this =

vslink.Text <- Resource.GetResourceString "aboutVisualizer.Copyright"

#if AVALONIA11
#else
let vsLinkButton =
this.FindControl<Button>("VSLinkButton")

vsLinkButton.Click
|> Event.add (fun _ ->
Avalonia.Dialogs.AboutAvaloniaDialog.OpenBrowser
"https://learn.microsoft.com/en-us/visualstudio/designers/the-visual-studio-image-library?view=vs-2022")
#endif

let link =
this.FindControl<TextBlock>("Link")

link.Text <- Resource.GetResourceString "aboutVisualizer.WebsiteLabel"

#if AVALONIA11
#else
let linkButton =
this.FindControl<Button>("LinkButton")

linkButton.Click
|> Event.add (fun _ ->
Avalonia.Dialogs.AboutAvaloniaDialog.OpenBrowser
"http://www.github.com/SteveGilham/altcover")
#endif

this.FindControl<TabItem>("AboutDetails").Header <-
Resource.GetResourceString "AboutDialog.About"
Expand Down Expand Up @@ -286,6 +292,9 @@ type MainWindow() as this =
"AvoidSwitchStatementsRule",
Justification = "This is FP, not OO")>]
member private this.ShowMessageBox (status: MessageType) caption message =
#if AVALONIA11
()
#else
let dlg =
MessageBox.Avalonia.DTO.MessageBoxCustomParamsWithImage()

Expand Down Expand Up @@ -314,6 +323,7 @@ type MainWindow() as this =

// can we get this to tidy up after itself??
mbox.ShowDialog(this) |> ignore
#endif

// Fill in the menu from the memory cache
member private this.PopulateMenu() =
Expand Down Expand Up @@ -691,9 +701,9 @@ type MainWindow() as this =
#else
let where = Persistence.readFolder ()

if Directory.Exists where then
ofd.SuggestedStartLocation <-
new Avalonia.Platform.Storage.FileIO.BclStorageFolder(where)
//if Directory.Exists where then
// ofd.SuggestedStartLocation <-
// new Avalonia.Platform.Storage.FileIO.BclStorageFolder(where)
#endif

ofd.Title <- Resource.GetResourceString "Open Coverage File"
Expand Down Expand Up @@ -802,13 +812,17 @@ type MainWindow() as this =
if isWindows then
fontItem.IsVisible <- true

#if AVALONIA11
#else
fontItem.Click
|> Event.add (fun _ ->

let hwnd = this.PlatformImpl.Handle.Handle

Fonts.SelectWin32(Persistence.readFont (), hwnd)
|> Option.ofObj
|> Option.iter respondToFont)
#endif
else if Fonts.Wish().Any() then
fontItem.IsVisible <- true

Expand Down Expand Up @@ -890,32 +904,32 @@ type MainWindow() as this =
|> Event.choose id
|> Event.map (fun n ->
#if AVALONIA11
use temp = ofd.SuggestedStartLocation
let ok, where = n.TryGetUri()
let path = where.AbsolutePath

if ok then
ofd.SuggestedStartLocation <-
new Avalonia.Platform.Storage.FileIO.BclStorageFolder(
Path.GetDirectoryName path
)
//use temp = ofd.SuggestedStartLocation
//let ok, where = n.TryGetUri()
//let path = where.AbsolutePath

//if ok then
// ofd.SuggestedStartLocation <-
// new Avalonia.Platform.Storage.FileIO.BclStorageFolder(
// Path.GetDirectoryName path)
#else
ofd.Directory <- Path.GetDirectoryName n
#endif

if Persistence.save then
#if AVALONIA11
let ok, where =
ofd.SuggestedStartLocation.TryGetUri()
//let ok, where =
// ofd.SuggestedStartLocation.TryGetUri()

if ok then
Persistence.saveFolder where.AbsolutePath
//if ok then
// Persistence.saveFolder where.AbsolutePath
()
#else
Persistence.saveFolder ofd.Directory
#endif

#if AVALONIA11
justOpened <- path
//justOpened <- path
#else
justOpened <- n
#endif
Expand Down Expand Up @@ -955,7 +969,11 @@ type MainWindow() as this =
else
row.Tag <- Expanded

#if AVALONIA11
//"AvaloniaUI v11"
#else
row.Items <- l
#endif

row.Tapped
|> Event.add (fun x ->
Expand All @@ -976,7 +994,11 @@ type MainWindow() as this =
let remargin (t: TreeViewItem) =
if t.HeaderPresenter.IsNotNull then
let hp =
#if AVALONIA11
t.HeaderPresenter
#else
t.HeaderPresenter :?> Avalonia.Controls.Presenters.ContentPresenter
#endif

let grid = hp.Parent :?> Grid
grid.Margin <- Thickness(float t.Level * 4.0, 0.0, 0.0, 0.0)
Expand Down Expand Up @@ -1005,8 +1027,11 @@ type MainWindow() as this =
(tip: string option) ->
let newrow = makeNewRow pc leaf name icon

(context.Row.Items :?> List<TreeViewItem>).Add newrow
#if AVALONIA11

#else
(context.Row.Items :?> List<TreeViewItem>).Add newrow
#endif
tip
|> Option.iter (fun text -> ToolTip.SetTip(newrow, text))

Expand All @@ -1029,7 +1054,11 @@ type MainWindow() as this =
let tree =
this.FindControl<TreeView>("Tree")

#if AVALONIA11

#else
tree.Items <- Enumerable.Empty<TreeViewItem>()
#endif
tree.InvalidateVisual()
this.UpdateMRU info.FullName false)
UpdateUISuccess =
Expand Down Expand Up @@ -1070,7 +1099,11 @@ type MainWindow() as this =
.FindControl<StackPanel>("Branches")
.Children.Clear()

#if AVALONIA11

#else
tree.Items <- auxModel.Model
#endif
tree.InvalidateVisual()

if info.IsNotNull then
Expand All @@ -1080,7 +1113,11 @@ type MainWindow() as this =
let tree =
this.FindControl<TreeView>("Tree")

#if AVALONIA11

#else
tree.Items <- Enumerable.Empty<TreeViewItem>()
#endif
tree.InvalidateVisual()

let model = auxModel.Model
Expand Down
8 changes: 8 additions & 0 deletions AltCover.Avalonia/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@ open Mono.Options

module VisualizerMain =
#if !NETSTANDARD2_0 // no AppBuilder here
#if AVALONIA11

#else
let BuildAvaloniaApp () =
AppBuilderBase<AppBuilder>
.Configure<App>()
.UsePlatformDetect()
.LogToTrace(LogEventLevel.Warning)
#endif
#endif

[<EntryPoint>]
Expand All @@ -33,8 +37,12 @@ module VisualizerMain =
options.Parse(arguments) |> ignore

#if !NETSTANDARD2_0
#if AVALONIA11
0
#else
BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(arguments)
#endif
#else
0
#endif
Expand Down
2 changes: 1 addition & 1 deletion AltCover.DataCollector/AltCover.DataCollector.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>AltCover</RootNamespace>
<AssemblyName>AltCover.DataCollector</AssemblyName>
<NoWarn>1701;1702;NU1603</NoWarn>
<NoWarn>$(NoWarn);1701;1702;NU1603</NoWarn>
<DocumentationFile />
</PropertyGroup>

Expand Down
6 changes: 6 additions & 0 deletions AltCover.DotNet/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,11 @@ open System.Diagnostics.CodeAnalysis

[<assembly: System.CLSCompliant(true)>]
[<assembly: System.Runtime.InteropServices.ComVisible(false)>]
[<assembly: SuppressMessage("Microsoft.Performance",
"CA1813:AvoidUnsealedAttributes",
Scope = "type",
Target =
"System.Diagnostics.CodeAnalysis.DynamicDependencyAttribute",
Justification = "Injected type")>]

do ()
8 changes: 3 additions & 5 deletions AltCover.DotNet/DotNet.fs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,9 @@ open System.Linq
[<RequireQualifiedAccess>]
module DotNet =
type ICLIOptions =
interface
abstract member ForceDelete: bool
abstract member FailFast: bool
abstract member ShowSummary: String
end
abstract member ForceDelete: bool
abstract member FailFast: bool
abstract member ShowSummary: String

[<NoComparison;
SuppressMessage("Microsoft.Design", "CA1034", Justification = "Idiomatic F#");
Expand Down
2 changes: 0 additions & 2 deletions AltCover.DotNet/DotNet.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ module DotNet = begin
/// <para type="description">Interface defining general command line arguments for `dotnet test` use..</para>
/// </summary>
type ICLIOptions =
interface
/// <summary>
/// <para type="description">The `/AltCoverFailFast` value this represents</para>
/// </summary>
Expand All @@ -33,7 +32,6 @@ module DotNet = begin
/// <para type="description">The `/AltCoverShowSummary` value this represents</para>
/// </summary>
abstract member ShowSummary : System.String with get
end

/// <summary>
/// <para type="description">Union type defining general command line arguments for `dotnet test` use.</para>
Expand Down
Loading

0 comments on commit f96f096

Please sign in to comment.